| OLD | NEW |
| 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. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 then | 60 then |
| 61 # Keep the directory name of the current image set (*.bin). | 61 # Keep the directory name of the current image set (*.bin). |
| 62 IMG_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)" | 62 IMG_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)" |
| 63 FLAGS_from="${IMAGES_DIR}/${FLAGS_board}/${IMG_DIR}" | 63 FLAGS_from="${IMAGES_DIR}/${FLAGS_board}/${IMG_DIR}" |
| 64 DEFAULT_USED=1 | 64 DEFAULT_USED=1 |
| 65 fi | 65 fi |
| 66 | 66 |
| 67 # Die on any errors. | 67 # Die on any errors. |
| 68 set -e | 68 set -e |
| 69 | 69 |
| 70 if [ -z $DEFAULT_USED ] | 70 if [ -z "$DEFAULT_USED" ] |
| 71 then | 71 then |
| 72 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] || \ | 72 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] || \ |
| 73 [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ] || \ | 73 [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ] || \ |
| 74 [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] | 74 [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] |
| 75 then | 75 then |
| 76 echo "test_mod requires that the default from path be used." | 76 echo "test_mod requires that the default from path be used." |
| 77 echo "If non default behavior is desired, run mod_image_for_test manually" | 77 echo "If non default behavior is desired, run mod_image_for_test manually" |
| 78 echo "re-run archive build without test_mod" | 78 echo "re-run archive build without test_mod" |
| 79 exit 1 | 79 exit 1 |
| 80 fi | 80 fi |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 function gsutil_archive() { | 238 function gsutil_archive() { |
| 239 IN_PATH="$1" | 239 IN_PATH="$1" |
| 240 OUT_PATH="$2" | 240 OUT_PATH="$2" |
| 241 if [ -n "$FLAGS_gsutil_archive" ] | 241 if [ -n "$FLAGS_gsutil_archive" ] |
| 242 then | 242 then |
| 243 FULL_OUT_PATH="${FLAGS_gsutil_archive}/${OUT_PATH}" | 243 FULL_OUT_PATH="${FLAGS_gsutil_archive}/${OUT_PATH}" |
| 244 echo "Using gsutil to archive to ${OUT_PATH}..." | 244 echo "Using gsutil to archive to ${OUT_PATH}..." |
| 245 ${FLAGS_gsutil} cp ${IN_PATH} ${FULL_OUT_PATH} | 245 ${FLAGS_gsutil} cp ${IN_PATH} ${FULL_OUT_PATH} |
| 246 ${FLAGS_gsutil} setacl ${FLAGS_acl} ${FULL_OUT_PATH} | 246 ${FLAGS_gsutil} setacl ${FLAGS_acl} ${FULL_OUT_PATH} |
| 247 if [ $FLAGS_gsd_gen_index != "" ] | 247 if [ -n "$FLAGS_gsd_gen_index" ] |
| 248 then | 248 then |
| 249 echo "Updating indexes..." | 249 echo "Updating indexes..." |
| 250 ${FLAGS_gsd_gen_index} \ | 250 ${FLAGS_gsd_gen_index} \ |
| 251 --gsutil=${FLAGS_gsutil} \ | 251 --gsutil=${FLAGS_gsutil} \ |
| 252 -a ${FLAGS_acl} \ | 252 -a ${FLAGS_acl} \ |
| 253 -p ${FULL_OUT_PATH} ${FLAGS_gsutil_archive} | 253 -p ${FULL_OUT_PATH} ${FLAGS_gsutil_archive} |
| 254 fi | 254 fi |
| 255 fi | 255 fi |
| 256 } | 256 } |
| 257 | 257 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 if [ $FLAGS_keep_max -gt 0 ] | 293 if [ $FLAGS_keep_max -gt 0 ] |
| 294 then | 294 then |
| 295 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 295 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
| 296 cd "$FLAGS_to" | 296 cd "$FLAGS_to" |
| 297 # +2 because line numbers start at 1 and need to skip LATEST file | 297 # +2 because line numbers start at 1 and need to skip LATEST file |
| 298 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 298 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
| 299 cd - | 299 cd - |
| 300 fi | 300 fi |
| 301 | 301 |
| 302 echo "Done." | 302 echo "Done." |
| OLD | NEW |