From 36b102b5d13f82b71308b4c3636f8c6c4b57ef2a Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Mon, 6 Feb 2012 23:34:25 -0800 Subject: [PATCH] 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- chromeos-chrome CQ-DEPEND=Ibfc5d42e74861ff498dd2cb6cc2d7be6ec0ded60 Change-Id: I18e384f0fc1cedb3c70ab85178103765322370eb Reviewed-on: https://gerrit.chromium.org/gerrit/15383 Reviewed-by: David James Tested-by: Brian Harring --- ...5_suppress_incremental_build_across_chroot | 35 +++++++++++++++++++ sdk_lib/make_chroot.sh | 8 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 chroot_version_hooks.d/25_suppress_incremental_build_across_chroot diff --git a/chroot_version_hooks.d/25_suppress_incremental_build_across_chroot b/chroot_version_hooks.d/25_suppress_incremental_build_across_chroot new file mode 100644 index 0000000000..b2e1484afc --- /dev/null +++ b/chroot_version_hooks.d/25_suppress_incremental_build_across_chroot @@ -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 diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh index 2ac5767657..5479a0fc33 100755 --- a/sdk_lib/make_chroot.sh +++ b/sdk_lib/make_chroot.sh @@ -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.