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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" | 132 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" |
133 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" | 133 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" |
134 FACTORY_ZIPFILE="${OUTDIR}/factory_${FLAGS_zipname}" | 134 FACTORY_ZIPFILE="${OUTDIR}/factory_${FLAGS_zipname}" |
135 echo "archive to dir: $OUTDIR" | 135 echo "archive to dir: $OUTDIR" |
136 echo "archive to file: $ZIPFILE" | 136 echo "archive to file: $ZIPFILE" |
137 | 137 |
138 rm -rf "$OUTDIR" | 138 rm -rf "$OUTDIR" |
139 mkdir -p "$OUTDIR" | 139 mkdir -p "$OUTDIR" |
140 | 140 |
141 | 141 |
142 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" | 142 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" |
sjg
2011/02/15 15:19:42
You can use ${CHROMEOS_IMAGE_NAME} here if you lik
sosa
2011/02/15 22:08:12
Done.
| |
143 BACKUP_IMAGE="${FLAGS_from}/chromiumos_image_bkup.bin" | |
144 | 143 |
145 # Apply mod_image_for_test to the developer image, and store the | 144 # Apply mod_image_for_test to the developer image, and store the |
146 # result in a new location. Usage: | 145 # result in a new location. Usage: |
147 # do_chroot_mod "$OUTPUT_IMAGE" "--flags_to_mod_image_for_test" | 146 # do_chroot_mod "$OUTPUT_IMAGE" "--flags_to_mod_image_for_test" |
148 function do_chroot_mod() { | 147 function do_chroot_mod() { |
149 MOD_ARGS=$2 | 148 MOD_ARGS=$2 |
150 OUTPUT_IMAGE=$1 | 149 OUTPUT_IMAGE=$1 |
sjg
2011/02/15 15:19:42
Great, a use for --noinplace.
I think this functi
sosa
2011/02/15 22:08:12
See note. Still want in place but I need the mv's
| |
151 cp -f "${SRC_IMAGE}" "${BACKUP_IMAGE}" | |
152 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ | 150 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ |
153 --yes ${MOD_ARGS} | 151 --yes --noinplace ${MOD_ARGS} |
154 mv "${SRC_IMAGE}" "${OUTPUT_IMAGE}" | |
155 mv "${BACKUP_IMAGE}" "${SRC_IMAGE}" | |
156 } | 152 } |
157 | 153 |
158 # Modify image for test if flag set. | 154 # Modify image for test if flag set. |
159 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]; then | 155 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]; then |
160 echo "Modifying image for test" | 156 echo "Modifying image for test" |
161 do_chroot_mod "${FLAGS_from}/chromiumos_test_image.bin" "" | 157 do_chroot_mod "${FLAGS_from}/chromiumos_test_image.bin" "" |
162 | 158 |
163 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" | 159 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" |
164 echo "Archiving autotest build artifacts" | 160 echo "Archiving autotest build artifacts" |
165 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest | 161 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 # Purge old builds if necessary | 333 # Purge old builds if necessary |
338 if [ $FLAGS_keep_max -gt 0 ]; then | 334 if [ $FLAGS_keep_max -gt 0 ]; then |
339 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 335 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
340 cd "$FLAGS_to" | 336 cd "$FLAGS_to" |
341 # +2 because line numbers start at 1 and need to skip LATEST file | 337 # +2 because line numbers start at 1 and need to skip LATEST file |
342 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 338 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
343 cd - | 339 cd - |
344 fi | 340 fi |
345 | 341 |
346 echo "Done." | 342 echo "Done." |
OLD | NEW |