Commit Graph

128 Commits

Author SHA1 Message Date
Michael Marineau
5fa0f93134 fix(make_chroot): Remove the old "force-to-latest" chroot version step.
This script is gone and dead.
2013-08-06 17:30:54 -04:00
Michael Marineau
c4219e592e fix(make_chroot): Write sudoers.d/90_cros directly.
Previously this called a file in the now deleted chroot_version_hooks.d
which surprised me to say the least but it really shouldn't have...
2013-08-06 17:19:13 -04:00
Michael Marineau
74c4f21b68 fix(update_chroot): Replace old chroot version scheme.
The old chroot version system we inherited from Chromium OS always
assumes that a newly unpacked tarball is the latest and greatest but
since we version the SDK in the same way as target builds we can use
that version for these sorts of upgrade scripts and not make assumptions
about how late and great the starting tarball was.

The first upgrade script simply aborts to force the user to recreate
their chroot when moving from python 2.6 to 2.7.
2013-08-06 13:54:18 -04:00
Michael Marineau
ca6415dc89 fix(cros_sdk): Support using lbzip2 during chroot creation.
Our SDK tarballs aren't compressed using pbzip2 so there is no advantage
to using pbzip2 to decompress them over bzip2, however lbzip2 does offer
a big advantage. Also trust that the portage config defines a valid
version of bzip2 since we have control over the tarball creation and can
make sure to always include required utilities.
2013-07-26 18:31:18 -04:00
Michael Marineau
efa18698a0 fix(enter_chroot): Limit sharing system mount sharing
The existing code seems to assume that the mounts inherited from the
system are private, the Linux default. However on our systems that
clearly isn't the case, all system mounts are set as shared. Considering
all of us have been have been seeing mounts leak out of the SDK despite
cros_sdk creating a new filesystem namespace via unshare I'm guessing
this is a systemd thing.

Instead force all system mounts to 'slave' mode in the SDK namespace so
global changes are still visible but no SDK mounts can leak out.
2013-07-23 01:26:35 -04:00
Brandon Philips
95b2a4b8cd chore(*): use coreos_ everywhere 2013-07-21 23:20:50 -07:00
Michael Marineau
09203453dd fix(scripts): Add --load-average to MAKEOPTS
Already did this for catalyst builds but might as well do it for all.
With this competing builds on the same host should be a little
friendlier to each other.
2013-07-17 18:04:51 -07:00
Mike Frysinger
4bdab9f7fe enter_chroot: speed up entering by backgrounding locale generation
Half of the current time is spent on calling locale-gen even when there is
nothing to be done (all locales already generated).  Throw it into the bg
to unblock the main thread.

BUG=None
TEST=`cros_sdk` still works
TEST=`LANG=et_EE.UTF-8 cros_sdk` generates the new locale in the background

Change-Id: Ibe9a07bec60a59cab1cf4230358f7f8ff5b21c2e
Reviewed-on: https://gerrit.chromium.org/gerrit/58041
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-07-14 10:45:10 -07:00
Mike Frysinger
7f30c14bdc enter_chroot: bind mount /dev/pts
All devpts mounts are actually shared, even if you do:
	mount -t devpts none /dev/pts
	mount -t devpts none /mnt/foo
	mount -t devpts none /mnt/asdfasdf
These all provide the same data.

This is problematic because most distros mount their host devpts like so:
	mount -t devpts devpts /dev/pts -o mode=620,gid=5

But when cros_sdk runs, it uses:
	mount -t devpts none /dev/pts

We aren't specifying a mode/gid, so it ends up using the defaults, and
this resets the host devpts mount as well.

Since we've already assumed that the system has devpts available, it's
fine to also assume that the system has it mounted at /dev/pts and we
can simply bind mount it.

BUG=None
TEST=`cros_sdk` no longer messes up host perms on /dev/pts

