Commit Graph

73 Commits

Author SHA1 Message Date
Mike Frysinger
279f103240 make_chroot: drop ccache install
Now that this is part of hard-host-depends, an we don't build the chroot
itself with ccache, so there's no need to force it in early.

BUG=None
TEST=`cbuildbot chromiumos-sdk` passed

Change-Id: I8b7c2a8c6f6df5eedac0c06ebb847f3011eb86d0
Reviewed-on: https://gerrit.chromium.org/gerrit/22954
Reviewed-by: Anush Elangovan <anush@google.com>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-05-18 09:38:54 -07:00
Zdenek Behan
2fbd5af6a8 Make use of cros_setup_toolchains, take 2
Resubmit of If62b4f3973f02fd8e1deed35864c824a02ab0c22
This will be safe to land after
I2c4e21ec7e8c0c0cf58947e2b0a3a9edf7617a09
The breakage was a timing issue paired with people not always syncing
the complete tree. No changes to the CL are needed.

It is now used for:
- make_chroot (cros_sdk --bootstrap)
- update_chroot

setup_board is stripped of redundant code which was deprecated by this.

Also stripped is some usepkg logic in make_chroot, as that is now
exclusively source-only.

BUG=chromium-os:23032
TEST=trybot chromiumos-sdk

Change-Id: Ib888cf2886218622d9cfeebb17b9cd4462d06c89
Reviewed-on: https://gerrit.chromium.org/gerrit/22578
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: asharif <asharif@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
2012-05-14 18:43:04 -07:00
Mike Frysinger
6b1abb2a6f fix up function style
The "function" keyword is superfluous, not in POSIX, is inconsistent
between bash files, and generally makes me angry.  So convert every
instance to the form:
	foo() {

BUG=None
TEST=`cbuildbot x86-generic-paladin` works

Change-Id: I97f5ca30a3edfef7222b1e08ac23917dc613b556
Reviewed-on: https://gerrit.chromium.org/gerrit/22467
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-05-11 14:10:38 -07:00
Brian Harring
7f175a59e1 common.sh: output a backtrace and debug information on failure.
Currently, if set -e spots a nonzero exit we basically have
no real debug information- it just stops immediately without stating
where or why.  This forces our scripts to be stupidly verbose so
we can track roughly where they were, thus when they fail we can
use that information to localize the rough exit point.

Instead we should be traping that set -e induced exit and
outputing necessary debug information to run it down.  This includes
outputing the relevant stack trace, or at least what we can get of
it.

The 'die' function is now enhanced to automatically dump the trace
that lead to it.  For most consumers this is desired- however for
commandline parsing induced dies ("--board is missing" for example),
the trace is noise.  For those cases, a 'die_notrace' function was
added that retains the original non-backtrace behaviour.

Example output via instrumenting cros_generate_breakpad_symbols
w/ the failing command '/bin/false' (nonzero exit code).

Before:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
<no output at all, just exit code 1>

With this CL:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
ERROR   : script called: ./cros_generate_breakpad_symbols 'monkeys' '--board=x86-alex'
ERROR   : Backtrace:  (most recent call is last)
ERROR   :   file cros_generate_breakpad_symbols, line 207, called: main 'monkeys' '--board=x86-alex'
ERROR   :   file cros_generate_breakpad_symbols, line 163, called: die_err_trap '/bin/false' '1'
ERROR   :
ERROR   : Command failed:
ERROR   :   Command '/bin/false' exited with nonzero code: 1

BUG=chromium-os:30598
TEST=inject a failing command into a script, verify the output.
TEST=inject a 'command not found', verify the output
TEST=cbuildbot x86-generic-full --remote
TEST=cbuildbot arm-tegra2-full --remote
TEST=cbuildbot chromiumos-sdk --remote

Change-Id: I517ffde4d1bb7e2310a74f5a6455b53ba2dea86c
Reviewed-on: https://gerrit.chromium.org/gerrit/17225
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-05-07 17:19:41 -07:00
Zdenek Behan
26fe5709a4 Revert "Make use of cros_setup_toolchains, take 2"
This reverts commit baa696e37bf1c48e5db0616460f7fbb0cff01e61

Change-Id: I6dcbc8afdcb715dc9ffe7b551a882279320f9f04
Reviewed-on: https://gerrit.chromium.org/gerrit/21813
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2012-05-03 15:07:25 -07:00
Zdenek Behan
95fadc6e33 Make use of cros_setup_toolchains, take 2
Resubmit of If62b4f3973f02fd8e1deed35864c824a02ab0c22
This will be safe to land after I2c4e21ec7e8c0c0cf58947e2b0a3a9edf7617a09

It is now used for:
- make_chroot (cros_sdk --bootstrap)
- update_chroot

setup_board is stripped of redundant code which was deprecated by this.

Also stripped is some usepkg logic in make_chroot, as that is now
exclusively source-only.

BUG=chromium-os:23032
TEST=trybot chromiumos-sdk

Change-Id: Ic908eac712ac097e5c2062d3be70177e172aa924
Reviewed-on: https://gerrit.chromium.org/gerrit/20191
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2012-05-03 13:27:13 -07:00
Zdenek Behan
3602abe286 Revert "Make use of cros_setup_toolchains"
Breaks the tree.

This reverts commit f3904d6530d3fd195a3659963a351b6ba8d0abff

Change-Id: Idaf6e59c506efcdf6a19d123ede7eb1cfafc3e2e
Reviewed-on: https://gerrit.chromium.org/gerrit/20182
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2012-04-12 19:48:36 -07:00
Zdenek Behan
24ae1d01d7 Make use of cros_setup_toolchains
It is now used for:
- make_chroot (cros_sdk --bootstrap)
- update_chroot

setup_board is stripped of redundant code which was deprecated by this.

Also stripped is some usepkg logic in make_chroot, as that is now
exclusively source-only.

BUG=chromium-os:23032
TEST=trybot chromiumos-sdk

Change-Id: If62b4f3973f02fd8e1deed35864c824a02ab0c22
Reviewed-on: https://gerrit.chromium.org/gerrit/17910
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
2012-04-12 18:29:59 -07:00
Mike Frysinger
ba7584561c make_chroot: deploy pbzip2 early
Make sure our chroot has pbzip2 as early as possible so we can leverage
it later on in the build process as the default compressor.

BUG=None
TEST=semi-manual:
	- remove pbzip2 as soon as we've unpacked the chroot in make_chroot
	- run `cros_sdk` and see no pbzip2 warnings

Change-Id: I27d00cdb97c5ffcde79eb04cfabbe6e82a72c706
Reviewed-on: https://gerrit.chromium.org/gerrit/19469
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-04-03 10:22:33 -07:00
Mike Frysinger
eb1a9b4e4e make_chroot: drop build-docbook-catalog hack
Now that the newer build-docbook-catalog supports ROOT, we don't need
to manually run this ourselves.

BUG=chromium-os:18036
TEST=`cbuildbot chromiumos-sdk` works

Change-Id: I3a89701a49623f9e50e651af9d8d505608fdc615
Reviewed-on: https://gerrit.chromium.org/gerrit/19252
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-03-29 10:04:24 -07:00
J. Richard Barnette
e80f6de440 Include the Chrome OS private overlay in the chroot, if present.
To build recovery images, the initramfs package needs fonts for
various languages.  The Japanese fonts to use depend on whether
it's an internal (Chrome OS) or external (Chromium OS) build.

Including the internal Japanese fonts requires additional settings
in /etc/make.conf in the chroot.  This change updates make_chroot
and update_chroot to ensure that the necessary settings are present
when appropriate.

BUG=chromium-os:26757
TEST=confirm proper packages after chroot creation with private manifest
TEST=confirm proper packages after chroot creation with public manifest
TEST=confirm proper packages after chroot upgrade with private manifest
TEST=confirm proper packages after chroot upgrade with public manifest
CQ-DEPEND=I32c4561c47752d96d2769c5429c5e44fe630f8f9

Change-Id: I2b29b32bf4e6b891a2228dc7f93ae0bb3f85e37f
Reviewed-on: https://gerrit.chromium.org/gerrit/17372
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
2012-03-08 12:17:44 -08:00
Mike Frysinger
66fd81f952 make_chroot: use --quiet when doing initial update
There's no reason to always show the full build output when updating the
chroot, so use the --quiet flag.  If there is a failure, emerge will dump
the full log like normal.

BUG=None
TEST=`cros_sdk --delete && cros_sdk` showed much less output

Change-Id: I062900325d0005db150dbd1267048a7c19df2ac5
Reviewed-on: https://gerrit.chromium.org/gerrit/16977
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-02-28 12:45:05 -08:00
Mike Frysinger
650bf873cd use --select for our core packages
We are changing the default emerge options to use --oneshot, so make sure
our scripts select the packages we care about for @world.

BUG=None
TEST=setup_board+build_packages for tegra2 adds pkgs to world

Change-Id: I5fc68c538a1a1c846bd9724f27ef717029d11d42
Reviewed-on: https://gerrit.chromium.org/gerrit/16838
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-02-27 14:07:37 -08:00
Mike Frysinger
2788e07b3f make_chroot: fix typo in emerge jobs variable
BUG=None
TEST=`cros_sdk --delete && cros_sdk` still works

Change-Id: I9a5d5e5eedb950dcfaf9108c22087a5a7fa7cd47
Reviewed-on: https://gerrit.chromium.org/gerrit/16825
Reviewed-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-02-27 12:43:58 -08:00
David James
d46beb7f75 Ensure preflight prebuilts are actually clobbered in make_chroot.
The logic of IGNORE_PREFLIGHT_PREBUILTS is currently inverted in make_chroot,
causing preflight prebuilts to be ignored by default, but then used in the one
situation where they should be ignored. This CL fixes that.

BUG=chromium-os:26834
TEST=Verify preflight prebuilts are now used by default in make_chroot.

Change-Id: I626319d6de79b6f201f993a05e34610e944b161e
Reviewed-on: https://gerrit.chromium.org/gerrit/16614
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-02-24 12:25:33 -08:00
David James
184e39019d Fix --jobs flags to actually work.
The --jobs=<n> option wasn't actually being passed to parallel_emerge --
which meant it didn't do anything.

BUG=chromium-os:26827
TEST=Ran with --jobs=N and made sure only N parallel_emerge processes were
started.

Change-Id: I581fc5588b54e246acaefd0c7e528e55adf9ba8a
Reviewed-on: https://gerrit.chromium.org/gerrit/16570
Reviewed-by: Michael Krebs <mkrebs@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-02-23 21:42:34 -08:00
Mike Frysinger
bdc4fb1998 make_chroot: clean up final log info
When we create a chroot for the first time, we see:
	...
	Exiting: Nothing left to do; exiting. :)
	Elapsed time: 5m10s
	cros_sdk: All set up.  To enter the chroot, run:"
	cros_sdk: $ cros_sdk --enter "

	CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind
	mounts you may end up deleting your source tree too.  To unmount and
	delete the chroot cleanly, use:
	$ cros_sdk --delete
	(cr) (v) vapier@vapier ~/trunk/src/scripts $

