Add upgrade script to move incremental chrome build content.

Via distfiles bind mounting, chrome build output was being cached
across chroot replacements.  This potentially is desirable, but
wasn't explicitly planned for and violates an assumption of the
canaries.

As such move the content to it's new location.

BUG=None
TEST=emerge-<board> chromeos-chrome
CQ-DEPEND=Ibfc5d42e74861ff498dd2cb6cc2d7be6ec0ded60

Change-Id: I18e384f0fc1cedb3c70ab85178103765322370eb
Reviewed-on: https://gerrit.chromium.org/gerrit/15383
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
This commit is contained in:
Brian Harring 2012-02-06 23:34:25 -08:00
parent 7ee892d95a
commit 36b102b5d1
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,35 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# As of update 24, we preserve distfiles across chroot rebuilds via storing
# the content outside of the chroot, and binding it in.
#
# chromeos-chrome stores its build output in distdir however, which we
# don't currently want preserved across chroot builds, thus this script
# pulls the content out to the new location within the chroot.
upgrade_path() {
local src="/var/cache/distfiles/target/$1"
local dest="/var/cache/chromeos-chrome/$1"
if [ -d "$src" ]; then
if [ -d "$dest" ]; then
# User has already built it- thus wipe the src and use what's in
# the chrome specific cache.
sudo rm -rf "$src"
else
sudo mv "$src" "$dest"
fi
fi
}
sudo mkdir -p 0775 /var/cache/chromeos-chrome/
sudo chown "$USER:portage" /var/cache/chromeos-chrome/
upgrade_path chrome-src
upgrade_path chrome-src-internal
upgrade_path chrome-src-custom
upgrade_path chrome-src-custom-internal
exit 0

View File

@ -198,7 +198,13 @@ EOF
sudo chmod 0644 "${FLAGS_chroot}"/etc/make.conf.user
# Create directories referred to by our conf files.
sudo mkdir -p -m 775 "${FLAGS_chroot}/var/lib/portage/pkgs"
sudo mkdir -p -m 775 "${FLAGS_chroot}/var/lib/portage/pkgs" \
"${FLAGS_chroot}/var/cache/distfiles" \
"${FLAGS_chroot}/var/cache/chromeos-chrome"
# Run this from w/in the chroot so we use whatever uid/gid
# these are defined as w/in the chroot.
sudo_chroot chown "${USER}:portage" /var/cache/chromeos-chrome
# These are created for compatibility while transitioning
# make.conf and friends over to the new location.