Change-Id: Ib594fc5e47707f296d97ac1edce32659ed2b2273
Reviewed-on: https://gerrit.chromium.org/gerrit/48018
Reviewed-by: Steev Klimaszewski <threeway@gmail.com>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-07-14 10:45:10 -07:00
Michael Spang
a7627f70d9 Use rbind for ChromeOS source directory
I use a mount at src/build/images to stop image builds from repeatedly
filling up my SSD. The chroot needs to respect this.

TEST=cros_sdk
BUG=none

Change-Id: I5c7a26c3b4f263bd683d3a897e6edccb83187bda
Reviewed-on: https://gerrit.chromium.org/gerrit/47178
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
2013-07-14 10:45:10 -07:00
Mike Frysinger
0c0fea7b4d enter_chroot: handle /var/lock->/run/lock symlinks
Newer Gentoo builds have moved to /run which means /var/lock is a symlink
to /run/lock.  But since that is an absolute symlink, it points outside of
the chroot which doesn't work for us.  Use a stable path unrelated to the
chroot instead, but only with newer chroots.

We no longer have to worry about backwards compat because the code that
used to rely on this lock file (running sync processes) was punted a long
time ago.

BUG=chromium:218085
TEST=`cbuildbot chromiumos-sdk` passes

Change-Id: I38c6848dfb86386849050d7ccf3f90cbbe8e0e81
Reviewed-on: https://gerrit.chromium.org/gerrit/46231
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-07-14 10:45:10 -07:00
Paul Drews
b957c775ea Add capability to chroot to use proxies for git:// urls
This patch installs "socat" and a proxy gateway script into
the chroot so that git can use a proxy to access "git://"
protocol urls.  This is needed when performing builds from
behind a firewall that requires a proxy.  The script reads
the proxy environment variables all_proxy (SOCKS),
https_proxy (CONNECT), and http_proxy (CONNECT), in order of
preference, and supports no_proxy as a whitelist of target
hosts that must NOT go through the proxy.

This also updates enter_chroot.sh to automatically use this
script as GIT_PROXY_COMMAND when it sees the proxy
environment variables set.

The "socat" program is added to hard-host-depends as a
separate patch.  That handles socat installation in case of
building a chroot from scratch or upgrading.

The proxy-gw script is installed in the src/scripts/bin
directory which can be stably referenced within the chroot
as /mnt/host/source/src/scripts/bin/.  The
"/mnt/host/source" portion of this path is obtained from the
CHROOT_TRUNK_DIR environment variable which is set to a
suitable value by preexisting logic in common.sh.

This change became necessary to unbreak builds behind
proxies with the recent addition of two ebuilds using
egit.eclass with repositories using git:// URLs.

Original patch by Paul Drews <paul.drews@intel.com>;
modified version by Josh Triplett <josh@joshtriplett.org>.

CQ-DEPENDS=I1b01bce6f3e6a562b87f748e61508d142af576d9
BUG=none
TEST=git clone git://nv-tegra.nvidia.com/tools/cbootimage.git

Change-Id: Ic7fc917d1aa24f408bef6f102b6458114dded694
Reviewed-on: https://gerrit.chromium.org/gerrit/41659
Tested-by: paul drews <paul.drews@intel.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: paul drews <paul.drews@intel.com>
2013-07-14 10:45:10 -07:00
David James
e01374dc4b Fix 'too many levels of symbolic links' error.
In an Ubuntu Precise chroot on the Chromebook Pixel, /run/shm is a
symbolic link to /dev/shm, so bind-mounting /run/shm to /dev/shm
is really bind-mounting /dev/shm to itself, which causes a 'too many
levels of symbolic links' error. To fix this, we check for a symbolic
link prior to running this command.