Kill the spurious double quotes, add new lines to make the text easier
to pick out from the previous command/new prompt, and only show the
sdk prefix on the first line.

BUG=None
TEST=`cros_sdk --delete && cros_sdk` looks nice

Change-Id: Iba0ee68035fffe6fc946e9b3476cc0d0b55abfc5
Reviewed-on: https://gerrit.chromium.org/gerrit/16075
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-02-17 15:30:04 -08:00
Ahmad Sharif
211259aacd Changed the logic to discover the gcc atom from the config.
The gcc-config file name could be different from the gcc atom that creates it.
Changed the logic to first find out the binary path of gcc and then to query
portage to see what package owns that path.

BUG=none
TEST=cros_sdk --bootstrap --replace
cros_sdk -- ./setup_board --board=x86-zgb --nousepkg

Change-Id: I3ccfa9948aaba6ba28107f150523c8a5d7cf1260
Reviewed-on: https://gerrit.chromium.org/gerrit/15556
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: asharif <asharif@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: asharif <asharif@chromium.org>
2012-02-13 14:30:30 -08:00
Brian Harring
feb04f77fe Require sudo usage to be non-interactive.
First, add a enable_strict_sudo helpers that scripts that are
sudo strict can invoke.  This does a sanity check bailing immediately
if invoked from a non sudo-keep-alive context.

