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

Side by Side Diff: src/scripts/build_image

Issue 1564035: Retry on build_image failures and make sbt more aggressive by default (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « no previous file | src/scripts/sync_build_test.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) 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 build a bootable keyfob-based chromeos system image from within 7 # Script to build a bootable keyfob-based chromeos system image from within
8 # a chromiumos setup. This assumes that all needed packages have been built into 8 # a chromiumos setup. This assumes that all needed packages have been built into
9 # the given target's root with binary packages turned on. This script will 9 # the given target's root with binary packages turned on. This script will
10 # build the Chrome OS image using only pre-built binary packages. 10 # build the Chrome OS image using only pre-built binary packages.
(...skipping 17 matching lines...) Expand all
28 DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ 28 DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
29 "Directory in which to place image result directories (named by version)" 29 "Directory in which to place image result directories (named by version)"
30 DEFINE_boolean replace $FLAGS_FALSE \ 30 DEFINE_boolean replace $FLAGS_FALSE \
31 "Overwrite existing output, if any." 31 "Overwrite existing output, if any."
32 DEFINE_boolean withdev $FLAGS_TRUE \ 32 DEFINE_boolean withdev $FLAGS_TRUE \
33 "Include useful developer friendly utilities in the image." 33 "Include useful developer friendly utilities in the image."
34 DEFINE_boolean installmask $FLAGS_TRUE \ 34 DEFINE_boolean installmask $FLAGS_TRUE \
35 "Use INSTALL_MASK to shrink the resulting image." 35 "Use INSTALL_MASK to shrink the resulting image."
36 DEFINE_integer jobs -1 \ 36 DEFINE_integer jobs -1 \
37 "How many packages to build in parallel at maximum." 37 "How many packages to build in parallel at maximum."
38 DEFINE_integer retries -1 \
39 "On image mastering failure, the number of times to retry"
38 DEFINE_boolean statefuldev $FLAGS_FALSE \ 40 DEFINE_boolean statefuldev $FLAGS_FALSE \
39 "Install development packages on stateful partition rather than the rootfs" 41 "Install development packages on stateful partition rather than the rootfs"
40 DEFINE_string to "" \ 42 DEFINE_string to "" \
41 "The target image file or device" 43 "The target image file or device"
42 DEFINE_boolean withtest $FLAGS_FALSE \ 44 DEFINE_boolean withtest $FLAGS_FALSE \
43 "Include packages required for testing and prepare image for testing" 45 "Include packages required for testing and prepare image for testing"
44 DEFINE_string factory_server "" \ 46 DEFINE_string factory_server "" \
45 "Build a factory install image pointing to given server." 47 "Build a factory install image pointing to given server."
46 48
47 # Parse command line. 49 # Parse command line.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" 278 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
277 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" 279 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
278 280
279 INSTALL_MASK="" 281 INSTALL_MASK=""
280 if [[ $FLAGS_installmask -eq $FLAGS_FALSE ]] ; then 282 if [[ $FLAGS_installmask -eq $FLAGS_FALSE ]] ; then
281 INSTALL_MASK="$DEFAULT_INSTALL_MASK" 283 INSTALL_MASK="$DEFAULT_INSTALL_MASK"
282 fi 284 fi
283 285
284 if [[ $FLAGS_jobs -ne -1 ]]; then 286 if [[ $FLAGS_jobs -ne -1 ]]; then
285 EMERGE_JOBS="--jobs=$FLAGS_jobs" 287 EMERGE_JOBS="--jobs=$FLAGS_jobs"
288 if [[ $FLAGS_retries -eq -1 ]]; then
289 # The jobs flag can be flaky. Retry once by default,
290 # without the jobs flag.
291 FLAGS_retries=1
292 fi
286 fi 293 fi
287 294
288 # Prepare stateful partition with some pre-created directories 295 # Prepare stateful partition with some pre-created directories
289 sudo mkdir -p "${DEV_IMAGE_ROOT}" 296 sudo mkdir -p "${DEV_IMAGE_ROOT}"
290 sudo mkdir -p "${STATEFUL_DIR}/var" 297 sudo mkdir -p "${STATEFUL_DIR}/var"
291 298
292 # Create symlinks so that /usr/local/usr based directories are symlinked to 299 # Create symlinks so that /usr/local/usr based directories are symlinked to
293 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc. 300 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
294 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" 301 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var"
295 302
296 # Perform binding rather than symlinking because directories must exist 303 # Perform binding rather than symlinking because directories must exist
297 # on rootfs so that we can bind at run-time since rootfs is read-only 304 # on rootfs so that we can bind at run-time since rootfs is read-only
298 echo "Binding directories from stateful partition onto the rootfs" 305 echo "Binding directories from stateful partition onto the rootfs"
299 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" 306 sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
300 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" 307 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
301 sudo mkdir -p "${ROOT_FS_DIR}/var" 308 sudo mkdir -p "${ROOT_FS_DIR}/var"
302 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var" 309 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
303 310
304 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the 311 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
305 # runtime packages for chrome os. This builds up a chrome os image from binary 312 # runtime packages for chrome os. This builds up a chrome os image from binary
306 # packages with runtime dependencies only. We use INSTALL_MASK to trim the 313 # packages with runtime dependencies only. We use INSTALL_MASK to trim the
307 # image size as much as possible. 314 # image size as much as possible.
308 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 315 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
309 --root="$ROOT_FS_DIR" --root-deps=rdeps \ 316 --root="$ROOT_FS_DIR" --root-deps=rdeps \
310 --usepkgonly chromeos $EMERGE_JOBS 317 --usepkgonly chromeos $EMERGE_JOBS
311 318
312 # Determine the root dir for development packages. 319 # Determine the root dir for development packages.
313 ROOT_DEV_DIR="$ROOT_FS_DIR" 320 ROOT_DEV_DIR="$ROOT_FS_DIR"
314 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" 321 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
315 322
316 # Install development packages. 323 # Install development packages.
317 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then 324 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
318 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 325 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
319 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 326 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
320 --usepkgonly chromeos-dev $EMERGE_JOBS 327 --usepkgonly chromeos-dev $EMERGE_JOBS
321 328
322 # The ldd tool is a useful shell script but lives in glibc; just copy it. 329 # The ldd tool is a useful shell script but lives in glibc; just copy it.
323 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" 330 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
324 fi 331 fi
325 332
326 if [ -n "$FLAGS_factory_server" ]; then 333 if [ -n "$FLAGS_factory_server" ]; then
327 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 334 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
328 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 335 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
329 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS 336 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS
330 fi 337 fi
331 338
332 # Install packages required for testing. 339 # Install packages required for testing.
333 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then 340 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then
334 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 341 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
335 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 342 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
336 --usepkgonly chromeos-test $EMERGE_JOBS 343 --usepkgonly chromeos-test $EMERGE_JOBS
337 fi 344 fi
338 345
339 # Perform any customizations on the root file system that are needed. 346 # Perform any customizations on the root file system that are needed.
340 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="" 347 EXTRA_CUSTOMIZE_ROOTFS_FLAGS=""
341 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then 348 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then
342 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev" 349 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev"
343 fi 350 fi
344 if [ -n "$FLAGS_factory_server" ]; then 351 if [ -n "$FLAGS_factory_server" ]; then
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 438
432 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" 439 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
433 echo "Done. Image created in ${OUTPUT_DIR}" 440 echo "Done. Image created in ${OUTPUT_DIR}"
434 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" 441 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
435 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" 442 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb"
436 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" 443 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
437 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 444 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
438 echo "from the scripts directory where you entered the chroot." 445 echo "from the scripts directory where you entered the chroot."
439 446
440 trap - EXIT 447 trap - EXIT
OLDNEW
« no previous file with comments | « no previous file | src/scripts/sync_build_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698