BUG=none
TEST=cros_sdk no longer prints errors on Chromebook Pixel
Change-Id: Ib46cde2b4a0e00b69bd187488967e445b228ae80
Reviewed-on: https://gerrit.chromium.org/gerrit/45048
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2013-07-14 10:45:10 -07:00
Marc MERLIN
a1f5ee388d Remove a warning when $HOME is on NFS
If ~/.subversion doesn't exist, the code didn't run, but if it existed
there is no reason to re-create it, nor is it necessary to change its
permissions since they are inherited by the bind mount source.
However user_mkdir was trying to run chown as root which does not work
over NFS with root_squash or krb-nfs.
Therefore, the un-needed call to user_mkdir is removed.
(this is an issue because cros_sdk  --replace does call this code path
multiple times).

BUG=None
TEST=Built the chroot, and the permission denied on 'install' went away.
Change-Id: I01e9a7baf51a99a96d790c9613e26e652379e6df
Reviewed-on: https://gerrit.chromium.org/gerrit/44880
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Marc MERLIN <merlin@chromium.org>
Tested-by: Marc MERLIN <merlin@chromium.org>
2013-07-14 10:45:10 -07:00
Mike Frysinger
99d8dde1d6 make_chroot: clobber existing /etc/mtab
If our sdk has an /etc/mtab file already, then clobber it.  This fixes
build problems where chromeos-base now installs /etc/mtab for us, but
the sdk build isn't expecting it leading to the error:

