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

Side by Side Diff: src/scripts/archive_build.sh

Issue 460118: Split Continuous/User build and provide useful version information for continuous builder (Closed)
Patch Set: versioning 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/scripts/build_image.sh » ('j') | 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 archive build results. Used by the buildbots. 7 # Script to archive build results. Used by the buildbots.
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.
11 . "$(dirname "$0")/common.sh" 11 . "$(dirname "$0")/common.sh"
12 12
13 # Script must be run outside the chroot 13 # Script must be run outside the chroot
14 assert_outside_chroot 14 assert_outside_chroot
15 15
16 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images" 16 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images"
17 # Default to the most recent image 17 # Default to the most recent image
18 DEFAULT_FROM="${IMAGES_DIR}/`ls -t1 $IMAGES_DIR | head -1`" 18 DEFAULT_FROM="${IMAGES_DIR}/`ls -t1 $IMAGES_DIR | head -1`"
19 DEFAULT_TO="${GCLIENT_ROOT}/archive" 19 DEFAULT_TO="${GCLIENT_ROOT}/archive"
20 20
21 # Flags 21 # Flags
22 DEFINE_string from "$DEFAULT_FROM" \ 22 DEFINE_string from "$DEFAULT_FROM" \
23 "Directory to archive" 23 "Directory to archive"
24 DEFINE_string to "$DEFAULT_TO" "Directory of build archive" 24 DEFINE_string to "$DEFAULT_TO" "Directory of build archive"
25 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)" 25 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
26 DEFINE_string zipname "image.zip" "Name of zip file to create." 26 DEFINE_string zipname "image.zip" "Name of zip file to create."
27 DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds." 27 DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds."
28 DEFINE_string build_number "" \
29 "The build-bot build number (when called by buildbot only)." "b"
28 30
29 # Parse command line 31 # Parse command line
30 FLAGS "$@" || exit 1 32 FLAGS "$@" || exit 1
31 eval set -- "${FLAGS_ARGV}" 33 eval set -- "${FLAGS_ARGV}"
32 34
33 # Die on any errors. 35 # Die on any errors.
34 set -e 36 set -e
35 37
36 if [ $FLAGS_official_build -eq $FLAGS_TRUE ] 38 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
37 then 39 then
38 CHROMEOS_OFFICIAL=1 40 CHROMEOS_OFFICIAL=1
39 fi 41 fi
40 42
41 # Get version information 43 # Get version information
42 . "${SCRIPTS_DIR}/chromeos_version.sh" 44 . "${SCRIPTS_DIR}/chromeos_version.sh"
43 45
44 # Get subversion or git revision 46 # Get git hash
45 REVISION=$(svn info 2>&-| grep "Revision: " | awk '{print $2}') 47 # Use git:8 chars of sha1
46 if [ -z "$REVISION" ] 48 REVISION=$(git rev-parse HEAD)
47 then 49 REVISION=${REVISION:0:8}
48 # Use git:8 chars of sha1
49 REVISION=$(git rev-parse HEAD)
50 REVISION=${REVISION:8}
51 fi
52 50
53 # Use the version number plus revision as the last change. (Need both, since 51 # Use the version number plus revision as the last change. (Need both, since
54 # trunk builds multiple times with the same version string.) 52 # trunk builds multiple times with the same version string.)
55 LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}" 53 LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}-b${FLAGS_build_number}"
56 54
57 # The Chromium buildbot scripts only create a clickable link to the archive 55 # The Chromium buildbot scripts only create a clickable link to the archive
58 # if an output line of the form "last change: XXX" exists 56 # if an output line of the form "last change: XXX" exists
59 echo "last change: $LAST_CHANGE" 57 echo "last change: $LAST_CHANGE"
60 echo "archive from: $FLAGS_from" 58 echo "archive from: $FLAGS_from"
61 59
62 # Create the output directory 60 # Create the output directory
63 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" 61 OUTDIR="${FLAGS_to}/${LAST_CHANGE}"
64 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" 62 ZIPFILE="${OUTDIR}/${FLAGS_zipname}"
65 echo "archive to dir: $OUTDIR" 63 echo "archive to dir: $OUTDIR"
(...skipping 19 matching lines...) Expand all
85 if [ $FLAGS_keep_max -gt 0 ] 83 if [ $FLAGS_keep_max -gt 0 ]
86 then 84 then
87 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." 85 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..."
88 cd "$FLAGS_to" 86 cd "$FLAGS_to"
89 # +2 because line numbers start at 1 and need to skip LATEST file 87 # +2 because line numbers start at 1 and need to skip LATEST file
90 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` 88 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))`
91 cd - 89 cd -
92 fi 90 fi
93 91
94 echo "Done." 92 echo "Done."
OLDNEW
« no previous file with comments | « no previous file | src/scripts/build_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698