setup_board: make the gcc/glibc version stable by default, take 3

This is needed as part of transition to cros-workon.

Crossdev has a -S option to install the current stable, which is
the preferred future option, but would greatly complicate the logic.

BUG=chromium-os:25338
TEST=setup_board --board=any --force, see it build the right versions
TEST=trybot chromiumos-sdk

Change-Id: I07c1ade5731e9391fb22a572f7fe8517011e6239
Reviewed-on: https://gerrit.chromium.org/gerrit/15176
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
This commit is contained in:
Zdenek Behan 2012-01-26 16:43:54 +01:00 committed by Gerrit
parent f7c9e7785b
commit cdf3bad8a3

View File

@ -48,9 +48,9 @@ DEFINE_boolean force $FLAGS_FALSE \
"Force re-creating board root."
DEFINE_string binutils_version "2.21-r3" \
"Version of binutils to use."
DEFINE_string gcc_version "4.6.0-r13" \
DEFINE_string gcc_version "[stable]" \
"Version of gcc to use."
DEFINE_string libc_version "2.11.1-r3" \
DEFINE_string libc_version "[stable]" \
"Version of libc to use."
DEFINE_string kernel_version "3.1" \
"Version of kernel headers to use."
@ -134,6 +134,11 @@ toolchain_needs_update() {
# If toolchain symlinks weren't created yet, we definitely need to update.
if [ ! -d /usr/local/portage/crossdev/cross-$toolchain ]; then
# NOTE: In this branch, the versions have not been resolved, and will
# be passed directly to crossdev. That works because crossdev understands
# '[stable]'.
# We cannot resolve the versions because the cross-$toolchain category is
# not yet set up.
return 0
fi
@ -142,9 +147,23 @@ toolchain_needs_update() {
return 1
fi
# Unmask any ebuilds previously masked by crossdev. crossdev will re-setup
# its masks appropriately the next time we run it.
sudo rm -f /etc/portage/package.mask/cross-$toolchain
# Unmask any ebuilds previously [un]masked by crossdev. crossdev will
# re-setup its masks appropriately the next time we run it.
sudo rm -f /etc/portage/package.{mask,keywords}/cross-$toolchain
pkg_to_flag() {
[ "${1}" = "glibc" ] && echo "libc" || echo "$1"
}
local pkg
for pkg in gcc glibc binutils; do
local flagname=FLAGS_$(pkg_to_flag ${pkg})_version
if [ "${!flagname}" = "[stable]" ]; then
eval ${flagname}=$( \
portageq best_visible / "cross-$toolchain/${pkg}"| \
sed -e "s,cross-$toolchain/${pkg}-,,")
fi
done
local flags="--pretend --quiet --update"
local pkgs
@ -206,9 +225,12 @@ build_toolchain() {
if [ $FLAGS_latest_toolchain -ne $FLAGS_TRUE ]; then
CROSS_ARGS+=" --binutils $FLAGS_binutils_version"
CROSS_ARGS+=" --gcc $FLAGS_gcc_version"
if [[ "$toolchain" != "arm-none-eabi" ]]; then
# arm-none-eabi needs no version specification
CROSS_ARGS+=" --kernel $FLAGS_kernel_version"
CROSS_ARGS+=" --libc $FLAGS_libc_version"
fi
fi
CROSS_ARGS+=" --ex-gdb"