From 4d21a2926a2e10a438f22f874108712c3c0d4779 Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Fri, 17 Aug 2012 04:02:29 +0200 Subject: [PATCH] chroot: pass through USE and GCC_GITHASH from outside the chroot This is used to build toolchains with specific env variables BUG=chromium-os:33240 TEST=trybot x86-generic-toolchain-minor Change-Id: I2bbdd7d013a15c57c590a0d660a210e0ae2a6695 Reviewed-on: https://gerrit.chromium.org/gerrit/30645 Tested-by: Zdenek Behan Reviewed-by: David James Commit-Ready: Zdenek Behan --- sdk_lib/enter_chroot.sh | 5 ++++- sdk_lib/make_chroot.sh | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 3e4d980978..ca2725f13b 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -586,8 +586,11 @@ CHROOT_PASSTHRU=( "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" ) +# Some vars we want to keep. +KEEP_VARS="USE GCC_GITHASH" # Pass proxy variables into the environment. -for type in http_proxy ftp_proxy all_proxy GIT_PROXY_COMMAND GIT_SSH; do +PROXY_VARS="http_proxy ftp_proxy all_proxy GIT_PROXY_COMMAND GIT_SSH" +for type in ${KEEP_VARS} ${PROXY_VARS}; do if [ -n "${!type}" ]; then CHROOT_PASSTHRU+=( "${type}=${!type}" ) fi diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh index a02ffd1f0d..4d459d211a 100755 --- a/sdk_lib/make_chroot.sh +++ b/sdk_lib/make_chroot.sh @@ -16,6 +16,11 @@ ENTER_CHROOT=$(readlink -f $(dirname "$0")/enter_chroot.sh) enable_strict_sudo +if [ -n "${USE}" ]; then + echo "$SCRIPT_NAME: Building with a non-empty USE: ${USE}" + echo "This modifies the expected behaviour and can fail." +fi + # Check if the host machine architecture is supported. ARCHITECTURE="$(uname -m)" if [[ "$ARCHITECTURE" != "x86_64" ]]; then @@ -457,7 +462,7 @@ fi # As a final pass, build all desired cross-toolchains. info "Updating toolchains" -enter_chroot sudo "${CHROOT_TRUNK}/chromite/bin/cros_setup_toolchains" \ +enter_chroot sudo -E "${CHROOT_TRUNK}/chromite/bin/cros_setup_toolchains" \ "${TOOLCHAIN_ARGS[@]}" command_completed