From 551123f7cafa8f962d2ed48f255e7435e038c2a7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 18 Feb 2012 22:07:43 -0500 Subject: [PATCH] setup_board: save/restore package.{mask,keywords} files If we try to setup multiple boards that use the same toolchain, we end up deleting the package.{mask,keywords} files for the existing toolchain so that we can detect if there are upgrades available. If there aren't, the files don't get recreated (since we were relying on crossdev for it), and the installed toolchain packages may no longer be directly reinstalled if they aren't incidentally marked stable. Normally this isn't an issue since people build for target boards only rather than installing toolchains, but this breaks the sdk bot since it sets up a bunch of bots and then tries to emerge all the toolchain pkgs directly. With packages we've pinned that are unstable, portage fails: The following keyword changes are necessary to proceed: #required by =cross-arm-none-eabi/newlib-1.18.0 (argument) >=cross-arm-none-eabi/newlib-1.18.0 ** So backup & restore the files in the update path rather than just blowing them away. If we end up installing things anyways, crossdev will do the right thing. BUG=None TEST=`cbuildbot chromiumos-sdk` passes Change-Id: I6efc71179d6f897af91deaefe1ce6c62df10ebf6 Reviewed-on: https://gerrit.chromium.org/gerrit/16220 Commit-Ready: Mike Frysinger Reviewed-by: Mike Frysinger Tested-by: Mike Frysinger --- setup_board | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup_board b/setup_board index fdd4272335..044b0d72d6 100755 --- a/setup_board +++ b/setup_board @@ -150,7 +150,10 @@ toolchain_needs_update() { # 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 + local d + for d in package.{mask,keywords} ; do + sudo mv -f /etc/portage/${d}/{,.bak.}cross-${toolchain} + done pkg_to_flag() { [ "${1}" = "glibc" ] && echo "libc" || echo "$1" @@ -199,6 +202,14 @@ toolchain_needs_update() { pkgs+=" cross-$toolchain/gdb" fi ACCEPT_KEYWORDS="~* *" emerge $flags $pkgs | grep cross-$toolchain/ + local ret=$? + + # Restore the masks in case we don't end up running crossdev. + for d in package.{mask,keywords} ; do + sudo mv -f /etc/portage/${d}/{.bak.,}cross-${toolchain} + done + + return ${ret} } uninstall_toolchain() {