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 <zbehan@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
This commit is contained in:
Zdenek Behan 2012-08-17 04:02:29 +02:00 committed by Gerrit
parent bc09fb8974
commit 4d21a2926a
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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