INFO    cros_sdk:make_chroot: Running init_setup()...
ln: creating symbolic link `/b/cbuild/new-sdk-chroot/etc/mtab': File exists
Running ['/b/cbuild/src/scripts/sdk_lib/make_chroot.sh', '--stage3_path',
	'/b/cbuild/built-sdk.tar.xz', '--chroot', '/b/cbuild/new-sdk-chroot',
	'--cache_dir', '/b/cbuild/.cache', '--nousepkg'] failed!

BUG=None
TEST=`cros_sdk --chroot foo` still works

Change-Id: I539cf329e93e28534e6ff00577ce415d76918b85
Reviewed-on: https://gerrit.chromium.org/gerrit/43641
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-07-14 10:45:10 -07:00
Brandon Philips
aa7eed311a fix(*): use COREOS_OFFICIAL
use the COREOS_OFFICIAL env variable instead of CHROMEOS_OFFICIAL
2013-06-30 19:39:39 -07:00
Michael Marineau
17c609192a fix(enter_chroot): Use .boto from the user's HOME
We don't have any private overlays but users will likely have their own
credentials in ~/.boto so make it available in the chroot.
2013-06-26 21:24:01 -04:00
Brandon Philips
bc7b9b75e6 Merge pull request #3 from marineam/getbinpkg
fix(scripts): Add --nogetbinpkg command line option
2013-06-22 11:45:16 -07:00
Michael Marineau
f5e61302f1 fix(make_chroot): Remove unnecessary package rebuilds/removals
These are not required when starting from the new sdk stage4 tarballs
instead of a stock gentoo stage3 tarball.
2013-06-22 00:30:09 -04:00
Michael Marineau
19a993be96 fix(scripts): Add --nogetbinpkg command line option
As-is all of the various emerge wrapping scripts default to using
--getbinpkg whenever --usepkg is enabled. This means every single emerge
command made makes multiple synchronous HTTP requests to the upstream
binary package repository to get the latest package list. This gets
really frustrating when working remotely with limited network
connectivity. Using --usepkg with --nogetbinpkg will use locally cached
packages without making remote requests.
2013-06-18 14:49:59 -04:00
Brandon Philips
2f5399b103 fix(sdk_lib/make_chroot): make using prebuilt sdk work
fix a couple of buglets related to using a prebuilt sdk chroot
2013-03-06 17:04:40 -08:00
Brandon Philips
95798bbf33 fix(sdk_lib/make_chroot): fix git bash completion
Move this code to after we emerge git and bashcomp. Fixes 6df18385
2013-02-24 14:53:53 -08:00
Brandon Philips
728dfdae01 fix(sdk_lib/make_chroot.sh): use efunctions functions.sh
use the efunctions package for the /etc/init.d/functions.sh script
instead of backing up the old function.sh which doesn't work with the
new baselayout
2013-02-24 14:52:21 -08:00
Brandon Philips
6df1838526 fix(sdk_lib/make_chroot): enable git-prompt
shutup the errors about git_ps1 not existing

Change-Id: Ie157e4322a770efe7536aefaf34ea7d62c472f68
2013-02-22 07:40:08 -08:00
Brandon Philips
5ff06e1bfd chore(sdk_lib): chromeos -> coreos renames
Change-Id: I803a9670f87093088ec693fabd64585ee83bfb6a
2013-02-16 11:45:51 -08:00
Brandon Philips
0516fa7771 fix(sdk_lib/make_chroot): remove early git
emerging git seems to work fine, remove this early git hack

Change-Id: I1ec6a45724be292ce00d803e9161413c67804469
2013-02-16 11:44:48 -08:00
Brandon Philips
27a45c57c1 hack(sdk_lib/make_chroot.sh): save functions.sh
we remove openrc which provides /etc/init.d/functions.sh. Unfortunatly
other things rely on this file. Stash it away in /tmp/ then restore it
for now.

Change-Id: I18a59e05ecdf08cc8a560b29049c8d25ac1bf5a3
2013-02-16 11:31:14 -08:00
Brandon Philips
67488b3986 hack(make_chroot): hack to get scripts working
einfo and friends are needed and chrome scripts expect them to be in /etc/init.d/functions.sh

Change-Id: I3ca36892d73cdbb80d9a843e863ab5063f24eeb4
2013-02-14 16:18:56 -08:00
Brandon Philips
69e94f001e fix(make_chroot): get openssh and python 2.6 installed
new stage3 tarballs have python 3. Get python 2.6 installed and reemerge openssh

Change-Id: I903bbb4251534e9a1428d9773a57f2cf0602816f
2013-02-14 16:18:56 -08:00
Brandon Philips
6a362d27f9 fix(make_chroot): use the new places for make.conf
make.conf should live in /etc/portage these days

Change-Id: I55372ae3ee6a4ae7abf6873c08c1fcef46d7cd53
2013-02-14 16:18:56 -08:00
Brandon Philips
474313e651 fix(make_chroot): use the portage openssl for now
portage's openssl is up to date, no need to fork it for now.

Change-Id: Ib2a03811803ecf4626813706f6ef79ad4b1956f3
2013-02-14 16:18:56 -08:00
Brandon Philips
bf893c277f fix(make_chroot): default to using python 2.7
the stage3 has python3 which is terrible, don't do that.

Change-Id: I24f82c8eb59ff7c2953033d233d32bb0f959d8da
2013-02-14 16:18:56 -08:00
Brandon Philips
2f17a00183 chore(make_chroot): chromeos to coreos renames
Change-Id: I5f2b4fae96df91dd7d6d01cc393cebc3af011660
2013-02-14 16:18:56 -08:00
Brandon Philips
472ab7b202 fix(make_chroot): don't remove files that dont' exist
These files don't exist in the gentoo stage3, don't try and remove them.

Change-Id: Ie158b4989540482751cbb4de0ee8ef88e4f49759
2013-02-14 16:18:56 -08:00
Brandon Philips
c91cefb941 feat(make_chroot): use a new gentoo stage3
Change-Id: I6364212989ca0723fd78f4658369d6becd47b4bd
2013-02-14 16:18:56 -08:00
Brandon Philips
d6b1b47abb coreos: make chroot fixes
Change-Id: I9dc62495136dbbc9e491e7293822348c1a450481
2013-02-14 16:18:56 -08:00
Peter Mayo
45ebc4c9fc Copy the netrc into the chroot at entry.
This seems to be needed for acessing some of the chrome repositories.
Without it we get git clone hangs trying to sync.

BUG=chromium-os:38303
TEST=local entry into chroot

Change-Id: Ia68a6486022e8d230572bad0f9031c3e5d36197c
Reviewed-on: https://gerrit.chromium.org/gerrit/42140
Commit-Queue: Peter Mayo <petermayo@chromium.org>
Reviewed-by: Peter Mayo <petermayo@chromium.org>
Tested-by: Peter Mayo <petermayo@chromium.org>
2013-01-28 14:01:37 -08:00
David James
fc49d8dd19 Fix broken boto file handling.
After CL:39921, I get the following warning every time I enter the chroot:

ln: failed to create symbolic link `.../chroot/root/.boto': File exists

