Changed the logic to discover the gcc atom from the config.

The gcc-config file name could be different from the gcc atom that creates it.
Changed the logic to first find out the binary path of gcc and then to query
portage to see what package owns that path.

BUG=none
TEST=cros_sdk --bootstrap --replace
cros_sdk -- ./setup_board --board=x86-zgb --nousepkg

Change-Id: I3ccfa9948aaba6ba28107f150523c8a5d7cf1260
Reviewed-on: https://gerrit.chromium.org/gerrit/15556
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: asharif <asharif@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: asharif <asharif@chromium.org>
This commit is contained in:
Ahmad Sharif 2012-02-08 19:45:57 -08:00 committed by Gerrit
parent 59d3d736a7
commit 211259aacd

View File

@ -422,11 +422,12 @@ early_enter_chroot emerge -uNv $USEPKG '>=sys-devel/gcc-4.4' sys-libs/glibc \
# HACK: Select the latest toolchain. We're assuming that when this is
# ran, the chroot has no experimental versions of new toolchains, just
# one that is very old, and one that was just emerged.
GCC_ATOM="$(early_enter_chroot portageq best_version / sys-devel/gcc)"
early_enter_chroot emerge --unmerge "<${GCC_ATOM}"
CHOST="$(early_enter_chroot portageq envvar CHOST)"
LATEST="$(early_enter_chroot gcc-config -l | grep "${CHOST}" | tail -n1 | \
cut -f3 -d' ')"
early_enter_chroot gcc-config "${LATEST}"
early_enter_chroot emerge --unmerge "<sys-devel/gcc-${LATEST/${CHOST}-/}"
# dhcpcd is included in 'world' by the stage3 that we pull in for some reason.
# We have no need to install it in our host environment, so pull it out here.