blob: 62c9aaa81a6b2182f9a813dbc7be6184014e024e [file] [log] [blame]
# 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/$2"
local dest="/var/cache/chromeos-chrome/$2"
info "[$1/4] Checking $src vs $dest"
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.
info "[$1/4] Cleaning $src; this could take a while"
sudo rm -rf --one-file-system "$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 1 chrome-src
upgrade_path 2 chrome-src-internal
upgrade_path 3 chrome-src-custom
upgrade_path 4 chrome-src-custom-internal
exit 0