Chromium Code Reviews| 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 sync your checkout, build a Chromium OS image, and test it all | 7 # Script to sync your checkout, build a Chromium OS image, and test it all |
| 8 # with one command. Can also check out a new Chromium OS checkout and | 8 # with one command. Can also check out a new Chromium OS checkout and |
| 9 # perform a subset of the above operations. | 9 # perform a subset of the above operations. |
| 10 # | 10 # |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 "Use this hostname/IP for live updating and running tests" | 74 "Use this hostname/IP for live updating and running tests" |
| 75 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" | 75 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" |
| 76 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" | 76 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" |
| 77 DEFINE_string test "" \ | 77 DEFINE_string test "" \ |
| 78 "Test the built image with the given params to run_remote_tests" | 78 "Test the built image with the given params to run_remote_tests" |
| 79 DEFINE_string top "" \ | 79 DEFINE_string top "" \ |
| 80 "Root directory of your checkout (defaults to determining from your cwd)" | 80 "Root directory of your checkout (defaults to determining from your cwd)" |
| 81 DEFINE_boolean withdev ${FLAGS_TRUE} "Build development packages" | 81 DEFINE_boolean withdev ${FLAGS_TRUE} "Build development packages" |
| 82 DEFINE_boolean usepkg ${FLAGS_TRUE} "Use binary packages" | 82 DEFINE_boolean usepkg ${FLAGS_TRUE} "Use binary packages" |
| 83 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" | 83 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" |
| 84 | 84 DEFINE_string chrome_root "" \ |
|
kmixter1
2010/07/16 06:08:17
abc order
| |
| 85 "The root of your chrome browser source. Should contain a 'src' subdir. \ | |
| 86 If this is set, chrome browser will be built from source." | |
| 85 | 87 |
| 86 # Returns a heuristic indicating if we believe this to be a google internal | 88 # Returns a heuristic indicating if we believe this to be a google internal |
| 87 # development environment. | 89 # development environment. |
| 88 # Returns: | 90 # Returns: |
| 89 # 0 if so, 1 otherwise | 91 # 0 if so, 1 otherwise |
| 90 function is_google_environment() { | 92 function is_google_environment() { |
| 91 hostname | egrep -q .google.com\$ | 93 hostname | egrep -q .google.com\$ |
| 92 return $? | 94 return $? |
| 93 } | 95 } |
| 94 | 96 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 119 | 121 |
| 120 if [[ -z "${FLAGS_chroot}" ]]; then | 122 if [[ -z "${FLAGS_chroot}" ]]; then |
| 121 FLAGS_chroot="${FLAGS_top}/chroot" | 123 FLAGS_chroot="${FLAGS_top}/chroot" |
| 122 fi | 124 fi |
| 123 | 125 |
| 124 # If chroot does not exist, force making it | 126 # If chroot does not exist, force making it |
| 125 if [[ ! -d "${FLAGS_chroot}" ]]; then | 127 if [[ ! -d "${FLAGS_chroot}" ]]; then |
| 126 FLAGS_force_make_chroot=${FLAGS_TRUE} | 128 FLAGS_force_make_chroot=${FLAGS_TRUE} |
| 127 fi | 129 fi |
| 128 | 130 |
| 131 # If chrome_root option passed, set as option for ./enter_chroot | |
| 132 if [[ ${FLAGS_chrome_root} ]]; then | |
|
kmixter1
2010/07/16 06:08:17
-n "${FLAGS_chrome_root}"
| |
| 133 chroot_options="--chrome_root=${FLAGS_chrome_root}" | |
| 134 fi | |
| 135 | |
| 129 if [[ -z "${FLAGS_repo}" ]]; then | 136 if [[ -z "${FLAGS_repo}" ]]; then |
| 130 if is_google_environment; then | 137 if is_google_environment; then |
| 131 FLAGS_repo="ssh://git@chromiumos-git//chromeos" | 138 FLAGS_repo="ssh://git@chromiumos-git//chromeos" |
| 132 else | 139 else |
| 133 FLAGS_repo="http://src.chromium.org/git/chromiumos.git" | 140 FLAGS_repo="http://src.chromium.org/git/chromiumos.git" |
| 134 fi | 141 fi |
| 135 fi | 142 fi |
| 136 | 143 |
| 137 if [[ -n "${FLAGS_test}" ]]; then | 144 if [[ -n "${FLAGS_test}" ]]; then |
| 138 # If you specify that tests should be run, we assume the image | 145 # If you specify that tests should be run, we assume the image |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 } | 360 } |
| 354 | 361 |
| 355 | 362 |
| 356 # Runs a phase, similar to run_phase, but runs within the chroot. | 363 # Runs a phase, similar to run_phase, but runs within the chroot. |
| 357 # Arguments: | 364 # Arguments: |
| 358 # $1 - phase description | 365 # $1 - phase description |
| 359 # $2.. - command/params to run in chroot | 366 # $2.. - command/params to run in chroot |
| 360 function run_phase_in_chroot() { | 367 function run_phase_in_chroot() { |
| 361 local desc="$1" | 368 local desc="$1" |
| 362 shift | 369 shift |
| 363 run_phase "${desc}" ./enter_chroot.sh "--chroot=${FLAGS_chroot}" -- "$@" | 370 run_phase "${desc}" ./enter_chroot.sh "--chroot=${FLAGS_chroot}" \ |
| 371 ${chroot_options} -- "$@" | |
| 364 } | 372 } |
| 365 | 373 |
| 366 | 374 |
| 367 # Record start time. | 375 # Record start time. |
| 368 function set_start_time() { | 376 function set_start_time() { |
| 369 START_TIME=$(date '+%s') | 377 START_TIME=$(date '+%s') |
| 370 } | 378 } |
| 371 | 379 |
| 372 | 380 |
| 373 # Display duration | 381 # Display duration |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 run_phase_in_chroot "Building packages" \ | 533 run_phase_in_chroot "Building packages" \ |
| 526 ./build_packages "${board_param}" \ | 534 ./build_packages "${board_param}" \ |
| 527 ${jobs_param} ${withdev_param} ${build_autotest_param} \ | 535 ${jobs_param} ${withdev_param} ${build_autotest_param} \ |
| 528 ${pkg_param} | 536 ${pkg_param} |
| 529 | 537 |
| 530 run_phase_in_chroot "Building unit tests" ./build_tests.sh ${board_param} | 538 run_phase_in_chroot "Building unit tests" ./build_tests.sh ${board_param} |
| 531 if [[ "${FLAGS_board}" == "x86-generic" ]]; then | 539 if [[ "${FLAGS_board}" == "x86-generic" ]]; then |
| 532 run_phase_in_chroot "Running unit tests" ./run_tests.sh ${board_param} | 540 run_phase_in_chroot "Running unit tests" ./run_tests.sh ${board_param} |
| 533 fi | 541 fi |
| 534 fi | 542 fi |
| 543 | |
| 544 if [[ ${FLAGS_chrome_root} ]]; then | |
| 545 run_phase_in_chroot "Building Chromium browser" \ | |
| 546 USE="build_tests" FEATURES="-usersandbox" \ | |
| 547 CHROME_ORIGIN=LOCAL_SOURCE emerge-${FLAGS_board} chromeos-chrome | |
| 548 fi | |
| 535 | 549 |
| 536 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then | 550 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then |
| 537 chdir_relative src/scripts | 551 chdir_relative src/scripts |
| 538 if [[ -n "${FLAGS_chronos_passwd}" ]]; then | 552 if [[ -n "${FLAGS_chronos_passwd}" ]]; then |
| 539 run_phase_in_chroot "Setting default chronos password" \ | 553 run_phase_in_chroot "Setting default chronos password" \ |
| 540 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ | 554 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ |
| 541 ~/trunk/src/scripts/set_shared_user_password.sh" | 555 ~/trunk/src/scripts/set_shared_user_password.sh" |
| 542 fi | 556 fi |
| 543 run_phase_in_chroot "Mastering image" ./build_image \ | 557 run_phase_in_chroot "Mastering image" ./build_image \ |
| 544 "${board_param}" --replace ${withdev_param} \ | 558 "${board_param}" --replace ${withdev_param} \ |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 573 fi | 587 fi |
| 574 | 588 |
| 575 trap - EXIT | 589 trap - EXIT |
| 576 echo "Successfully used ${FLAGS_top} to:" | 590 echo "Successfully used ${FLAGS_top} to:" |
| 577 describe_steps | 591 describe_steps |
| 578 show_duration | 592 show_duration |
| 579 } | 593 } |
| 580 | 594 |
| 581 | 595 |
| 582 main $@ | 596 main $@ |
| OLD | NEW |