From 9a995bb37c1876d0993fe426f7d72ba25853fc31 Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Fri, 2 Sep 2011 00:51:51 +0200 Subject: [PATCH] gcc-update-hook: regenerate latest gcc prior to calling gcc-config BUG=chromium-os:19613 TEST=below 1) Manually create a chroot with old gcc 2) Let the script update&select new one, unmerge old Change-Id: I71732da315ed4effc6df48afab797718e44d7a06 Reviewed-on: http://gerrit.chromium.org/gerrit/7117 Tested-by: Zdenek Behan Reviewed-by: Zdenek Behan Reviewed-by: David James --- chroot_version_hooks.d/7_host_gcc_upgrade | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/chroot_version_hooks.d/7_host_gcc_upgrade b/chroot_version_hooks.d/7_host_gcc_upgrade index 6e81ac9ac1..b0637e9c41 100644 --- a/chroot_version_hooks.d/7_host_gcc_upgrade +++ b/chroot_version_hooks.d/7_host_gcc_upgrade @@ -14,10 +14,14 @@ CHOST="$(portageq envvar CHOST)" # This is the lowest we want to go in this particular case. MINIMUM_GCC="4.4.6" -GCC_VERSIONS="$(gcc-config -l | grep "${CHOST}" | \ - cut -f3 -d' ')" -GCC_LATEST="$(gcc-config -l | grep "${CHOST}" | tail -n1 | \ - cut -f3 -d' ')" +function env_setup() { + GCC_VERSIONS="$(gcc-config -l | grep "${CHOST}" | \ + cut -f3 -d' ')" + GCC_LATEST="$(gcc-config -l | grep "${CHOST}" | tail -n1 | \ + cut -f3 -d' ')" +} + +env_setup if ! [ "$(portageq match / ">=sys-devel/gcc-${MINIMUM_GCC}")" ]; then @@ -34,6 +38,8 @@ then fi fi +env_setup + info "Updating the host toolchain. crosbug.com/19613" info "Currently installed host gcc versions: $(echo -n ${GCC_VERSIONS})"