Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: archive_build.sh

Issue 6527001: Remove old logic ... and don't needlessly modifiy dev image. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Remove debug info Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | common.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DEFINE_string acl "private" \ 59 DEFINE_string acl "private" \
60 "ACL to set on GSD archives" 60 "ACL to set on GSD archives"
61 DEFINE_string gsutil_archive "" \ 61 DEFINE_string gsutil_archive "" \
62 "Optional datastore archive location" 62 "Optional datastore archive location"
63 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)" 63 DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
64 DEFINE_boolean official_build $FLAGS_FALSE \ 64 DEFINE_boolean official_build $FLAGS_FALSE \
65 "Set CHROMEOS_OFFICIAL=1 for release builds." 65 "Set CHROMEOS_OFFICIAL=1 for release builds."
66 DEFINE_string test_tarball "" "Optional path to test tarball to archive" 66 DEFINE_string test_tarball "" "Optional path to test tarball to archive"
67 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" 67 DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes"
68 DEFINE_boolean prebuilt_upload $FLAGS_FALSE "Upload prebuilt binary packages." 68 DEFINE_boolean prebuilt_upload $FLAGS_FALSE "Upload prebuilt binary packages."
69 DEFINE_boolean remove_dev $FLAGS_TRUE "Remove the de image during archive."
69 DEFINE_string to "$DEFAULT_TO" "Directory of build archive" 70 DEFINE_string to "$DEFAULT_TO" "Directory of build archive"
70 DEFINE_string zipname "image.zip" "Name of zip file to create." 71 DEFINE_string zipname "image.zip" "Name of zip file to create."
71 72
72 # Parse command line 73 # Parse command line
73 FLAGS "$@" || exit 1 74 FLAGS "$@" || exit 1
74 eval set -- "${FLAGS_ARGV}" 75 eval set -- "${FLAGS_ARGV}"
75 76
76 # Set if default from path is used 77 # Set if default from path is used
77 DEFAULT_USED= 78 DEFAULT_USED=
78 79
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 # Create the output directory 132 # Create the output directory
132 OUTDIR="${FLAGS_to}/${LAST_CHANGE}" 133 OUTDIR="${FLAGS_to}/${LAST_CHANGE}"
133 ZIPFILE="${OUTDIR}/${FLAGS_zipname}" 134 ZIPFILE="${OUTDIR}/${FLAGS_zipname}"
134 FACTORY_ZIPFILE="${OUTDIR}/factory_${FLAGS_zipname}" 135 FACTORY_ZIPFILE="${OUTDIR}/factory_${FLAGS_zipname}"
135 echo "archive to dir: $OUTDIR" 136 echo "archive to dir: $OUTDIR"
136 echo "archive to file: $ZIPFILE" 137 echo "archive to file: $ZIPFILE"
137 138
138 rm -rf "$OUTDIR" 139 rm -rf "$OUTDIR"
139 mkdir -p "$OUTDIR" 140 mkdir -p "$OUTDIR"
140 141
141
142 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
143 BACKUP_IMAGE="${FLAGS_from}/chromiumos_image_bkup.bin"
144
145 # Apply mod_image_for_test to the developer image, and store the
146 # result in a new location. Usage:
147 # do_chroot_mod "$OUTPUT_IMAGE" "--flags_to_mod_image_for_test"
148 function do_chroot_mod() {
149 MOD_ARGS=$2
150 OUTPUT_IMAGE=$1
151 cp -f "${SRC_IMAGE}" "${BACKUP_IMAGE}"
152 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
153 --yes ${MOD_ARGS}
154 mv "${SRC_IMAGE}" "${OUTPUT_IMAGE}"
155 mv "${BACKUP_IMAGE}" "${SRC_IMAGE}"
156 }
157
158 # Modify image for test if flag set. 142 # Modify image for test if flag set.
159 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]; then 143 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]; then
160 echo "Modifying image for test" 144 echo "Modifying image for test"
161 do_chroot_mod "${FLAGS_from}/chromiumos_test_image.bin" "" 145 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
146 --noinplace --yes
162 147
163 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" 148 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
164 echo "Archiving autotest build artifacts" 149 echo "Archiving autotest build artifacts"
165 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest 150 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest
166 popd 151 popd
167 fi 152 fi
168 153
169 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]; then 154 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]; then
170 echo "Modifying image for factory test" 155 echo "Modifying image for factory test"
171 do_chroot_mod "${FLAGS_from}/chromiumos_factory_image.bin" \ 156 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
172 "--factory" 157 --yes --noinplace --factory
173 fi 158 fi
174 159
175 # Modify for recovery 160 # Modify for recovery
176 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then 161 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then
177 BUILDVER="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)" 162 BUILDVER="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
178 CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER 163 CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER
179 ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \ 164 ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \
180 --image $CHROOT_IMAGE_DIR/chromiumos_base_image.bin 165 --image $CHROOT_IMAGE_DIR/chromiumos_base_image.bin
181 fi 166 fi
182 167
183 # Remove the developer build if test image is also built. 168 # Remove the developer build if test image is also built.
184 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] ; then 169 if [ $FLAGS_remove_dev -eq $FLAGS_TRUE ]; then
185 rm -f ${SRC_IMAGE} 170 rm -f "${FLAGS_from}/${CHROMEOS_IMAGE_NAME}"
sjg 2011/02/16 02:04:51 Yes this seems much better. I guess you are wanti
186 fi 171 fi
187 172
188 # Build differently sized shims. Currently only factory install shim is 173 # Build differently sized shims. Currently only factory install shim is
189 # supported, TODO(tgao): Add developer shim. 174 # supported, TODO(tgao): Add developer shim.
190 if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then 175 if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then
191 echo "Building factory install shim." 176 echo "Building factory install shim."
192 # HACK: The build system can't currently handle more than one image size 177 # HACK: The build system can't currently handle more than one image size
193 # at a time. Therefor eit's necessary to do another round of build after 178 # at a time. Therefor eit's necessary to do another round of build after
194 # archiving the original build. This should be fixed in Chromite. 179 # archiving the original build. This should be fixed in Chromite.
195 180
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 # Purge old builds if necessary 322 # Purge old builds if necessary
338 if [ $FLAGS_keep_max -gt 0 ]; then 323 if [ $FLAGS_keep_max -gt 0 ]; then
339 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." 324 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..."
340 cd "$FLAGS_to" 325 cd "$FLAGS_to"
341 # +2 because line numbers start at 1 and need to skip LATEST file 326 # +2 because line numbers start at 1 and need to skip LATEST file
342 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` 327 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))`
343 cd - 328 cd -
344 fi 329 fi
345 330
346 echo "Done." 331 echo "Done."
OLDNEW
« no previous file with comments | « no previous file | common.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698