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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ | 65 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ |
66 "Put the resulting image on live instance (requires --remote)" | 66 "Put the resulting image on live instance (requires --remote)" |
67 DEFINE_string image_to_usb "" \ | 67 DEFINE_string image_to_usb "" \ |
68 "Treat this device as USB and put the image on it after build" | 68 "Treat this device as USB and put the image on it after build" |
69 # You can set jobs > 1 but then your build may break and you may need | 69 # You can set jobs > 1 but then your build may break and you may need |
70 # to retry. Setting it to 1 is best for non-interactive sessions. | 70 # to retry. Setting it to 1 is best for non-interactive sessions. |
71 DEFINE_boolean interactive ${FLAGS_FALSE} \ | 71 DEFINE_boolean interactive ${FLAGS_FALSE} \ |
72 "Tell user what we plan to do and wait for input to proceed" i | 72 "Tell user what we plan to do and wait for input to proceed" i |
73 DEFINE_integer jobs -1 "Concurrent build jobs" | 73 DEFINE_integer jobs -1 "Concurrent build jobs" |
74 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" | 74 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" |
| 75 DEFINE_boolean minilayout ${FLAGS_FALSE} "Use minimal code checkout" |
75 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" | 76 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" |
76 DEFINE_string remote "" \ | 77 DEFINE_string remote "" \ |
77 "Use this hostname/IP for live updating and running tests" | 78 "Use this hostname/IP for live updating and running tests" |
78 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" | 79 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" |
79 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" | 80 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" |
80 DEFINE_string test "" \ | 81 DEFINE_string test "" \ |
81 "Test the built image with the given params to run_remote_tests" | 82 "Test the built image with the given params to run_remote_tests" |
82 DEFINE_string top "" \ | 83 DEFINE_string top "" \ |
83 "Root directory of your checkout (defaults to determining from your cwd)" | 84 "Root directory of your checkout (defaults to determining from your cwd)" |
84 DEFINE_boolean withdev ${FLAGS_TRUE} "Build development packages" | 85 DEFINE_boolean withdev ${FLAGS_TRUE} "Build development packages" |
85 DEFINE_boolean usepkg ${FLAGS_TRUE} "Use binary packages" | 86 DEFINE_boolean usepkg ${FLAGS_TRUE} "Use binary packages" |
86 DEFINE_boolean useworkon ${FLAGS_FALSE} "Use cros_workon/repo workflow" | 87 DEFINE_boolean useworkon ${FLAGS_TRUE} "Use cros_workon/repo workflow" |
87 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" | 88 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" |
88 | 89 |
89 # Returns a heuristic indicating if we believe this to be a google internal | 90 # Returns a heuristic indicating if we believe this to be a google internal |
90 # development environment. | 91 # development environment. |
91 # Returns: | 92 # Returns: |
92 # 0 if so, 1 otherwise | 93 # 0 if so, 1 otherwise |
93 function is_google_environment() { | 94 function is_google_environment() { |
94 hostname | egrep -q .google.com\$ | 95 hostname | egrep -q .google.com\$ |
95 return $? | 96 return $? |
96 } | 97 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 local top_parent=$(dirname "${FLAGS_top}") | 399 local top_parent=$(dirname "${FLAGS_top}") |
399 mkdir -p "${top_parent}" | 400 mkdir -p "${top_parent}" |
400 cd "${top_parent}" | 401 cd "${top_parent}" |
401 gclient config "${FLAGS_repo}" | 402 gclient config "${FLAGS_repo}" |
402 } | 403 } |
403 | 404 |
404 # Runs repo init on a new checkout directory. | 405 # Runs repo init on a new checkout directory. |
405 function config_new_repo_checkout() { | 406 function config_new_repo_checkout() { |
406 mkdir -p "${FLAGS_top}" | 407 mkdir -p "${FLAGS_top}" |
407 cd "${FLAGS_top}" | 408 cd "${FLAGS_top}" |
408 repo init -u http://src.chromium.org/git/manifest -m minilayout.xml | 409 local minilayout="" |
| 410 [ ${FLAGS_minilayout} -eq ${FLAGS_TRUE} ] && minilayout="-m minilayout.xml" |
| 411 repo init -u http://src.chromium.org/git/manifest ${minilayout} |
409 } | 412 } |
410 | 413 |
411 # Configures/initializes a new checkout | 414 # Configures/initializes a new checkout |
412 function config_new_checkout() { | 415 function config_new_checkout() { |
413 echo "Checking out ${FLAGS_top}" | 416 echo "Checking out ${FLAGS_top}" |
414 if [[ ${FLAGS_useworkon} ]]; then | 417 if [[ ${FLAGS_useworkon} ]]; then |
415 config_new_repo_checkout | 418 config_new_repo_checkout |
416 else | 419 else |
417 config_new_gclient_checkout | 420 config_new_gclient_checkout |
418 fi | 421 fi |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 562 |
560 chdir_relative src/scripts | 563 chdir_relative src/scripts |
561 # Only setup board target if the directory does not exist | 564 # Only setup board target if the directory does not exist |
562 if [[ ! -d "${FLAGS_top}/chroot/build/${FLAGS_board}" ]]; then | 565 if [[ ! -d "${FLAGS_top}/chroot/build/${FLAGS_board}" ]]; then |
563 run_phase_in_chroot "Setting up board target" \ | 566 run_phase_in_chroot "Setting up board target" \ |
564 ./setup_board ${pkg_param} "${board_param}" | 567 ./setup_board ${pkg_param} "${board_param}" |
565 fi | 568 fi |
566 local build_autotest_param="" | 569 local build_autotest_param="" |
567 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then | 570 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then |
568 build_autotest_param="--withautotest" | 571 build_autotest_param="--withautotest" |
| 572 if [[ ${FLAGS_useworkon} -eq ${FLAGS_TRUE} ]]; then |
| 573 # In workon flow, you must workon packages to run tests |
| 574 run_phase_in_chroot "Setting workon for autotest" \ |
| 575 ./cros_workon --board=${FLAGS_board} start autotest \ |
| 576 autotest-tests autotest-deps |
| 577 # In minilayout you may not yet have autotest. |
| 578 if [[ ! -d "${FLAGS_top}/src/third_party/autotest/files" ]]; then |
| 579 run_phase "Syncing autotest repo" repo sync autotest |
| 580 fi |
| 581 fi |
569 fi | 582 fi |
570 | 583 |
571 run_phase_in_chroot "Building packages" \ | 584 run_phase_in_chroot "Building packages" \ |
572 ./build_packages "${board_param}" \ | 585 ./build_packages "${board_param}" \ |
573 ${jobs_param} ${withdev_param} ${build_autotest_param} \ | 586 ${jobs_param} ${withdev_param} ${build_autotest_param} \ |
574 ${pkg_param} | 587 ${pkg_param} |
575 fi | 588 fi |
576 | 589 |
577 if [[ ${FLAGS_chrome_root} ]]; then | 590 if [[ ${FLAGS_chrome_root} ]]; then |
578 run_phase_in_chroot "Building Chromium browser" \ | 591 run_phase_in_chroot "Building Chromium browser" \ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 fi | 639 fi |
627 | 640 |
628 trap - EXIT | 641 trap - EXIT |
629 echo "Successfully used ${FLAGS_top} to:" | 642 echo "Successfully used ${FLAGS_top} to:" |
630 describe_steps | 643 describe_steps |
631 show_duration | 644 show_duration |
632 } | 645 } |
633 | 646 |
634 | 647 |
635 main $@ | 648 main $@ |
OLD | NEW |