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

Side by Side Diff: src/scripts/build_image

Issue 1594035: Revert "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"
40 DEFINE_boolean statefuldev $FLAGS_FALSE \ 38 DEFINE_boolean statefuldev $FLAGS_FALSE \
41 "Install development packages on stateful partition rather than the rootfs" 39 "Install development packages on stateful partition rather than the rootfs"
42 DEFINE_string to "" \ 40 DEFINE_string to "" \
43 "The target image file or device" 41 "The target image file or device"
44 DEFINE_boolean withtest $FLAGS_FALSE \ 42 DEFINE_boolean withtest $FLAGS_FALSE \
45 "Include packages required for testing and prepare image for testing" 43 "Include packages required for testing and prepare image for testing"
46 DEFINE_string factory_server "" \ 44 DEFINE_string factory_server "" \
47 "Build a factory install image pointing to given server." 45 "Build a factory install image pointing to given server."
48 46
49 # Parse command line. 47 # Parse command line.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" 276 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
279 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" 277 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
280 278
281 INSTALL_MASK="" 279 INSTALL_MASK=""
282 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then 280 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then
283 INSTALL_MASK="$DEFAULT_INSTALL_MASK" 281 INSTALL_MASK="$DEFAULT_INSTALL_MASK"
284 fi 282 fi
285 283
286 if [[ $FLAGS_jobs -ne -1 ]]; then 284 if [[ $FLAGS_jobs -ne -1 ]]; then
287 EMERGE_JOBS="--jobs=$FLAGS_jobs" 285 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
293 fi 286 fi
294 287
295 # Prepare stateful partition with some pre-created directories 288 # Prepare stateful partition with some pre-created directories
296 sudo mkdir -p "${DEV_IMAGE_ROOT}" 289 sudo mkdir -p "${DEV_IMAGE_ROOT}"
297 sudo mkdir -p "${STATEFUL_DIR}/var" 290 sudo mkdir -p "${STATEFUL_DIR}/var"
298 291
299 # Create symlinks so that /usr/local/usr based directories are symlinked to 292 # Create symlinks so that /usr/local/usr based directories are symlinked to
300 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc. 293 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
301 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" 294 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var"
302 295
303 # Perform binding rather than symlinking because directories must exist 296 # Perform binding rather than symlinking because directories must exist
304 # on rootfs so that we can bind at run-time since rootfs is read-only 297 # on rootfs so that we can bind at run-time since rootfs is read-only
305 echo "Binding directories from stateful partition onto the rootfs" 298 echo "Binding directories from stateful partition onto the rootfs"
306 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" 299 sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
307 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" 300 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
308 sudo mkdir -p "${ROOT_FS_DIR}/var" 301 sudo mkdir -p "${ROOT_FS_DIR}/var"
309 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var" 302 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
310 303
311 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the 304 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
312 # runtime packages for chrome os. This builds up a chrome os image from binary 305 # runtime packages for chrome os. This builds up a chrome os image from binary
313 # packages with runtime dependencies only. We use INSTALL_MASK to trim the 306 # packages with runtime dependencies only. We use INSTALL_MASK to trim the
314 # image size as much as possible. 307 # image size as much as possible.
315 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 308 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
316 --root="$ROOT_FS_DIR" --root-deps=rdeps \ 309 --root="$ROOT_FS_DIR" --root-deps=rdeps \
317 --usepkgonly chromeos $EMERGE_JOBS 310 --usepkgonly chromeos $EMERGE_JOBS
318 311
319 # Determine the root dir for development packages. 312 # Determine the root dir for development packages.
320 ROOT_DEV_DIR="$ROOT_FS_DIR" 313 ROOT_DEV_DIR="$ROOT_FS_DIR"
321 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" 314 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
322 315
323 # Install development packages. 316 # Install development packages.
324 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then 317 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
325 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 318 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
326 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 319 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
327 --usepkgonly chromeos-dev $EMERGE_JOBS 320 --usepkgonly chromeos-dev $EMERGE_JOBS
328 321
329 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch 322 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
330 # Flag will mount /usr/local on target device 323 # Flag will mount /usr/local on target device
331 sudo mkdir -p "$ROOT_FS_DIR/root" 324 sudo mkdir -p "$ROOT_FS_DIR/root"
332 sudo touch "$ROOT_FS_DIR/root/.dev_mode" 325 sudo touch "$ROOT_FS_DIR/root/.dev_mode"
333 326
334 # The ldd tool is a useful shell script but lives in glibc; just copy it. 327 # The ldd tool is a useful shell script but lives in glibc; just copy it.
335 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" 328 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
336 fi 329 fi
337 330
338 if [ -n "$FLAGS_factory_server" ]; then 331 if [ -n "$FLAGS_factory_server" ]; then
339 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 332 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
340 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 333 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
341 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS 334 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS
342 fi 335 fi
343 336
344 # Install packages required for testing. 337 # Install packages required for testing.
345 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then 338 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then
346 eretry sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 339 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
347 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 340 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
348 --usepkgonly chromeos-test $EMERGE_JOBS 341 --usepkgonly chromeos-test $EMERGE_JOBS
349 fi 342 fi
350 343
351 # Perform any customizations on the root file system that are needed. 344 # Perform any customizations on the root file system that are needed.
352 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="" 345 EXTRA_CUSTOMIZE_ROOTFS_FLAGS=""
353 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then 346 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then
354 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev" 347 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev"
355 fi 348 fi
356 if [ -n "$FLAGS_factory_server" ]; then 349 if [ -n "$FLAGS_factory_server" ]; then
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 431
439 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" 432 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
440 echo "Done. Image created in ${OUTPUT_DIR}" 433 echo "Done. Image created in ${OUTPUT_DIR}"
441 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" 434 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
442 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" 435 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb"
443 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" 436 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
444 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 437 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
445 echo "from the scripts directory where you entered the chroot." 438 echo "from the scripts directory where you entered the chroot."
446 439
447 trap - EXIT 440 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