| 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 19 matching lines...) Expand all Loading... |
| 30 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)" |
| 31 DEFINE_string zipname "image.zip" "Name of zip file to create." | 31 DEFINE_string zipname "image.zip" "Name of zip file to create." |
| 32 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." |
| 33 DEFINE_string build_number "" \ | 33 DEFINE_string build_number "" \ |
| 34 "The build-bot build number (when called by buildbot only)." "b" | 34 "The build-bot build number (when called by buildbot only)." "b" |
| 35 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" | 35 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" |
| 36 DEFINE_boolean factory_test_mod $FLAGS_FALSE \ | 36 DEFINE_boolean factory_test_mod $FLAGS_FALSE \ |
| 37 "Modify image for factory testing purposes" | 37 "Modify image for factory testing purposes" |
| 38 DEFINE_boolean factory_install_mod $FLAGS_FALSE \ | 38 DEFINE_boolean factory_install_mod $FLAGS_FALSE \ |
| 39 "Modify image for factory install purposes" | 39 "Modify image for factory install purposes" |
| 40 DEFINE_string gsutil "gsutil" \ |
| 41 "Location of gsutil" |
| 42 DEFINE_string gsutil_archive "" \ |
| 43 "Optional datastore archive location" |
| 40 | 44 |
| 41 # Parse command line | 45 # Parse command line |
| 42 FLAGS "$@" || exit 1 | 46 FLAGS "$@" || exit 1 |
| 43 eval set -- "${FLAGS_ARGV}" | 47 eval set -- "${FLAGS_ARGV}" |
| 44 | 48 |
| 45 # Set if default from path is used | 49 # Set if default from path is used |
| 46 DEFAULT_USED= | 50 DEFAULT_USED= |
| 47 | 51 |
| 48 # Reset "default" FLAGS_from based on passed-in board if not set on cmd-line | 52 # Reset "default" FLAGS_from based on passed-in board if not set on cmd-line |
| 49 if [ "$FLAGS_from" = "$DEFAULT_FROM" ] | 53 if [ "$FLAGS_from" = "$DEFAULT_FROM" ] |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 # Make sure files are readable | 179 # Make sure files are readable |
| 176 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" | 180 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" |
| 177 chmod 755 "$OUTDIR" | 181 chmod 755 "$OUTDIR" |
| 178 | 182 |
| 179 if [ $FLAGS_test_mod -eq $FLAGS_TRUE -a $FLAGS_official_build -eq $FLAGS_TRUE ] | 183 if [ $FLAGS_test_mod -eq $FLAGS_TRUE -a $FLAGS_official_build -eq $FLAGS_TRUE ] |
| 180 then | 184 then |
| 181 echo "Creating hwqual archive" | 185 echo "Creating hwqual archive" |
| 182 HWQUAL_NAME="chromeos-hwqual-${FLAGS_board}-${CHROMEOS_VERSION_STRING}" | 186 HWQUAL_NAME="chromeos-hwqual-${FLAGS_board}-${CHROMEOS_VERSION_STRING}" |
| 183 "${SCRIPTS_DIR}/archive_hwqual" --from "${OUTDIR}" \ | 187 "${SCRIPTS_DIR}/archive_hwqual" --from "${OUTDIR}" \ |
| 184 --output_tag "${HWQUAL_NAME}" | 188 --output_tag "${HWQUAL_NAME}" |
| 189 # Optionally archive with gsutil hwqual. |
| 190 if [ $FLAGS_gsutil_archive != "" ] |
| 191 then |
| 192 GS_OUTDIR="${FLAGS_gsutil_archive}/${LAST_CHANGE}" |
| 193 GS_HWQUAL_IN="${OUTDIR}/${HWQUAL_NAME}.tar.bz2" |
| 194 GS_HWQUAL_OUT="${GS_OUTDIR}/${HWQUAL_NAME}.tar.bz2" |
| 195 echo "Using gsutil to archive to ${GS_HWQUAL_OUT}..." |
| 196 ${FLAGS_gsutil} cp ${GS_HWQUAL_IN} ${GS_HWQUAL_OUT} |
| 197 fi |
| 198 fi |
| 199 |
| 200 # Optionally archive to Google Storage for Developers. |
| 201 if [ $FLAGS_gsutil_archive != "" ] |
| 202 then |
| 203 GS_OUTDIR="${FLAGS_gsutil_archive}/${LAST_CHANGE}" |
| 204 GS_ZIPFILE="${GS_OUTDIR}/${FLAGS_zipname}" |
| 205 GS_FACTORY_ZIPFILE="${GS_OUTDIR}/factory_${FLAGS_zipname}" |
| 206 GS_LATEST="${FLAGS_gsutil_archive}/LATEST" |
| 207 echo "Using gsutil to archive to ${GS_ZIPFILE}..." |
| 208 ${FLAGS_gsutil} cp ${ZIPFILE} ${GS_ZIPFILE} |
| 209 |
| 210 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \ |
| 211 [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ] |
| 212 then |
| 213 echo "Using gsutil to archive to ${GS_FACTORY_ZIPFILE}..." |
| 214 ${FLAGS_gsutil} cp ${FACTORY_ZIPFILE} ${GS_FACTORY_ZIPFILE} |
| 215 fi |
| 216 |
| 217 echo "Updating latest ${GS_LATEST}..." |
| 218 ${FLAGS_gsutil} cp ${FLAGS_to}/LATEST ${GS_LATEST} |
| 185 fi | 219 fi |
| 186 | 220 |
| 187 # Purge old builds if necessary | 221 # Purge old builds if necessary |
| 188 if [ $FLAGS_keep_max -gt 0 ] | 222 if [ $FLAGS_keep_max -gt 0 ] |
| 189 then | 223 then |
| 190 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 224 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
| 191 cd "$FLAGS_to" | 225 cd "$FLAGS_to" |
| 192 # +2 because line numbers start at 1 and need to skip LATEST file | 226 # +2 because line numbers start at 1 and need to skip LATEST file |
| 193 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 227 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
| 194 cd - | 228 cd - |
| 195 fi | 229 fi |
| 196 | 230 |
| 197 echo "Done." | 231 echo "Done." |
| OLD | NEW |