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

Side by Side Diff: archive_build.sh

Issue 6626040: Rebuild image for factory (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 9 years, 9 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 | no next file » | 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 echo "Modifying image for test" 144 echo "Modifying image for test"
145 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ 145 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
146 --noinplace --yes 146 --noinplace --yes
147 147
148 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" 148 pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
149 echo "Archiving autotest build artifacts" 149 echo "Archiving autotest build artifacts"
150 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest 150 tar cjf "${FLAGS_from}/autotest.tar.bz2" --checkpoint=1000 autotest
151 popd 151 popd
152 fi 152 fi
153 153
154 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]; then
155 echo "Modifying image for factory test"
156 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
157 --yes --noinplace --factory
158 fi
159
160 # Modify for recovery 154 # Modify for recovery
161 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then 155 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then
162 BUILDVER="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)" 156 BUILDVER="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
163 CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER 157 CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER
164 ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \ 158 ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \
165 --image $CHROOT_IMAGE_DIR/chromiumos_base_image.bin 159 --image $CHROOT_IMAGE_DIR/chromiumos_base_image.bin
166 fi 160 fi
167 161
168 # Remove the developer build if test image is also built. 162 # Remove the developer build if test image is also built.
169 if [ $FLAGS_remove_dev -eq $FLAGS_TRUE ]; then 163 if [ $FLAGS_remove_dev -eq $FLAGS_TRUE ]; then
170 rm -f "${FLAGS_from}/${CHROMEOS_IMAGE_NAME}" 164 rm -f "${FLAGS_from}/${CHROMEOS_IMAGE_NAME}"
171 fi 165 fi
172 166
167 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]; then
168 echo "Generating image for factory test"
169 # HACK: The build system can't currently handle more than one image size
170 # at a time. Therefore it's necessary to do another round of build after
171 # archiving the original build. This should be fixed in Chromite.
172
173 # HACK: cbuild has a special case when running on chrome-bot that
174 # zeroes out the current revision, which makes calling build_image directly
175 # fail. You must explictly call replace and specify a unique name numerically
176 # using build_attempt.
177 ./enter_chroot.sh -- ./build_image --board $FLAGS_board \
178 --replace --noenable_rootfs_verification --build_attempt 4
179
180 ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \
181 --yes --noinplace --factory
182
183 # Get the factory test dir: It is the newest build.
184 # This is the output dir for the factory shim, the factory test and
185 # release images will remain in IMG_DIR, defined previously.
186 FACTORY_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
187
188 echo "Factory image dir: ${FACTORY_DIR}"
189 fi
190
173 # Build differently sized shims. Currently only factory install shim is 191 # Build differently sized shims. Currently only factory install shim is
174 # supported, TODO(tgao): Add developer shim. 192 # supported, TODO(tgao): Add developer shim.
175 if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then 193 if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then
176 echo "Building factory install shim." 194 echo "Building factory install shim."
177 # HACK: The build system can't currently handle more than one image size 195 # HACK: The build system can't currently handle more than one image size
178 # at a time. Therefor eit's necessary to do another round of build after 196 # at a time. Therefore it's necessary to do another round of build after
179 # archiving the original build. This should be fixed in Chromite. 197 # archiving the original build. This should be fixed in Chromite.
180 198
181 # HACK: cbuild has a special case when running on chrome-bot that 199 # HACK: cbuild has a special case when running on chrome-bot that
182 # zeroes out the current revision, which makes calling build_image directly 200 # zeroes out the current revision, which makes calling build_image directly
183 # fail. You must explictly call replace and specify a unique name numerically 201 # fail. You must explictly call replace and specify a unique name numerically
184 # using build_attempt. 202 # using build_attempt.
185 ./enter_chroot.sh -- ./build_image --board $FLAGS_board --factory_install \ 203 ./enter_chroot.sh -- ./build_image --board $FLAGS_board --factory_install \
186 --replace --build_attempt 7 204 --replace --build_attempt 7
187 205
188 # Get the install shim dir: It is the newest build. 206 # Get the install shim dir: It is the newest build.
189 # This is the output dir for the factory shim, the factory test and 207 # This is the output dir for the factory shim, the factory test and
190 # release images will remain in IMG_DIR, defined previously. 208 # release images will remain in IMG_DIR, defined previously.
191 SHIM_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)" 209 SHIM_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
192 210
193 echo "Factory image dir: ${IMG_DIR}"
194 echo "Factory install shim dir: ${SHIM_DIR}" 211 echo "Factory install shim dir: ${SHIM_DIR}"
195 fi 212 fi
196 213
197 # Zip the build 214 # Zip the build
198 echo "Compressing and archiving build..." 215 echo "Compressing and archiving build..."
199 cd "$FLAGS_from" 216 cd "$FLAGS_from"
200 MANIFEST=`ls | grep -v factory` 217 MANIFEST=`ls | grep -v factory`
201 zip -r "${ZIPFILE}" ${MANIFEST} 218 zip -r "${ZIPFILE}" ${MANIFEST}
202 219
203 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \ 220 if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \
204 [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then 221 [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then
205 # We need to have directory structure for factory package, as 222 # We need to have directory structure for factory package, as
206 # signing and packaging utilities need unpack_partitions.sh. 223 # signing and packaging utilities need unpack_partitions.sh.
207 echo "Compressing factory software" 224 echo "Compressing factory software"
208 pushd .. 225 pushd ..
209 [ -n "${SHIM_DIR}" ] && rm -f factory_shim && ln -s "${SHIM_DIR}" factory_shim 226 [ -n "${SHIM_DIR}" ] && rm -f factory_shim && \
210 [ -n "${IMG_DIR}" ] && rm -f factory_test && ln -s "${IMG_DIR}" factory_test 227 ln -s "${SHIM_DIR}" factory_shim
228 [ -n "${FACTORY_DIR}" ] && rm -f factory_test && \
229 ln -s "${FACTORY_DIR}" factory_test
211 230
212 # Restore "latest" status to the original image. 231 # Restore "latest" status to the original image.
213 # The "latest" symlink and latest timestamp are used extensively 232 # The "latest" symlink and latest timestamp are used extensively
214 # throughout the build scripts rather than explicitly specifying an image. 233 # throughout the build scripts rather than explicitly specifying an image.
215 touch "${IMG_DIR}" 234 touch "${IMG_DIR}"
216 [ -n "${IMG_DIR}" ] && rm -f latest && ln -s "${IMG_DIR}" latest 235 [ -n "${IMG_DIR}" ] && rm -f latest && ln -s "${IMG_DIR}" latest
217 FACTORY_MANIFEST=`find factory_shim factory_test -follow \ 236 FACTORY_MANIFEST=`find factory_shim factory_test -follow \
218 -type f | grep -E "(factory_image|factory_install|partition)"` 237 -type f | grep -E "(factory_image|factory_install|partition)"`
219 zip "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST} 238 zip "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST}
220 echo "Zipped" 239 echo "Zipped"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 # Purge old builds if necessary 341 # Purge old builds if necessary
323 if [ $FLAGS_keep_max -gt 0 ]; then 342 if [ $FLAGS_keep_max -gt 0 ]; then
324 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." 343 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..."
325 cd "$FLAGS_to" 344 cd "$FLAGS_to"
326 # +2 because line numbers start at 1 and need to skip LATEST file 345 # +2 because line numbers start at 1 and need to skip LATEST file
327 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` 346 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))`
328 cd - 347 cd -
329 fi 348 fi
330 349
331 echo "Done." 350 echo "Done."
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698