Commit Graph

210 Commits

Author SHA1 Message Date
Luigi Semenzato
2443fdd62e Add hook for personalizing chroot.
This places a simple hook in cros_sdk by executing commands
in $HOME/.cros_chroot_init when a chroot is built.  This
lets users copy files to the chroot (for instance, scripts), as
well as add lines to .bash_profile and other rc files.

BUG=chromium-os:31295
TEST=tested manually and verified .cros_chroot_init is executed when present

Change-Id: I2a5b070a9827272f7bb7b3d340ad6937b0bef329
Reviewed-on: https://gerrit.chromium.org/gerrit/23668
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
2012-06-14 11:24:37 -07:00
David James
654a00bd61 Stop the gvfsd-trash daemon during enter_chroot.
The gvfsd-trash daemon interferes with mounting and unmounting
images, so it should also be disabled for user chroots.

The gvfsd-trash daemon automagically creates 'trash' subdirectory inside
any directory you mount and holds on to it for a little while, preventing
you from being able to unmount your mount point.

BUG=chromium-os:23443
TEST=Verify that this fix fixes cros_make_image_bootable for daisy on
     Ubuntu precise.

Change-Id: I8df4c999ed57d7025b63c971390448c93d404e83
Reviewed-on: https://gerrit.chromium.org/gerrit/25243
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Anush Elangovan <anush@google.com>
Tested-by: David James <davidjames@chromium.org>
2012-06-13 15:44:58 -07:00
David James
fae0a59e8b Stop the automounting daemon whenever we're inside the chroot.
If automounting is enabled while we're inside the chroot, simple mount /
unmount commands will fail, causing image building commands to fail flakily.

This allows for quick mount / unmount.

BUG=chromium-os:23443
TEST='cros_sdk true' works now and does not print warnings on systems that
     previously had race conditions in this case.

Change-Id: I18d725324cc42ab7c527d3b52479b6a90bc4172c
Reviewed-on: https://gerrit.chromium.org/gerrit/25166
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-06-13 12:04:57 -07:00
Brian Harring
334050f24e Ensure .repo/alternates is writable by the invoking user.
The only way to trigger this is if references were set up, but
never instantiated.

BUG=chromium-os:31682
TEST=manual permission checking.

Change-Id: Ibfc9dadf838f554cd10411753b5769117b1b1d42
Reviewed-on: https://gerrit.chromium.org/gerrit/24932
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-06-10 01:38:08 -07:00
J. Richard Barnette
ea82dfb4dc Don't look in chroot-based paths outside the chroot, even in jest.
When bootstrapping a chroot, the test for "is this a private source
tree repo" looked under the source tree in ~/trunk/src.  That test
was reliable inside the chroot (during update_chroot), but from
outside the chroot (during bootstrapping) it depended on whether the
user had a ~/trunk/src with a certain file.

This change enforces correct behavior outside the chroot regardless
of the contents of the user's home directory.

BUG=chromium-os:31602
TEST=run the test case described in the bug report

Change-Id: I2150347fbad9c84af537f8c572908e6e5ce312b4
Reviewed-on: https://gerrit.chromium.org/gerrit/24659
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2012-06-07 12:07:41 -07:00
Zdenek Behan
074f9efad4 make_chroot: support multiple tarball compression methods (esp. xz)
BUG=chromium-os:19287
TEST=try building a chroot both using .tbz2, .tar.bz2 and .tar.xz

Change-Id: Idfb13b691201b65c1fa1d5f8597f2aaa401a4051
Reviewed-on: https://gerrit.chromium.org/gerrit/23964
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2012-05-30 17:59:53 -07:00
Brian Harring
021858a82f Work around tar/pbzip2 idiocy limiting it to single core.
For the builders/goobuntu, they're running pbzip2 ~1.0.5 w/ tar 1.22;
for whatever reason, that configuration reproducibly limits to single
core for:

tar -I /usr/bin/pbzip2 -xf /the/sdk

This is annoying; 2 minutes instead of 10s for 48 core builder for
example.  Thus does *not* occur w/in the chroot (differing versions),
nor for tar=1.26 w/ pbzip2 1.1.6.  The changelogs for both programs
are a bit spartan, but I'm suspecting tar just wasn't feeding it
particularly well (pbzip2 1.0.5 will parallelize if stdin is a pipe).

