OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 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_FROM="${IMAGES_DIR}/`ls -t1 $IMAGES_DIR | head -1`" | |
19 DEFAULT_TO="${GCLIENT_ROOT}/archive" | 18 DEFAULT_TO="${GCLIENT_ROOT}/archive" |
20 | 19 |
21 # Flags | 20 # Flags |
| 21 DEFINE_string board "$DEFAULT_BOARD" \ |
| 22 "The board to build packages for." |
| 23 DEFAULT_FROM="${IMAGES_DIR}/$FLAGS_board/$(ls -t1 $IMAGES_DIR/$FLAGS_board | hea
d -1)" |
22 DEFINE_string from "$DEFAULT_FROM" \ | 24 DEFINE_string from "$DEFAULT_FROM" \ |
23 "Directory to archive" | 25 "Directory to archive" |
24 DEFINE_string to "$DEFAULT_TO" "Directory of build archive" | 26 DEFINE_string to "$DEFAULT_TO" "Directory of build archive" |
25 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)" | 27 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." | 28 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." | 29 DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release
builds." |
28 DEFINE_string build_number "" \ | 30 DEFINE_string build_number "" \ |
29 "The build-bot build number (when called by buildbot only)." "b" | 31 "The build-bot build number (when called by buildbot only)." "b" |
30 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" | 32 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" |
31 | 33 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if [ $FLAGS_keep_max -gt 0 ] | 99 if [ $FLAGS_keep_max -gt 0 ] |
98 then | 100 then |
99 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 101 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
100 cd "$FLAGS_to" | 102 cd "$FLAGS_to" |
101 # +2 because line numbers start at 1 and need to skip LATEST file | 103 # +2 because line numbers start at 1 and need to skip LATEST file |
102 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 104 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
103 cd - | 105 cd - |
104 fi | 106 fi |
105 | 107 |
106 echo "Done." | 108 echo "Done." |
OLD | NEW |