From 15b637aa78aeac4c8e439e0ccc7eb5e7a2918579 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 10 Jul 2013 17:31:22 -0400 Subject: [PATCH] fix(catalyst): Take advantage of binary packages for cross toolchains. The previous logic here only skipped the bootstrap if the toolchain packages were already installed (which won't happen on the build host) but we can also skip the bootstrap if binary packages are available (which will happen on the build host). This will help avoid needless gcc rebuilds :) --- lib/catalyst_sdk_stage4.sh | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/catalyst_sdk_stage4.sh b/lib/catalyst_sdk_stage4.sh index 4d264498b4..44ad54587f 100644 --- a/lib/catalyst_sdk_stage4.sh +++ b/lib/catalyst_sdk_stage4.sh @@ -3,32 +3,28 @@ source /tmp/chroot-functions.sh # Build cross toolchains -# crossdev only does full bootstraps so if all of the packages are already -# installed (i.e. we are updating an existing stage4) then use emerge for cross_chost in x86_64-cros-linux-gnu; do echo "Installing toolchain for ${cross_chost}" cross_pkgs=( cross-${cross_chost}/{binutils,gcc,gdb,glibc,linux-headers} ) - cross_bootstrap=0 - for pkg in "${cross_pkgs[@]}"; do - if ! portageq match / "$pkg" | grep .; then - cross_bootstrap=1 - break - fi - done + crossdev --ov-output "/usr/local/portage/crossdev" \ + --env 'FEATURES=splitdebug' \ + --stable --ex-gdb --init-target \ + --target "${cross_chost}" || exit 1 - if [[ "${cross_bootstrap}" -eq 1 ]]; then + # If PKGCACHE is enabled check to see if binary packages are available + # or (due to --noreplace) the packages are already installed. If so then + # we don't need to perform a full bootstrap and just call emerge instead. + if [[ -n "${clst_PKGCACHE}" ]] && \ + emerge ${clst_myemergeopts} --usepkgonly --binpkg-respect-use=y \ + --noreplace "${cross_pkgs[@]}" &>/dev/null + then + run_merge -u "${cross_pkgs[@]}" + else crossdev --ov-output "/usr/local/portage/crossdev" \ --portage "${clst_myemergeopts}" \ --env 'FEATURES=splitdebug' \ --stable --ex-gdb --stage4 \ --target "${cross_chost}" || exit 1 - else - # Still run --init-target to ensure config is correct - crossdev --ov-output "/usr/local/portage/crossdev" \ - --env 'FEATURES=splitdebug' \ - --stable --ex-gdb --init-target \ - --target "${cross_chost}" || exit 1 - run_merge -u "${cross_pkgs[@]}" fi done