Add upgrade hooks to support removing chrome projects from manifest.

See the bug for details.

BUG=chromium-os:32963.
TEST=Locally, remote trybots.

Change-Id: I33f5c42b36f3e06139036c299c2fc2c2ff026411
Reviewed-on: https://gerrit.chromium.org/gerrit/28543
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
This commit is contained in:
Ryan Cui 2012-07-26 13:33:34 -07:00 committed by Gerrit
parent 21c6b03e89
commit 05ed4086da
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# 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.
# Move users of CHROME_ORIGIN=GERRIT_SOURCE to the new gerrit-source.xml
# manifest, as well as setting up the chromium/src repository properly for
# submodules. crosbug.com/32963.
# We only want to run this hook once. Since this also gets called from
# enter_chroot, look for the marker.
MARKER="/tmp/44_fix_gerrit_chrome"
if [ -e "${MARKER}" ]; then
exit 0
fi
chrome_workon="=chromeos-base/chromeos-chrome-9999"
cros_workon_dir="${HOME}/trunk/.config/cros_workon/*"
if grep -q "${chrome_workon}" ${cros_workon_dir} &> /dev/null; then
repo selfupdate && repo init -m gerrit-source.xml
fi
(
cd "${HOME}/trunk/chromium/src"
ignore_cmd='git config -f $toplevel/.git/config submodule.$name.ignore all'
git submodule foreach "${ignore_cmd}" &> /dev/null
)
touch "${MARKER}"
exit 0

View File

@ -608,6 +608,17 @@ else
cmd=( sudo -i -u "$USER" )
fi
# TODO(rcui): Remove this hook on 8/26/2012.
# crosbug.com/32963
if [ $FLAGS_early_make_chroot -eq $FLAGS_FALSE ]; then
chroot_script_root="\${HOME}/trunk/src/scripts"
hook_rel_path="chroot_version_hooks.d/44_fix_gerrit_chrome"
gerrit_chrome_hook="${chroot_script_root}/${hook_rel_path}"
entry_hook=(eval "source \"${gerrit_chrome_hook}\"")
sudo -- chroot "${FLAGS_chroot}" "${cmd[@]}" "${CHROOT_PASSTHRU[@]}" \
"${entry_hook[@]}"
fi
sudo -- chroot "${FLAGS_chroot}" "${cmd[@]}" "${CHROOT_PASSTHRU[@]}" "$@"
# Remove trap and explicitly unmount