All bots get this error as well. This is caused because CL:39921, causes
~/trunk to no longer resolve outside the chroot, so it's invalid for processes
outside the chroot to try to resolve paths inside there. Fix cases where we do
this inside enter_chroot.sh.

BUG=chromium-os:37347
TEST=cros_sdk doesn't print warnings anymore.

Change-Id: Iaeb9b7407e12397bce1600bd51559be20f998fdf
Reviewed-on: https://gerrit.chromium.org/gerrit/41571
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2013-01-17 15:09:29 -08:00
Brian Harring
871a40aa8f Fix bug introduced via CL:37347
Slipped past during rename of the chroot upgrade script from
49 to 50; name was slightly changed but full re-validation of the
rename wasn't done (thus the typo slipped past testing, and review).

Simplify the code via removal of invoking the upgrade script, instead
just doing the relevant commands (fixing chroot awareness issues in
the process).

BUG=None
TEST=manual cros_sdk invocation

Change-Id: I122de8b4cf7ec0845643e09e7919cbcdbd0bb79a
Reviewed-on: https://gerrit.chromium.org/gerrit/41202
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2013-01-14 01:18:33 -08:00
Brian Harring
2499bfbeb2 Move source access to a standard location, add chromite to PYTHONPATH.
Rather than having to find /home/${SUDO_USER:-${USER}}/trunk, instead
just look for /mnt/host/trunk (defined by common.sh as $CHROOT_TRUNK_DIR).
This simplifies code flow, and is a requirement for shoving chromite
into PYTHONPATH globally w/in the chroot.

BUG=chromium-os:37347
TEST=cros_sdk --replace; cros_sdk w/ chroot upgrade.
Change-Id: I9ee3e6556541a91193f49cbf74ffc5a8e090537f
Reviewed-on: https://gerrit.chromium.org/gerrit/39921
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2013-01-14 00:44:03 -08:00
Mike Frysinger
93a2ecaaa9 enter_chroot: clean out stale ssh dirs
Over time, stale ssh agent dirs build up in /tmp.  Have enter_chroot run
a simple rmdir to clean out any empty dirs.  Since we mount over top the
dir, this shouldn't kill any valid mount points.

BUG=None
TEST=`cros_sdk` cleaned out empty ssh dirs in /tmp

Change-Id: Ib9f063f99db61825082818a39a39c5eb01f2d24e
Reviewed-on: https://gerrit.chromium.org/gerrit/39004
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-12-05 14:27:43 -08:00
David James
22dc2ba9d9 Fallback to SUDO_USER when running on NFS.
When running on NFS, the root user may not be able to access ~/.ssh and
~/.gitconfig, so it is necessary to fallback to SUDO_USER to access these
files.

To discourage users from using NFS homedirs, print warnings every time
cros_sdk is run with an NFS homedir.

BUG=chromium-os:36783
TEST=Try cros_sdk --replace and cros_sdk with and without NFS homedirs.

Change-Id: I4cdbceca485d3491656d6f743814da4ebcdd75ad
Reviewed-on: https://gerrit.chromium.org/gerrit/38953
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-11-30 09:06:06 -08:00
Mike Frysinger
96c5c1c659 make_chroot: do all the git bootstrapping before gcc
Explicitly build curl/openssl/git since the toolchain itself tries to
fetch over http with git.

BUG=None
TEST=`cros_sdk --bootstrap` works
TEST=`cbuildbot chromiumos-sdk` works

