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

Unified Diff: src/scripts/enter_chroot.sh

Issue 486002: Add --official_build option, and skip checking HEAD against origin/HEAD for official builds. (Closed)
Patch Set: Created 11 years 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: src/scripts/enter_chroot.sh
diff --git a/src/scripts/enter_chroot.sh b/src/scripts/enter_chroot.sh
index 940e47a2b7e16574239ee4acd5677d9f18ab224c..31734a9aed6d9d6a42ab246dd9b0a60c23a7c5f6 100755
--- a/src/scripts/enter_chroot.sh
+++ b/src/scripts/enter_chroot.sh
@@ -23,6 +23,7 @@ DEFINE_string trunk "$GCLIENT_ROOT" \
DEFINE_string build_number "" \
"The build-bot build number (when called by buildbot only)." "b"
+DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds."
DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts."
DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts."
@@ -48,6 +49,11 @@ Otherwise, provides an interactive shell.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
+if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
+then
+ CHROMEOS_OFFICIAL=1
+fi
+
# Only now can we die on error. shflags functions leak non-zero error codes,
# so will die prematurely if 'set -e' is specified before now.
# TODO: replace shflags with something less error-prone, or contribute a fix.
@@ -111,25 +117,29 @@ setup_env
# Note that this fixes $CHROMEOS_REVISION at the time the chroot is
# entered. That's ok for the main use case of automated builds,
# which pass each command line into a separate call to enter_chroot
-# so always have up-to-date info. For developer builds, there isn't
-# really a single revision anyway, since the developer may have
+# so always have up-to-date info. For developer builds, there may not
+# be a single revision, since the developer may have
# hand-sync'd some subdirs and edited files in others.
+# In that case, check against origin/HEAD and mark** revision.
# Use git:8 chars of sha1
REVISION=$(git rev-parse HEAD)
ORIGIN_REVISION=$(git rev-parse origin/HEAD)
-if [ "$REVISION" != "$ORIGIN_REVISION" ]
+# Do not check for clean revision on official builds. They are coming directly
+# from a branch rev and cannot compare to origin/HEAD.
+if [ $FLAGS_official_build != $FLAGS_TRUE ] && \
+ [ "$REVISION" != "$ORIGIN_REVISION" ]
then
# Mark dirty tree with "**"
- REVISION="${REVISION:0:8}**"
+ REVISION="${REVISION:0:8}**"
else
REVISION="${REVISION:0:8}"
fi
-REVISION="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number"
+CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL"
# Run command or interactive shell. Also include the non-chrooted path to
# the source trunk for scripts that may need to print it (e.g.
# build_image.sh).
-sudo chroot "$FLAGS_chroot" sudo -i -u $USER $REVISION \
+sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" "$@"
# Remove trap and explicitly unmount
« 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