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

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

Issue 660189: Changes to enable buildbot to build autotests and package them (Closed)
Patch Set: Created 10 years, 9 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 | src/scripts/run_remote_tests.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) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 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_TO="${GCLIENT_ROOT}/archive" 18 DEFAULT_TO="${GCLIENT_ROOT}/archive"
19 DEFAULT_FROM="${IMAGES_DIR}/$DEFAULT_BOARD/$(ls -t1 \ 19 DEFAULT_FROM="${IMAGES_DIR}/$DEFAULT_BOARD/$(ls -t1 \
20 $IMAGES_DIR/$DEFAULT_BOARD 2>&-| head -1)" 20 $IMAGES_DIR/$DEFAULT_BOARD 2>&-| head -1)"
21 21
22 # Flags 22 # Flags
23 DEFINE_string board "$DEFAULT_BOARD" \ 23 DEFINE_string board "$DEFAULT_BOARD" \
24 "The board to build packages for." 24 "The board to build packages for."
25 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \
26 "The chroot of the build to archive."
25 DEFINE_string from "$DEFAULT_FROM" \ 27 DEFINE_string from "$DEFAULT_FROM" \
26 "Directory to archive" 28 "Directory to archive"
27 DEFINE_string to "$DEFAULT_TO" "Directory of build archive" 29 DEFINE_string to "$DEFAULT_TO" "Directory of build archive"
28 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)" 30 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
29 DEFINE_string zipname "image.zip" "Name of zip file to create." 31 DEFINE_string zipname "image.zip" "Name of zip file to create."
30 DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds." 32 DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds."
31 DEFINE_string build_number "" \ 33 DEFINE_string build_number "" \
32 "The build-bot build number (when called by buildbot only)." "b" 34 "The build-bot build number (when called by buildbot only)." "b"
33 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" 35 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes"
34 36
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 rm -rf "$OUTDIR" 89 rm -rf "$OUTDIR"
88 mkdir -p "$OUTDIR" 90 mkdir -p "$OUTDIR"
89 91
90 # Modify image for test if flag set. 92 # Modify image for test if flag set.
91 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] 93 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]
92 then 94 then
93 echo "Modifying image for test" 95 echo "Modifying image for test"
94 cp "${FLAGS_from}/rootfs.image" "${FLAGS_from}/rootfs_test.image" 96 cp "${FLAGS_from}/rootfs.image" "${FLAGS_from}/rootfs_test.image"
95 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board $FLAGS_board --yes --image \ 97 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board $FLAGS_board --yes --image \
96 "${FLAGS_from}/rootfs_test.image" 98 "${FLAGS_from}/rootfs_test.image"
99 cd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
100 echo "Archiving autotest build artifacts"
101 tar cjf "${FLAGS_from}/autotest.tar.bz2" autotest
97 fi 102 fi
98 103
99 # Zip the build 104 # Zip the build
100 echo "Compressing and archiving build..." 105 echo "Compressing and archiving build..."
101 cd "$FLAGS_from" 106 cd "$FLAGS_from"
102 zip -r "$ZIPFILE" * 107 zip -r "$ZIPFILE" *
103 cd - 108 cd -
104 109
105 # Update LATEST file 110 # Update LATEST file
106 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST" 111 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST"
107 112
108 # Make sure files are readable 113 # Make sure files are readable
109 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" 114 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST"
110 chmod 755 "$OUTDIR" 115 chmod 755 "$OUTDIR"
111 116
112 # Purge old builds if necessary 117 # Purge old builds if necessary
113 if [ $FLAGS_keep_max -gt 0 ] 118 if [ $FLAGS_keep_max -gt 0 ]
114 then 119 then
115 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." 120 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..."
116 cd "$FLAGS_to" 121 cd "$FLAGS_to"
117 # +2 because line numbers start at 1 and need to skip LATEST file 122 # +2 because line numbers start at 1 and need to skip LATEST file
118 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` 123 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))`
119 cd - 124 cd -
120 fi 125 fi
121 126
122 echo "Done." 127 echo "Done."
OLDNEW
« no previous file with comments | « no previous file | src/scripts/run_remote_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698