Change-Id: I50b3145732f8345d6ad6ada41325648cbea31b84
Reviewed-on: https://gerrit.chromium.org/gerrit/36995
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Han Shen <shenhan@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-10-31 17:21:04 -07:00
David James
76764885b9 Convert make_chroot.sh and enter_chroot.sh to run as root.
sudo takes 150ms per invocation on Goobuntu, and with 10 invocations in
enter_chroot.sh, this means that we're wasting a lot of time, every time
cros_sdk is invoked. Cutting these unnecessary invocations reduces the time
required to run enter_chroot.sh from 2.3s to 0.8s.

CL:36618 is the companion change that updates cros_sdk to invoke
sudo unshare -m prior to calling enter_chroot.sh.

Summary of changes:

1. Remove all calls to sudo and just run the commands directly.
  - Remove the mount queue and any sudo_multi optimizations.
  - Rename sudo_chroot -> bare_chroot because we don't run sudo anymore there.
  - Remove code for validating sudo timestamp.
2. Allow the scripts to work as root:
  - Ensure that files created by cros_sdk that previously were owned by the
    user still are owned by the user (either using chown or cp -p).
  - Use $SUDO_USER to find the user's account.
  - Use $SUDO_HOME instead of $HOME to find the user's home dir.
  - Remove outdated code for disabling automount on Lucid, which doesn't work
    when run as root.
  - Update code for calculating the user's git username to use sudo to switch
    to the user. Also move it to make_chroot.sh so that this change doesn't
    impact performance.
3. Cleanup
  - Remove environment syncer process in favor of just syncing once when chroot
    is entered.
  - Remove teardown and instead rely on unshare to unmount the mounts. To make
    sure that outside processes never notice the mounts, we use mount -n. This
    also ensures that /etc/mtab never contains stale mounts.
  - Remove path-overrides, since it is no longer needed.

BUG=chromium-os:35714, chromium-os:35679
TEST=Trybot runs.
CQ-DEPEND=CL:36618

Change-Id: I919a8aadb08fafde97348e8511573c28fdd47186
Reviewed-on: https://gerrit.chromium.org/gerrit/36619
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-10-30 14:49:48 -07:00
David James
ea75b60a45 Don't tell users that it's a bad idea to use gclient.
Users sometimes want to run gclient inside the chroot, so we shouldn't
tell users that using it is a bad idea.

The original reason why this message was added is historical: Originally,
users had a newer version of SVN inside the chroot compared to on their
workstation, so if you ran SVN inside the chroot it would permanently upgrade
your working copy such that the version of SVN outside the chroot did not work
with it anymore. This isn't a problem anymore, so we can remove the message.

BUG=none
TEST=Run remote trybot runs of chromiumos-sdk

Change-Id: I7b82a5c94e29d5928f4bb296ae2d99cef397d365
Reviewed-on: https://gerrit.chromium.org/gerrit/36346
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-10-23 11:44:35 -07:00
Paul Drews
b4605b42c0 enter_chroot: Link subversion configuration upon entry
The process of bootstrapping the chroot from sources was
failing for several reasons when run from behind a firewall
with proxies.  The llvm build was failing due to inability
to checkout sources through subversion using the
subversion.eclass wrapper (the "normal" way to do this in
the ebuild environment).  This was because the user's
subversion configuration (including proxy settings) was not
inherited from $HOME/.subversion into the in-chroot sandbox
used by subversion.eclass.

This change creates symbolic links in the subversion.eclass
sandboxes for host and target builds in the chroot to fix
any build that uses the normal subversion.eclass for
checkouts.  The operation is done at enter_chroot time so
that it applies to both ordinary builds and chroot creation
(via early_enter_chroot).

BUG=none
TEST='cros_sdk --replace --enter' behind proxied firewall

Change-Id: I0af2128866bb95799dc07c728c75cf3f2a0af7a3
Reviewed-on: https://gerrit.chromium.org/gerrit/34291
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: paul drews <paul.drews@intel.com>
Tested-by: paul drews <paul.drews@intel.com>
2012-10-12 23:09:01 -07:00
Paul Drews
8bae3b5667 Break the circular dependencies with curl, openssl, git
Building the chroot environment from sources using
"--bootstrap" currently runs into a circular dependency:

