From 76452baac3394f44857f4670fd819acebca0f31b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 13 Sep 2012 22:45:34 -0400 Subject: [PATCH] build_packages: allow people to specify a specific set of packages This way we can tweak buildbot configs to install specific packages rather than all of ChromeOS (useful for firmware builders). BUG=chromium-os:19140 TEST=`cbuildbot {{x86,amd64}-generic,daisy}-paladin {amd64,arm,x86}-generic-full stout-release` passed TEST=`./build_packages nano` installed just nano Change-Id: I9c316d7c390ebe6ceade97cf33c1387dc83fb887 Reviewed-on: https://gerrit.chromium.org/gerrit/33266 Reviewed-by: Brian Harring Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- build_packages | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/build_packages b/build_packages index 662380df71..6802291cf4 100755 --- a/build_packages +++ b/build_packages @@ -23,13 +23,16 @@ DEFINE_boolean showoutput "${FLAGS_FALSE}" \ DEFINE_boolean withautotest "${FLAGS_TRUE}" \ "Build autotest client code." -FLAGS_HELP="usage: $(basename $0) [flags] +FLAGS_HELP="usage: $(basename $0) [flags] [packages] build_packages updates the set of binary packages needed by Chrome OS. It will cross compile all packages that have been updated into the given target's root and build binary packages as a side-effect. The output packages will be picked up by the build_image script to put together a bootable Chrome OS image. +If [packages] are specified, only build those specific packages (and any +dependencies they might need). + For the fastest builds, use --nowithautotest --noworkon. " show_help_if_requested "$@" @@ -67,7 +70,6 @@ DEFINE_boolean reuse_pkgs_from_local_boards $FLAGS_FALSE \ # Parse command line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" -check_flags_only_and_allow_null_arg "$@" && set -- # Die on any errors. switch_to_strict_mode @@ -148,25 +150,29 @@ if [[ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]]; then fi # Figure out which packages we should be building. -PACKAGES=( chromeos-base/chromeos ) -if [[ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]]; then - PACKAGES+=( chromeos-base/chromeos-dev ) -fi -if [[ "${FLAGS_withfactory}" -eq "${FLAGS_TRUE}" ]]; then - PACKAGES+=( chromeos-base/chromeos-factory ) - PACKAGES+=( chromeos-base/chromeos-factoryinstall ) - PACKAGES+=( chromeos-base/factorytest-init ) - PACKAGES+=( chromeos-base/chromeos-hwid ) -fi -if [[ "${FLAGS_withtest}" -eq "${FLAGS_TRUE}" ]]; then - PACKAGES+=( chromeos-base/chromeos-test ) -fi -if [[ "${FLAGS_withautotest}" -eq "${FLAGS_TRUE}" ]]; then - PACKAGES+=( chromeos-base/autotest-all ) +PACKAGES=( "$@" ) +if [[ $# -eq 0 ]]; then + PACKAGES=( chromeos-base/chromeos ) + if [[ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]]; then + PACKAGES+=( chromeos-base/chromeos-dev ) + fi + if [[ "${FLAGS_withfactory}" -eq "${FLAGS_TRUE}" ]]; then + PACKAGES+=( chromeos-base/chromeos-factory ) + PACKAGES+=( chromeos-base/chromeos-factoryinstall ) + PACKAGES+=( chromeos-base/factorytest-init ) + PACKAGES+=( chromeos-base/chromeos-hwid ) + fi + if [[ "${FLAGS_withtest}" -eq "${FLAGS_TRUE}" ]]; then + PACKAGES+=( chromeos-base/chromeos-test ) + fi + if [[ "${FLAGS_withautotest}" -eq "${FLAGS_TRUE}" ]]; then + PACKAGES+=( chromeos-base/autotest-all ) + fi fi # Verify that all packages can be emerged from scratch, without any # backtracking. Only print the output if this step fails. +info "Checking package dependencies are correct: ${PACKAGES[*]}" if ! OUTPUT=$(emerge-${FLAGS_board} -pe --backtrack=0 ${PACKAGES} 2>&1); then printf "%s\n" "${OUTPUT}" die_notrace "emerge detected broken ebuilds. See error message above." @@ -195,7 +201,7 @@ fi tmpfile=$(mktemp -t tmp.build_packages-emerge.XXXXXX) trap "rm -f '${tmpfile}'" EXIT -info "Merging board packages ${PACKAGES[*]}" +info "Merging board packages now" ( set -o pipefail sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "${PACKAGES[@]}" | \