Second, update enter_chroot.sh and make_chroot.sh to be strict.

While this is strict, that's the point.  The aim of this is to block
the previous sudo interactive mess for spreading, let alone reappearing
in scripts/code that has been cleansed.

BUG=chromium-os:18393
TEST=cros_sdk --replace; in the midst of it, do sudo -k.
     cros_sdk should thus bail out w/ an appropriate error.
CQ-DEPEND=I01bb1466cf027401fa387af7fad15e42fd33aea4

Change-Id: I76c5b87a812cc78c30a2eb1a0c56b9e438f4a98f
Reviewed-on: https://gerrit.chromium.org/gerrit/15294
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-02-08 16:19:14 -08:00
Brian Harring
36b102b5d1 Add upgrade script to move incremental chrome build content.
Via distfiles bind mounting, chrome build output was being cached
across chroot replacements.  This potentially is desirable, but
wasn't explicitly planned for and violates an assumption of the
canaries.

As such move the content to it's new location.

BUG=None
TEST=emerge-<board> chromeos-chrome
CQ-DEPEND=Ibfc5d42e74861ff498dd2cb6cc2d7be6ec0ded60

Change-Id: I18e384f0fc1cedb3c70ab85178103765322370eb
Reviewed-on: https://gerrit.chromium.org/gerrit/15383
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-02-07 00:35:44 -08:00
Brian Harring
7ee892d95a Mount bind external distfiles into the chroot.
Purpose of this is to allow us to avoid re-downloading everything
every time we rebuild the chroot.