Regardless, we either try to force everyone to upgrade, or we just
use a form that behaves fine, which is what this CL does.

BUG=chromium-os:31320
TEST=manual validation of it.

Change-Id: I77a434bd2c70873459cbf373192fe73feadb2547
Reviewed-on: https://gerrit.chromium.org/gerrit/23811
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-05-27 13:47:32 -07:00
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
Mike Frysinger
4d8c285509 enter_chroot: fix spurious resolv.conf warning
When bootstrapping for the first time, files in chroot/etc/ might not
exist, so we can't run `find` on them.  This manifests itself currently
by spitting out the warning on all initial sdk boots:
	find: `.../chroot/etc/resolv.conf': No such file or directory

People can find this confusing and cause sheriffs to waste time on the
wrong thing, so rework the code to avoid this.

BUG=None
TEST=`cros_sdk --delete ; cros_sdk` no longer warns about resolv.conf

Change-Id: I83f892e325e63e682aeb370a9dfc33e284e059d2
Reviewed-on: https://gerrit.chromium.org/gerrit/22845
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-05-16 20:52:30 -07:00
Mike Frysinger
9e5b0a43ba enter_chroot: use /proc/mounts rather than mount
Since /etc/mtab could be stale, use /proc/mounts instead.

BUG=None
TEST=`cros_sdk` in diff terminals still works

Change-Id: I526e5173581820c6983fe3702493a0349c1232c3
Reviewed-on: https://gerrit.chromium.org/gerrit/22860
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-05-16 16:05:42 -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
Chris Wolfe
916b1f1e11 enter_chroot: symlink boto config from chromeos-overlay, if available
The private chromeos-overlay has shared credentials for read-only
access to the archive of CrOS images. When entering the chroot check
whether these credentials are available, and install them to ~/.boto
within the chroot unless that file already exists.

BUG=None
TEST=Applied patch and entered fresh private and public chroots.
  Manually ran 'gsutil config' to replace the credentials;
    this works as long as there is no ~/.boto.bak already.
  Re-entered the chroot with manually-configured credentials.
  Ran 'gsutil ls' with BOTO_CONFIG set to a board-specific boto.

Change-Id: Ib62dc28f90bce692a833b5fc9d4c56981acc98d1
Reviewed-on: https://gerrit.chromium.org/gerrit/21480
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Chris Wolfe <cwolfe@chromium.org>
Commit-Ready: Chris Wolfe <cwolfe@chromium.org>
2012-05-01 08:26:14 -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
Zdenek Behan
63989c25ec make_conf_util: initialize make.conf with the real number of CPUs
BUG=none
TEST=cros_sdk --bootstrap, check out make.conf.host_setup

Change-Id: Icca34d4185869092f281de6b53929377c1410f5e
Reviewed-on: https://gerrit.chromium.org/gerrit/17845
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2012-03-12 14:02:56 -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
Matt Tennant
f7c9e7785b Copy ~/.gdata_token to chroot upon enter_chroot.
The refresh-packages builder needs to start using auth tokens for logging into
Google Docs, rather than email/password each time, so this copies ~/.gdata_token
into the chroot in the same way as ~/gdata_cred.txt.

BUG=chromium-os:23819
TEST=Put a file at ~/.gdata_token outside chroot, then run:
`cros_sdk true ; cmp {chroot/home/$USER/,~/}.gdata_token`, which passes.

Change-Id: Ib688a01aa88e0fd0f0211236bb0354813ef1fbb3
Reviewed-on: https://gerrit.chromium.org/gerrit/15550
Commit-Ready: Matt Tennant <mtennant@chromium.org>
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Tested-by: Matt Tennant <mtennant@chromium.org>
2012-02-09 17:27:44 -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
Brian Harring
dd7d7939e0 enter_chroot: add support for git object pool indirection
This adds repo --references awareness (which maps down to git shared object
pools; see git clone -s); specifically, it sets up the appropriate indirection
bindings back to the actual shared source for use from within the chroot.

Note that the approach is a bit complex, but it's required complexity- via
this approach the references are accessible both from within, and without
the chroot.

BUG=chromium-os:19939
TEST=cbuildbot x86-generic-full --clobber --notests --nouprev
TEST=cbuildbot x86-generic-full --notests --nouprev
CQ-DEPEND=I986f17503dc154234ecadd90f6975d7164117cdb

Change-Id: I8498863010cefe0bf5b8f20350fa45a5f2a093d3
Reviewed-on: https://gerrit.chromium.org/gerrit/13467
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-01-26 19:32:18 -08:00
Mike Frysinger
9de707f77e enter_chroot: skip ssh agent dir if it is invalid
On long running systems, the ssh-agent dir might go stale.  This should
not prevent entering the cros chroot though, so skip it if it's invalid.

BUG=None
TEST=`cros_sdk` enters with ssh-agent dir bind mounted
TEST=`rm -rf /tmp/ssh-*/; cros_sdk` enters with ssh-agent dir skipped

Change-Id: I923b031612c0d37a896437c7355cac6c448eef82
Reviewed-on: https://gerrit.chromium.org/gerrit/12758
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-12-12 15:40:58 -08:00
Matt Tennant
63c3cc56b3 Update the ssh/config filters in enter_chroot.sh
The current instructions for golo access include additions to the
~/.ssh/config file that are specific to Google distros of ssh.  The
filtering mechanism in enter_chroot needed an update to include
these new options to filter out.

BUG=chromium-os:23322
TEST=With a golo-configured .ssh/config, enter chroot and test ssh:
> cros_sdk
> git remote update
Fetching ...
...

Change-Id: Ida9fcdff37ff0eb24c811ad789f82136dca7252f
Reviewed-on: https://gerrit.chromium.org/gerrit/12037
Tested-by: Matt Tennant <mtennant@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Matt Tennant <mtennant@chromium.org>
2011-11-22 15:15:16 -08:00
Mike Frysinger
286b5928c8 enter_chroot: merge multiple mount requests into a single sudo
Every invocation of `sudo` delays things, so merge all of the mounts
into a single `sudo` command when possible.  This saves over 1 second
on initial execution (out of ~4 seconds total).

BUG=None
TEST=`cros_sdk --enter true` still mounts & unmounts properly

Change-Id: Ibc66507dc21250a81207d2f940645eaebe93c79c
Reviewed-on: https://gerrit.chromium.org/gerrit/10901
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2011-11-14 13:42:21 -08:00
Mike Frysinger
40bb0c3152 enter_chroot: ignore errors from copying user ssh files
The current code that syncs the user's ssh files from ~/.ssh/ to the
chroot assumes the user has these files in the first place.  For the
fresh user and/or install, these might not exist.  So ignore errors
from attempting to copy them.  It's not like we attempt to "recover"
anyways, and this sync is more of a "let's make things smoother" than
a "we need this to run properly".

BUG=chromium-os:15005
TEST=`mv ~/.ssh ~/.ssh.bak; mkdir ~/.ssh; cros_sdk` and see no more warnings

Change-Id: I9cac2ecad7c64c088fbdfe55377c0429b3b7ab03
Reviewed-on: https://gerrit.chromium.org/gerrit/10922
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2011-10-31 21:49:19 -07:00
Aaron Plattner
130d363aaa Bind-mount /run if it exists
Ubuntu 11.10, for whatever reason, moved /dev/shm to /run/shm.  Since
/run is not mounted in the chroot, /dev/shm is a dangling symlink and
various things that require shared memory start failing.

If /run and /run/shm exist, bind-mount them in the chroot.

Because /run doesn't yet exist in the SDK tarballs, try to create it
(and /run/shm if necessary) as root if it and can't be created as a
normal user.

BUG=chromium-os:19871
TEST=Run cros_sdk, verify that /dev/shm has the expected contents

Change-Id: I61583c1c0d409c1234fa8d8930a9b64544c9a8e7
Reviewed-on: https://gerrit.chromium.org/gerrit/10222
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2011-10-26 20:25:20 -07:00
Mike Frysinger
470be99f4f enter_chroot: try to avoid sudo when deleting sync pid file
The sync pid file is created without using sudo which means we should be
able to delete it without using sudo.  By default, run `rm` directly and
if it fails, fall back to sudo like we historically have.

BUG=None
TEST=`cros_sdk --enter true`; see pid file deleted

Change-Id: I26d898f6d594eb9ea4652335468345dd11303122
Reviewed-on: http://gerrit.chromium.org/gerrit/8644
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-10-07 08:10:29 -07:00
Mike Frysinger
0a0e6ecee3 enter_chroot: avoid multiple readlink calls on mount point
We call `readlink -f` on the chroot mount point to resolve any symlinks
in the path (since that is what `mount` records).  But the only paths
that can have symlinks are in the base chroot mount.  Everything below
that we know are not going to be symlinks (since we've set up the paths
ourselves).  So process the chroot mount point with readlink once and
reuse that value everywhere else.

BUG=None
TEST=`cros_sdk --enter true` still mounts & unmounts properly

Change-Id: Id1e734d20c0cb766f5490583b793930af77b3b14
Reviewed-on: http://gerrit.chromium.org/gerrit/8645
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-10-03 12:27:55 -07:00
Mike Frysinger
9a50b64449 enter_chroot: re-factor chrome_root mounting to use ensure_mounted
The chrome root code doesn't attempt to mount the tree if there is no
source root configured.  So re-order the code from:
 - is chrome source mounted ?
 - does a chrome source exist ?
 - mount chrome source
to the more logical:
 - does a chrome source exist ?
 - use ensure_mounted to check+mount

This lets us use the mount cache for the chrome mounting and unifies
duplicated mount/checking logic.

BUG=None
TEST=`cros_sdk --enter` still works with simultaneous runs
TEST=`cros_sdk --enter -- ls` still works

Change-Id: I7e6af9dd7f65cefa04438c2862c931f06237060a
Reviewed-on: http://gerrit.chromium.org/gerrit/8032
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-10-03 07:42:28 -07:00
Mike Frysinger
b4d7c4b7b8 enter_chroot: extend ensure_mounted api to use it with depot_tools
The depot_tools mount code is exactly like ensure_mounted except that it
prints a warning instead of dying when things can't be mounted.  So take
the current api and extend it slightly to support warning or dying.  This
also lets us re-use the existing mount cache and avoid the forks as well
as clean up duplicated code.

BUG=None
TEST=`cros_sdk --enter` still works with simultaneous runs
TEST=`cros_sdk --enter -- ls` still works

Change-Id: I89336778b6aa16191e79d900a51774929cadf06b
Reviewed-on: http://gerrit.chromium.org/gerrit/8031
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-30 22:29:42 -07:00
Mike Frysinger
61e4f2855b cros_sdk: avoid useless forks
The cros_sdk tool runs a lot of helper programs which can be replaced
with bash builtins, or condensed multiple calls into a single one.  By
themselves they aren't that slow, but add them all up and run them a
whole lot, and it starts to make a difference.

External programs to bash internals:
 - dirname $f    -> ${f%/*}
 - f=$(cat $f)   -> f=$(<$f)
 - which f       -> type -P f

Simpler expressions:
 - [[ ( ... ) ]] -> [[ ... ]]
 - eval v=\$$f   -> v=${!f}

Common/clearer expressions:
 - ! var=$(cmd)  -> var=$(cmd || :)

Condensed tools:
 - sort | uniq   -> uniq -u

BUG=None
TEST=`cros_sdk --enter` still works with simultaneous runs
TEST=`cros_sdk --enter -- ls` still works

Change-Id: Ice5e5e252237082a2249990644e051895d61d1fd
Reviewed-on: http://gerrit.chromium.org/gerrit/8029
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-30 08:53:31 -07:00
Mike Frysinger
7f7a763ed1 enter_chroot: optimize env_sync_proc ownership changing
Most of the time the files in the chroot /etc/ are already changed to
the proper owner.  Only on the first run do they need to be changed.
So check the owner before doing the sudo as that is a bit faster.  If
we do end up needing to run sudo, bundle the commands up to avoid having
to execute sudo multiple times.

BUG=None
TEST=`sudo chown root chroot/etc/resolv.conf && cros_sdk --enter`; see /etc/resolv.conf owned by me

Change-Id: Ifd974ace168ab309fdc2e7583d135ee23576a5bb
Reviewed-on: http://gerrit.chromium.org/gerrit/8418
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-28 19:47:57 -07:00
Mike Frysinger
2a97059dfc cros_sdk: add a mount cache to avoid multiple execs
Since we grab a lock before mounting anything, we know that the relevant
list of mounts won't change (since we haven't changed it yet).  So we can
cache the output of `mount` and re-use that in every subsequent check.

BUG=None
TEST=`cros_sdk --enter` still works with simultaneous runs
TEST=`cros_sdk --enter -- ls` still works

Change-Id: I27c98c923761fb777686632fe6e6604ca543cfb6
Reviewed-on: http://gerrit.chromium.org/gerrit/8030
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-28 08:09:04 -07:00
Mike Frysinger
8264917362 cros_sdk: avoid sudo to chmod when possible
Checking the permission of files is faster than assuming they're broken
and then running `sudo chmod`, so do just that.

BUG=None
TEST=run `cros_sdk --enter` with bad perms and see them fixed
TEST=run `cros_sdk --enter` with correct perms and see sudo skipped
TEST=the buildbot failure was due to other changes, not this one

Change-Id: Ie69b4e766e2e3652944e4723d091ce589d07a4f6
Reviewed-on: http://gerrit.chromium.org/gerrit/8028
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-27 16:36:53 -07:00
Mike Frysinger
94717e3099 cros_sdk: unify duplicate git calls for user commit info
No need to call `git var | sed` multiple times when we can call it once
and then use bash string parsing routines to extract the relevant info.

BUG=None
TEST=delete .gitconfig in chroot; enter chroot; verify .gitconfig is up-to-date

Change-Id: I900e4241a5c53bc46c90eb0f2a01152f4bfba577
Reviewed-on: http://gerrit.chromium.org/gerrit/8027
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-26 08:43:10 -07:00
Mike Frysinger
4d258cdf9d enter_chroot: restore auto locale generation
First let's add a chroot upgrade hook that'll declare a small list of
locales to speed up glibc upgrades.

The other blocker was that `cros_sdk --enter` took an inordinate amount
of time to execute (`locale-gen -u` specifically) when the number of
existing locales is huge.  This seems to be a bug in the bash/glibc
stack which is resolved in newer versions, but we can workaround the
issue by forcing locale-gen to run in a C locale.  The tool itself does
not care about its locale and we silence its output.

BUG=chromium-os:20378
TEST=`cros_sdk --enter`; see no locales in /etc/locale.gen; run `./build_packages` and see upgrade hook work
TEST=generate all 400 locales; `cros_sdk --enter`; see that it was quick

Change-Id: I8fcc5e26bd8e1bcfd52b6a6c7ef3cacf0a252081
Reviewed-on: http://gerrit.chromium.org/gerrit/7806
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-19 21:57:14 -07:00
Mike Frysinger
acc4c9b3fc cros_sdk: optimize fuse loading
Running `sudo` at all is a bit poky, so let's avoid modprobing fuse when
we know it already exists because it's listed in /proc/filesystems.

The relative speed:
 time sudo modprobe fuse -> 0.164s
 time grep -q fuse /proc/filesystems -> 0.002s

BUG=None
TEST=enable `set -x`; run `sudo modprobe fuse`; run `cros_sdk true`; see modprobe skipped

Change-Id: I07213e7b0607ca65df2a8a3ae22eb4a49c8bb888
Reviewed-on: http://gerrit.chromium.org/gerrit/7824
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-19 10:20:00 -07:00
Mike Frysinger
da7be781c0 cros_sdk: optimize gconftool interaction
It doesn't make much sense to run gconftool when the default automount
value is what we already want: false.  So in this common case, skip the
save/restore logic altogether since we aren't actually changing things.

Further, we can merge the `which` check in by checking the exit status
of the `gconftool` run.  If it fails, the tool doesn't exist.

BUG=None
TEST=enable `set -x`; run `cros_sdk true`; see gconftool run once in common case

Change-Id: I1c6aee945218a8a9df533d9ef207c750f909c252
Reviewed-on: http://gerrit.chromium.org/gerrit/7823
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-19 09:57:26 -07:00
Mike Frysinger
1aa6124f1d cros_sdk: speed up unmounting when tearing down env
The teardown_env is a little slow when unmounting things because it runs
`sudo umount` once per mount point.  This is so that when things go wrong,
it can easily recover.  However, this slows down the common case at the
expense of the uncommon.

Refactor the code so that in the common case, we run one `sudo umount`.
When things do fail, we're a bit slower as we reparse the entire mount,
list, but that's fine as it's an error case.

BUG=None
TEST=enable `set -x`; run `cros_sdk true`; see all mount points unmounted in one shot

Change-Id: Iec98a7b9f51a77e90c30e6f6acae26e528b8c50d
Reviewed-on: http://gerrit.chromium.org/gerrit/7822
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2011-09-16 18:58:17 -07:00
Raymes Khoury
4460ea782f Disable locale-gen temporarily to workaround bug
Works around:
http://code.google.com/p/chromium-os/issues/detail?id=20378

which is breaking the tree.

BUG=chromium-os:20378
TEST=cros_sdk --enter

Change-Id: I0d5dc2dd6466efe9baafcc404648d2c53309a3b7
Reviewed-on: http://gerrit.chromium.org/gerrit/7679
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2011-09-13 17:10:30 -07:00
Matt Tennant
d4316fe32f When entering chroot, copy ~/.gdata_cred.txt if it exists.
The process of updating the Portage package status spreadsheet on
buildbots requires a credentials file at ~/.gdata_cred.txt in the
chroot.  All buildbot VMs have this file outside the chroot now,
so this change adds that file to the list of things created in
the user's homedir when entering the chroot.

BUG=None
TEST=Run cros_sdk in these scenarios:
~/.gdata_cred.txt exists -> Same file should be at $HOME in chroot
~/.gdata_cred.txt does not exist -> No file created in chroot

Change-Id: I5c0f333a9308f5efa5324ce2e202a7c9e9fdb48b
Reviewed-on: http://gerrit.chromium.org/gerrit/6911
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: Matt Tennant <mtennant@chromium.org>
2011-08-30 13:43:13 -07:00
J. Richard Barnette
8e6750dee7 Clean up sdk_lib/enter_chroot.sh startup boilerplate.
BUG=None
TEST=run cros_sdk

Change-Id: I39fafd58c7cc9fd536fe9b75f314f9970766a483
Reviewed-on: http://gerrit.chromium.org/gerrit/6414
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2011-08-22 12:57:34 -07:00
Mike Frysinger
4fc9c2706d enter_chroot.sh: always generate en_US locales
The buildbot code forces the en_US.UTF8 locale itself, and does so inside
of the chroot, so our auto-detection code doesn't catch it.  Always create
these locales that the buildbot uses.

BUG=None
TEST=cleared out locales, emptied out active locale env vars, ran enter_chroot, saw that en_US{,UTF8} were created

Change-Id: I9ad65007a340333e19743985c9cbeea9403823fa
Reviewed-on: http://gerrit.chromium.org/gerrit/6168
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2011-08-17 12:42:54 -07:00
Mike Frysinger
6601c52b1f enter_chroot: auto generate user locales
Since we no longer force LC_ALL=C on everyone, the few times that perl
does get run by people, it spews the expected "Setting locale failed"
warnings.  This isn't as big a deal as with Debian systems as perl usage
is uncommon in Gentoo.

This is also highlights the long-existing small issue of only specific
locales being available in the chroot.  So for non US english speaking
users, they've been having non-optimal experiences.

So parse the user's active locale and automatically generate the missing
ones in the chroot so that when they do enter, things "just work".

BUG=chromium-os:19139
TEST=set locale to non-existent ones, enter_chroot, & verify locales are created

Change-Id: I43f809a1ee1472e4797edab0f32cecf582ea8b48
Reviewed-on: http://gerrit.chromium.org/gerrit/5986
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-08-17 07:33:34 -07:00
Zdenek Behan
892e6acdc0 crosutils: move enter_chroot.sh to sdk_lib, code unchanged
* Removed boilerplate, simplified search code.
* Fixed one too long line

This will unfortunately kill all outstanding CLs into enter_chroot.

BUG=chromium-os:18750
TEST=run it

Change-Id: I39c45fa8163d92487b512e7e8d298ce9231f4bd2
Reviewed-on: http://gerrit.chromium.org/gerrit/5830
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Anush Elangovan <anush@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2011-08-12 16:35:07 -07:00