Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: enter_chroot.sh

Issue 6480005: Update chroot for chromite if needed. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Moved chromite fixes directly into enter_chroot. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: enter_chroot.sh
diff --git a/enter_chroot.sh b/enter_chroot.sh
index 82bd39b1653d5da470ae551754d131816ffe055b..8e3d5898ece2f8ff028146784b5f1ad7b116d774 100755
--- a/enter_chroot.sh
+++ b/enter_chroot.sh
@@ -302,6 +302,37 @@ function teardown_env {
) 200>>"$LOCKFILE" || die "teardown_env failed"
}
+# This function does extra "fixups" of the chroot. It's a lot like
+# chroot_hacks_from_outside() in common.sh, except that it is only called
+# from enter_chroot.sh (chroot_hacks_from_outside is also called from
+# make_chroot.sh). This function was created because common.sh is on lockdown
+# and can't be changed.
+#
+# NOTE: the need for this type of "fixup" should be going away. If everything
+# in the chroot is versioned and nothing is generated, there is no need to
+# handle partly fixing up generated files.
+#
+# Please put date information so it's easy to keep track of when
+# old hacks can be retired and so that people can detect when a
+# hack triggered when it shouldn't have.
+function chroot_hacks_too() {
+ local chroot_home="${FLAGS_chroot}/home/${USER}"
+
+ # Add chromite stuff if not already done.
+ if ! grep -q "^PATH=.*/trunk/chromite/bin" "${chroot_home}/.bashrc"; then
+ info "Upgrading old chroot (pre 2011-02-09) - adding chromite to path"
+ echo "PATH=\$PATH:/home/${USER}/trunk/chromite/bin" >> \
+ "${chroot_home}/.bashrc"
+ fi
+ if ! [ -L "${chroot_home}/.local/lib/python2.6/site-packages/chromite" ]; then
+ info "Upgrading old chroot (pre 2011-02-09) - add chromite to site-packages"
+ mkdir -p "${chroot_home}/.local/lib/python2.6/site-packages"
+ ln -s ../../../../trunk/chromite \
+ "${chroot_home}/.local/lib/python2.6/site-packages/"
+ fi
+}
+
+
if [ $FLAGS_mount -eq $FLAGS_TRUE ]; then
setup_env
info "Make sure you run"
@@ -318,6 +349,7 @@ fi
# Apply any hacks needed to update the chroot.
chroot_hacks_from_outside "${FLAGS_chroot}"
+chroot_hacks_too
# Make sure we unmount before exiting
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698