curl->openssl->git->curl

The openssl->git dependency comes indirectly from the fact
that the current version of openssl uses the "cros-workon"
ebuild package to assist in applying packages.  The ebuild
system automatically and silently resolves this circular
dependency by reverting the openssl library to an earlier
version that does not use cros-workon based patching.
Unfortunately this older version of openssl has a bug that
causes it not to work when doing builds in a firewalled
environment:  When curl (using this older version of openssl
library) attempts to fetch an "https" url, it authenticates
the target server against a bundle of certificate-authority
certificates it maintains.  Finding the certificate fails
(although the validation succeeds if curl is told explicitly
what certificate to use).  With the certificate not-found,
server authentication fails, the curl download fails, and
the build ultimately fails.

This patch breaks the circular dependency, allowing a
more-current version of openssl to be used in curl, making
the above build scenario work in a firewalled environment.
The circularity is broken by first building git without curl
support (and webdav that depends on curl).  Then early
toolchain components up through and including curl are
built.  This build of curl then uses a more up-to-date
version of openssl with the desired bug-fix.  Once curl is
built, then git is re-built and re-installed with the
now-installed version of curl (re-)enabled.

BUG=None
TEST=create chroot with --bootstrap ; build_packages (behind firewall)

Change-Id: Iaa560fdb6623fcb73cde066a3b2bc2a342169c62
Reviewed-on: https://gerrit.chromium.org/gerrit/34292
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: paul drews <paul.drews@intel.com>
Tested-by: paul drews <paul.drews@intel.com>
2012-10-10 23:25:48 -07:00
Paul Drews
b688cbe4f4 Fix chroot bootstrap "no such file or directory" breakage
CL:33868 (7b6f377c58) introduced a
breakage in the "cros_sdk --replace --bootstrap" scenario.
The make_chroot.sh script invokes early_enter_chroot before
invoking init_setup.  The chroot/etc/profiles.d directory is
created in init_setup, but the referenced change was
expecting to create a file in that directory in the context
of early_enter_chroot before the directory was created.
This led to a "no such file or directory" error when trying
to create the file.

This change does a "mkdir -p" of the referenced directory
before putting things in it in the context of
early_enter_chroot.  The filename is also fixed to the name
expected elsewhere in the scripts.

BUG=none
TEST=cros_sdk --replace --bootstrap

Change-Id: I6ac0467117d7b0dd413695153469b367d56c256c
Reviewed-on: https://gerrit.chromium.org/gerrit/34958
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-10-08 22:36:47 -07:00
Brian Harring
7b6f377c58 sdk_lib/*: Make --cache_dir option required.
This is forced by cros_sdk; in conjunction w/ this,
drop --distfiles and mangle the chroot on during entrance
dropping a symlink in the old /var/cache/distfiles location
pointing to the new mounted cache_dir location.

Additionally, thread CHROMEOS_CACHEDIR down through the end.
Do this without relying on a version upgrade script- we can't
require they be run before entering, thus we exploit the fact
that cros_sdk explicitly forces a write lock to do the upgrade,
if we see the old form we know we can do the upgrade w/out
worrying about collisions.

CQ-DEPEND=CL:33871

BUG=chromium-os:34457
TEST=manual testing.

Change-Id: I6805266e3ec683f05d3ba615f9e8840642a28e48
Reviewed-on: https://gerrit.chromium.org/gerrit/33868
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-09-28 19:16:39 -07:00
Ryan Cui
fe573cdbdf Fix bug with chroot updating /etc/hosts.
enter_chroot.sh was not updating /etc/hosts from the out-of-chroot
environment.  Make it do that.

BUG=None
TEST=locally

Change-Id: Ieaa337ae90dbc0700c42fa7e4b96faf12d3968cb
Reviewed-on: https://gerrit.chromium.org/gerrit/34226
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
2012-09-27 16:07:35 -07:00