This maintains two directories; host and target.  Future enhancement
involves collapsing this into one- this requires some host work however,
and has some potential gotchas in doing so.

Meanwhile, we now store distfiles in repo/distfiles/{host,target},
and mount bind repo/distfiles into /var/cache/distfiles.

An upgrade script in turn optimistically tries to move the content
into the new location; if it can't complete the move, it wipes the
content and the user has to redownload it (acceptable, if annoying).

BUG=chromium-os:13115
TEST=cbuildbot x86-generic-full

Change-Id: Iea96429df0e1fdc4ac0860fbce0daabc90c4c2a3
Reviewed-on: https://gerrit.chromium.org/gerrit/15189
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-02-06 21:49:37 -08:00
Brian Harring
357678296a Refactor make_chroot.sh to use enter_chroot, and cleanup complaints.
Now that make_chroot.sh lives alongside enter_chroot, we're able
to invoke it directly and use internal options not exposed through
cros_sdk.  Thus enter_chroot grows a --early_make_chroot flag.

This flag bypasses the normal sudo usage, and runs the command
as root.  It is needed and used by make_chroot for when sudo
may not yet exist (--bootstrap via stage3 lacks sudo).

For where sudo exists and we need access to the source tree,
distfiles, or profile sourcing, enter_chroot is directly used.

For all other invocations we use a single sudo chroot call to
bypass the overhead of enter_chroot.

This is a complete fix to chromium-os:25697 while addressing
all refactoring requests that came up in I8a6c5a26.

Finally, convert all comments into complete sentences, upper
case the leading word, etc to keep reviewers happy.

BUG=chromium-os:25697
TEST=Within a trybot, cros_sdk --bootstrap --replace
TEST=cros_sdk --replace
TEST=cros_sdk --delete
TEST=cros_sdk
Change-Id: I270ee7fc325ef0bea74c61505d25cdbb49a9a333
Reviewed-on: https://gerrit.chromium.org/gerrit/15322
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-02-06 18:40:07 -08:00
Brian Harring
f539bc3407 Import make_chroot from chromiumos-overlay.
Imported as of 09d3117c483c60f55f552694b84b0964dfc17477.

Only modification is so that it can find common.sh.

BUG=chromium-os:25697
TEST=None

Change-Id: Idb43f1ecff3dff10a61396629a344c8bd10f505e
Reviewed-on: https://gerrit.chromium.org/gerrit/15317
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-02-06 17:03:36 -08:00