setup_board: fix --regen_config bug.

https://gerrit.chromium.org/gerrit/#/c/38156 introduced a bug where
cross_get_version was moved to install_toolchain but was still
used in setup_board.

setup_board now saves whatever toolchain version is currently configured
and appends that information to the newly generated board config.

BUG=chromium-os:36865
TEST=remote trybot. manual - test case of existence/nonexistence of
board config file and existence/nonexistence of previous toolchain info.

Change-Id: I20e1794c12e7e60fdbbcd5a123ddc5c6bdf86b16
Reviewed-on: https://gerrit.chromium.org/gerrit/39132
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
This commit is contained in:
Ryan Cui 2012-12-03 15:48:28 -08:00 committed by Gerrit
parent 0c2b408347
commit 7a40158fd7

View File

@ -389,6 +389,11 @@ cmds+=(
)
sudo_multi "${cmds[@]}"
SAVED_VERSION=
if [[ ${FLAGS_regen_configs} -eq ${FLAGS_TRUE} ]]; then
SAVED_VERSION=$(grep -s ^LIBC_VERSION= ${BOARD_SETUP} || true)
fi
sudo_clobber "${BOARD_SETUP}" <<EOF
# Created by setup_board
CHOST="${FLAGS_toolchain}"
@ -397,7 +402,9 @@ BOARD_OVERLAY="${BOARD_OVERLAY_LIST}"
MAKEOPTS="-j${NUM_JOBS}"
PKG_CONFIG="pkg-config-${BOARD_VARIANT}"
BOARD_USE="${BOARD_VARIANT}"
${SAVED_VERSION}
EOF
if ! ${HOST_BOARD}; then
sudo ln -sf "${CHROMIUMOS_CONFIG}/make.conf.${ARCH}-target" \
"${BOARD_ETC}/make.conf"
@ -508,12 +515,6 @@ else
sys-kernel/linux-headers
unset KERNEL_EMERGE_FLAGS
else
# Since we clobbered this file earlier, make sure the libc version
# is set correctly otherwise future upgrades will wrongly trigger.
sudo_append "${BOARD_SETUP}" <<EOF
LIBC_VERSION="$(cross_get_version glibc)"
EOF
fi
fi