Commit Graph

210 Commits

Author SHA1 Message Date
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