| OLD | NEW |
| 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. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 # Get version information | 43 # Get version information |
| 44 . "${SCRIPTS_DIR}/chromeos_version.sh" | 44 . "${SCRIPTS_DIR}/chromeos_version.sh" |
| 45 | 45 |
| 46 # Get git hash | 46 # Get git hash |
| 47 # Use git:8 chars of sha1 | 47 # Use git:8 chars of sha1 |
| 48 REVISION=$(git rev-parse HEAD) | 48 REVISION=$(git rev-parse HEAD) |
| 49 REVISION=${REVISION:0:8} | 49 REVISION=${REVISION:0:8} |
| 50 | 50 |
| 51 # 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 |
| 52 # trunk builds multiple times with the same version string.) | 52 # trunk builds multiple times with the same version string.) |
| 53 LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}-b${FLAGS_build_number}" | 53 LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}" |
| 54 if [ -n "$FLAGS_build_number" ] |
| 55 then |
| 56 LAST_CHANGE="$LAST_CHANGE-b${FLAGS_build_number}" |
| 57 fi |
| 54 | 58 |
| 55 # The Chromium buildbot scripts only create a clickable link to the archive | 59 # The Chromium buildbot scripts only create a clickable link to the archive |
| 56 # if an output line of the form "last change: XXX" exists | 60 # if an output line of the form "last change: XXX" exists |
| 57 echo "last change: $LAST_CHANGE" | 61 echo "last change: $LAST_CHANGE" |
| 58 echo "archive from: $FLAGS_from" | 62 echo "archive from: $FLAGS_from" |
| 59 | 63 |
| 60 # Create the output directory | 64 # Create the output directory |
| 61 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" | 65 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" |
| 62 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" | 66 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" |
| 63 echo "archive to dir: $OUTDIR" | 67 echo "archive to dir: $OUTDIR" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 if [ $FLAGS_keep_max -gt 0 ] | 87 if [ $FLAGS_keep_max -gt 0 ] |
| 84 then | 88 then |
| 85 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 89 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
| 86 cd "$FLAGS_to" | 90 cd "$FLAGS_to" |
| 87 # +2 because line numbers start at 1 and need to skip LATEST file | 91 # +2 because line numbers start at 1 and need to skip LATEST file |
| 88 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 92 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
| 89 cd - | 93 cd - |
| 90 fi | 94 fi |
| 91 | 95 |
| 92 echo "Done." | 96 echo "Done." |
| OLD | NEW |