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>
This commit is contained in:
J. Richard Barnette 2012-06-06 15:55:45 -07:00 committed by Gerrit
parent 019be8526e
commit ea82dfb4dc

View File

@ -46,14 +46,16 @@ _make_conf_prebuilt() {
# Include configuration settings for building private overlay # Include configuration settings for building private overlay
# packages, if the overlay is present. # packages, if the overlay is present.
# #
# N.B. The test for the presence of the private overlay uses a path # N.B. We explicitly disallow creating content for the private
# that only exists inside the chroot. When this function is invoked # overlay during bootstrapping, as it's not currently required,
# during bootstrapping, the test will fail, meaning the private # and at least a minor nuisance to implement. Note also that the
# overlay won't be used during bootstrapping. This is OK for # use of an inside-the-chroot path is based on the (currently true)
# current requirements. If you're reading this comment because you # assumption that bootstrapping use is outside the chroot, and
# can't get the private overlay included during bootstrapping, this # non-bootstrapping use is inside the chroot.
# is your bug. :-)
_make_conf_private() { _make_conf_private() {
if [ "$1" = "wget" ] ; then
return
fi
local chromeos_overlay="src/private-overlays/chromeos-overlay" local chromeos_overlay="src/private-overlays/chromeos-overlay"
chromeos_overlay="$CHROOT_TRUNK_DIR/$chromeos_overlay" chromeos_overlay="$CHROOT_TRUNK_DIR/$chromeos_overlay"
if [ -d "$chromeos_overlay" ]; then if [ -d "$chromeos_overlay" ]; then
@ -83,7 +85,7 @@ _create_host_setup() {
( echo "# Automatically generated. EDIT THIS AND BE SORRY." ( echo "# Automatically generated. EDIT THIS AND BE SORRY."
echo echo
_make_conf_fetchcommand "$fetchtype" _make_conf_fetchcommand "$fetchtype"
_make_conf_private _make_conf_private "$fetchtype"
_make_conf_prebuilt _make_conf_prebuilt
echo 'MAKEOPTS="-j'${NUM_JOBS}'"' ) | sudo_clobber "$host_setup" echo 'MAKEOPTS="-j'${NUM_JOBS}'"' ) | sudo_clobber "$host_setup"
sudo chmod 644 "$host_setup" sudo chmod 644 "$host_setup"