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

Side by Side Diff: enter_chroot.sh

Issue 2762011: Use git rev-parse --short=8 to get rev (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: Created 10 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to enter the chroot environment 7 # Script to enter the chroot environment
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 # the wrong version, which would mess up the .git directories. 240 # the wrong version, which would mess up the .git directories.
241 # 241 #
242 # Note that this fixes $CHROMEOS_REVISION at the time the chroot is 242 # Note that this fixes $CHROMEOS_REVISION at the time the chroot is
243 # entered. That's ok for the main use case of automated builds, 243 # entered. That's ok for the main use case of automated builds,
244 # which pass each command line into a separate call to enter_chroot 244 # which pass each command line into a separate call to enter_chroot
245 # so always have up-to-date info. For developer builds, there may not 245 # so always have up-to-date info. For developer builds, there may not
246 # be a single revision, since the developer may have 246 # be a single revision, since the developer may have
247 # hand-sync'd some subdirs and edited files in others. 247 # hand-sync'd some subdirs and edited files in others.
248 # In that case, check against origin/HEAD and mark** revision. 248 # In that case, check against origin/HEAD and mark** revision.
249 # Use git:8 chars of sha1 249 # Use git:8 chars of sha1
250 REVISION=$(git rev-parse HEAD) 250 REVISION=$(git rev-parse --short=8 HEAD)
251 ORIGIN_REVISION=$(git rev-parse origin/HEAD)
252 # Do not check for clean revision on official builds. They are coming directly
253 # from a branch rev and cannot compare to origin/HEAD.
254 if [ $FLAGS_official_build != $FLAGS_TRUE ] && \
255 [ "$REVISION" != "$ORIGIN_REVISION" ]
256 then
257 # Mark dirty tree with "**"
258 REVISION="${REVISION:0:8}**"
259 else
260 REVISION="${REVISION:0:8}"
261 fi
262 CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL" 251 CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL"
263 252
264 # Run command or interactive shell. Also include the non-chrooted path to 253 # Run command or interactive shell. Also include the non-chrooted path to
265 # the source trunk for scripts that may need to print it (e.g. 254 # the source trunk for scripts that may need to print it (e.g.
266 # build_image.sh). 255 # build_image.sh).
267 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ 256 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
268 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" 257 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@"
269 258
270 # Remove trap and explicitly unmount 259 # Remove trap and explicitly unmount
271 trap - EXIT 260 trap - EXIT
272 teardown_env 261 teardown_env
OLDNEW
« 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