From 5a42bd8565207627314dcee813e78aca8926ff3e Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:16:28 -0800 Subject: [PATCH 1/8] setup_board: cleanup flags section Move most flags into the usage message and use a more consistent style. --- setup_board | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/setup_board b/setup_board index 725901954f..aa2a1e5d42 100755 --- a/setup_board +++ b/setup_board @@ -13,14 +13,26 @@ restart_in_chroot_if_needed "$@" assert_not_root_user # Developer-visible flags. -DEFINE_string board "$DEFAULT_BOARD" \ +DEFINE_string board "${DEFAULT_BOARD}" \ "The name of the board to set up." -DEFINE_boolean default $FLAGS_FALSE \ +DEFINE_boolean default "${FLAGS_FALSE}" \ "Set board to the default board in your chroot" -DEFINE_boolean force $FLAGS_FALSE \ +DEFINE_boolean force "${FLAGS_FALSE}" \ "Force re-creating board root." -DEFINE_boolean usepkg $FLAGS_TRUE \ - "Use binary packages to bootstrap." +DEFINE_boolean usepkg "${FLAGS_TRUE}" \ + "Use binary packages when possible." +DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ + "Download binary packages from remote repository." +DEFINE_string getbinpkgver "" \ + "Use binary packages from a specific version." +DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \ + "Use binary packages only for the board toolchain." +DEFINE_integer jobs "${NUM_JOBS}" \ + "How many packages to build in parallel at maximum." +DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ + "Don't update toolchain automatically." +DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \ + "Don't run the chroot upgrade automatically; use with care." FLAGS_HELP="usage: $(basename $0) [flags] @@ -33,26 +45,14 @@ show_help_if_requested "$@" # The following options are advanced options, only available to those willing # to read the source code. They are not shown in help output, since they are # not needed for the typical developer workflow. -DEFINE_string getbinpkgver "" \ - "Use binary packages from a specific version." -DEFINE_boolean toolchainpkgonly $FLAGS_FALSE \ - "Use binary packages only for the board toolchain." -DEFINE_integer jobs "${NUM_JOBS}" \ - "How many packages to build in parallel at maximum." DEFINE_string libc_version "[stable]" \ "Version of libc to use." DEFINE_boolean quiet $FLAGS_FALSE \ "Don't print warnings when board already exists." -DEFINE_boolean skip_toolchain_update $FLAGS_FALSE \ - "Don't update toolchain automatically." -DEFINE_boolean skip_chroot_upgrade $FLAGS_FALSE \ - "Don't run the chroot upgrade automatically; use with care." DEFINE_string variant "" \ "Board variant." DEFINE_boolean regen_configs ${FLAGS_FALSE} \ "Regenerate all config files (useful for modifying profiles w/out rebuild)." -DEFINE_boolean getbinpkg $FLAGS_TRUE \ - "Passed to update_chroot, ignored by setup_board itself." # builds wrappers like equery-arm-generic. From 602412fd2af4e31cce8a0c1fb30a5ebcbb656d14 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:23:20 -0800 Subject: [PATCH 2/8] build_packages: remove unused --accept_licenses This flag was dropped from setup_board way back in commit 7d6619df8. --- build_packages | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build_packages b/build_packages index 23722d68dd..8369b5ba82 100755 --- a/build_packages +++ b/build_packages @@ -45,8 +45,6 @@ DEFINE_string getbinpkgver "" \ "Use binary packages from a specific version." DEFINE_boolean toolchainpkgonly $FLAGS_FALSE \ "Use binary packages only for the board toolchain." -DEFINE_string accept_licenses "" \ - "Licenses to append to the accept list." DEFINE_integer jobs "${NUM_JOBS}" \ "How many packages to build in parallel at maximum." DEFINE_boolean rebuild "${FLAGS_FALSE}" \ @@ -82,9 +80,6 @@ CHROMITE_BIN="${GCLIENT_ROOT}/chromite/bin" # Before we can run any tools, we need to update chroot or setup_board. UPDATE_ARGS=( --regen_configs ) -if [[ -n ${FLAGS_accept_licenses} ]]; then - UPDATE_ARGS+=( --accept_licenses "${FLAGS_accept_licenses}" ) -fi if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then UPDATE_ARGS+=( --usepkg ) if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then From 10a7864ff09e30bf4bafeb4a705fd5a5c038f965 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:26:20 -0800 Subject: [PATCH 3/8] build_packages: flip weird inverted boolean flag Use `--workon` and `--noworkon` instead of `--nonoworkon` and `--noworkon` --- build_packages | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_packages b/build_packages index 8369b5ba82..ccc5565622 100755 --- a/build_packages +++ b/build_packages @@ -18,8 +18,8 @@ DEFINE_boolean usepkg "${FLAGS_TRUE}" \ "Use binary packages to bootstrap when possible." DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." -DEFINE_boolean noworkon "${FLAGS_FALSE}" \ - "Don't force-build workon packages." +DEFINE_boolean workon "${FLAGS_TRUE}" \ + "Automatically rebuild updated cros-workon packages." DEFINE_boolean fetchonly "${FLAGS_FALSE}" \ "Don't build anything, instead only fetch what is needed." @@ -154,7 +154,7 @@ fi # Build cros_workon packages when they are changed. CROS_WORKON_PKGS=() -if [ "${FLAGS_noworkon}" -eq "${FLAGS_FALSE}" ]; then +if [ "${FLAGS_workon}" -eq "${FLAGS_TRUE}" ]; then LIST_MODIFIED_PACKAGES="${CHROMITE_BIN}/cros_list_modified_packages" CROS_WORKON_PKGS+=( $("${LIST_MODIFIED_PACKAGES}" --board=${FLAGS_board}) ) fi From bf104d415e79f4e303957745c0b82650d5f1c8d8 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:30:10 -0800 Subject: [PATCH 4/8] build_packages: remove old --reuse_pkgs_from_local_boards flag Removed from setup_board in ancient times e6b3c608. --- build_packages | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/build_packages b/build_packages index ccc5565622..8e05c9b485 100755 --- a/build_packages +++ b/build_packages @@ -54,14 +54,6 @@ DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \ DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ "Don't update toolchain automatically." -# The --reuse_pkgs_from_local_boards flag tells Portage to share binary -# packages between boards that are built locally, so that the total time -# required to build several boards is reduced. This flag is only useful -# when you are not able to use remote binary packages, since remote binary -# packages are usually more up to date than anything you have locally. -DEFINE_boolean reuse_pkgs_from_local_boards $FLAGS_FALSE \ - "Bootstrap from local packages instead of remote packages." - # Parse command line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" @@ -101,9 +93,6 @@ fi if [[ "${FLAGS_jobs}" -ne -1 ]]; then UPDATE_ARGS+=( --jobs=${FLAGS_jobs} ) fi -if [ "${FLAGS_reuse_pkgs_from_local_boards}" -eq "${FLAGS_TRUE}" ]; then - UPDATE_ARGS+=( --reuse_pkgs_from_local_boards ) -fi if [ "${FLAGS_skip_toolchain_update}" -eq "${FLAGS_TRUE}" ]; then UPDATE_ARGS+=( --skip_toolchain_update ) fi @@ -128,8 +117,7 @@ fi EMERGE_CMD+=( ${EXTRA_BOARD_FLAGS} ) -if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" || - "${FLAGS_reuse_pkgs_from_local_boards}" -eq "${FLAGS_TRUE}" ]]; then +if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]]; then # Use binary packages. Include all build-time dependencies, # so as to avoid unnecessary differences between source # and binary builds. From a42ffcddbbf928d76e751b2f746fed7acf497486 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:34:32 -0800 Subject: [PATCH 5/8] build_packages: include all flags in usage message --- build_packages | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/build_packages b/build_packages index 8e05c9b485..a2820fdf40 100755 --- a/build_packages +++ b/build_packages @@ -15,13 +15,25 @@ assert_not_root_user DEFINE_string board "${DEFAULT_BOARD}" \ "The board to build packages for." DEFINE_boolean usepkg "${FLAGS_TRUE}" \ - "Use binary packages to bootstrap when possible." + "Use binary packages when possible." DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." +DEFINE_string getbinpkgver "" \ + "Use binary packages from a specific version." +DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \ + "Use binary packages only for the board toolchain." DEFINE_boolean workon "${FLAGS_TRUE}" \ "Automatically rebuild updated cros-workon packages." DEFINE_boolean fetchonly "${FLAGS_FALSE}" \ "Don't build anything, instead only fetch what is needed." +DEFINE_integer jobs "${NUM_JOBS}" \ + "How many packages to build in parallel at maximum." +DEFINE_boolean rebuild "${FLAGS_FALSE}" \ + "Automatically rebuild dependencies." +DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ + "Don't update toolchain automatically." +DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \ + "Don't run the chroot upgrade automatically; use with care." # include upload options . "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1 @@ -36,23 +48,6 @@ up by the build_image script to put together a bootable CoreOS image. If [packages] are specified, only build those specific packages (and any dependencies they might need). " -show_help_if_requested "$@" - -# The following options are advanced options, only available to those willing -# to read the source code. They are not shown in help output, since they are -# not needed for the typical developer workflow. -DEFINE_string getbinpkgver "" \ - "Use binary packages from a specific version." -DEFINE_boolean toolchainpkgonly $FLAGS_FALSE \ - "Use binary packages only for the board toolchain." -DEFINE_integer jobs "${NUM_JOBS}" \ - "How many packages to build in parallel at maximum." -DEFINE_boolean rebuild "${FLAGS_FALSE}" \ - "Don't automatically rebuild dependencies." -DEFINE_boolean skip_chroot_upgrade "${FLAGS_FALSE}" \ - "Don't run the chroot upgrade automatically; use with care." -DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ - "Don't update toolchain automatically." # Parse command line FLAGS "$@" || exit 1 From 81ee5389c04b655de738fbeed773f595d1932f55 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 17:43:11 -0800 Subject: [PATCH 6/8] build_packages: accept package names as an argument --- build_packages | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build_packages b/build_packages index a2820fdf40..7fda96034f 100755 --- a/build_packages +++ b/build_packages @@ -56,6 +56,12 @@ eval set -- "${FLAGS_ARGV}" # Die on any errors. switch_to_strict_mode +# TODO(marineam): specify the default top-level ebuild in the portage profile. +# I could have sworn we did that or similar but maybe got lost at some point. +if [[ $# -eq 0 ]]; then + set -- @system coreos-devel/board-packages +fi + if [[ -z "${FLAGS_board}" ]]; then echo "Error: --board is required." exit 1 @@ -200,8 +206,7 @@ break_dep_loop sys-apps/util-linux udev,systemd sys-apps/systemd cryptsetup break_dep_loop sys-apps/systemd cryptsetup info "Merging board packages now" -sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" \ - @system coreos-devel/board-packages +sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "$@" info "Removing obsolete packages" sudo -E "${EMERGE_CMD[@]}" --quiet --depclean @unavailable From a3fceb195758d7cce78f1ee3923831c4826a0c87 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 18:10:00 -0800 Subject: [PATCH 7/8] update_chroot: cleanup flags, include all in usage --- update_chroot | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/update_chroot b/update_chroot index ca3bfa4163..665e22a82e 100755 --- a/update_chroot +++ b/update_chroot @@ -13,27 +13,21 @@ assert_inside_chroot "$@" # Do not run as root assert_not_root_user -# Developer-visible flags. -DEFINE_boolean usepkg $FLAGS_TRUE \ - "Use binary packages to bootstrap." -DEFINE_boolean getbinpkg $FLAGS_TRUE \ +DEFINE_boolean usepkg "${FLAGS_TRUE}" \ + "Use binary packages when possible." +DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." +DEFINE_integer jobs "${NUM_JOBS}" \ + "How many packages to build in parallel at maximum." +DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ + "Don't update the toolchains." +DEFINE_string toolchain_boards "" \ + "Extra toolchains to setup for the specified boards." FLAGS_HELP="usage: $(basename $0) [flags] Performs an update of the chroot. This script is called as part of build_packages, so there is typically no need to call this script directly. " -show_help_if_requested "$@" - -# The following options are advanced options, only available to those willing -# to read the source code. They are not shown in help output, since they are -# not needed for the typical developer workflow. -DEFINE_integer jobs "${NUM_JOBS}" \ - "How many packages to build in parallel at maximum." -DEFINE_boolean skip_toolchain_update $FLAGS_FALSE \ - "Don't update the toolchains." -DEFINE_string toolchain_boards "" \ - "Extra toolchains to setup for the specified boards." # Parse command line flags FLAGS "$@" || exit 1 From d327840ce827dd327f3dd3b139dbf5c5ed5b11fb Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 3 Feb 2016 18:20:37 -0800 Subject: [PATCH 8/8] *: add --usepkgonly flag to avoid building from source --- build_packages | 52 ++++++++++++++++++++++++++++++++++++++------------ setup_board | 23 +++++++++++++++++++++- update_chroot | 25 +++++++++++++++++++++--- 3 files changed, 84 insertions(+), 16 deletions(-) diff --git a/build_packages b/build_packages index 7fda96034f..39f8b8a914 100755 --- a/build_packages +++ b/build_packages @@ -16,6 +16,8 @@ DEFINE_string board "${DEFAULT_BOARD}" \ "The board to build packages for." DEFINE_boolean usepkg "${FLAGS_TRUE}" \ "Use binary packages when possible." +DEFINE_boolean usepkgonly "${FLAGS_FALSE}" \ + "Only use/download binary packages. Implies --noworkon" DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." DEFINE_string getbinpkgver "" \ @@ -67,6 +69,19 @@ if [[ -z "${FLAGS_board}" ]]; then exit 1 fi +if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + for flag in usepkg getbinpkg; do + fvar="FLAGS_${flag}" + if [[ "${!fvar}" -ne "${FLAGS_TRUE}" ]]; then + die_notrace "--usepkgonly is incompatible with --no${flag}" + fi + done + if [[ "${FLAGS_rebuild}" -eq "${FLAGS_TRUE}" ]]; then + die_notrace "--usepkgonly is incompatible with --rebuild" + fi + FLAGS_workon="${FLAGS_FALSE}" +fi + check_gsutil_opts CHROMITE_BIN="${GCLIENT_ROOT}/chromite/bin" @@ -75,6 +90,11 @@ CHROMITE_BIN="${GCLIENT_ROOT}/chromite/bin" UPDATE_ARGS=( --regen_configs ) if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then UPDATE_ARGS+=( --usepkg ) + if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + UPDATE_ARGS+=( --usepkgonly ) + else + UPDATE_ARGS+=( --nousepkgonly ) + fi if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then UPDATE_ARGS+=( --getbinpkg ) else @@ -121,15 +141,19 @@ EMERGE_CMD+=( ${EXTRA_BOARD_FLAGS} ) if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]]; then # Use binary packages. Include all build-time dependencies, # so as to avoid unnecessary differences between source - # and binary builds. - EMERGE_FLAGS+=( --usepkg --with-bdeps y ) + # and binary builds except for --usepkgonly for speed. + if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + EMERGE_FLAGS+=( --usepkgonly ) + else + EMERGE_FLAGS+=( --usepkg --with-bdeps y ) + + # Only update toolchain when binpkgs are available. + EMERGE_FLAGS+=( $(get_binonly_args) ) + REBUILD_FLAGS+=( $(get_binonly_args) ) + fi if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then EMERGE_FLAGS+=( --getbinpkg ) fi - - # Only update toolchain when binpkgs are available. - EMERGE_FLAGS+=( $(get_binonly_args) ) - REBUILD_FLAGS+=( $(get_binonly_args) ) fi if [[ "${FLAGS_jobs}" -ne -1 ]]; then @@ -199,11 +223,13 @@ break_dep_loop() { sudo rm -f "${flag_file}" } -# util-linux[udev] -> virtual->udev -> systemd -> util-linux -break_dep_loop sys-apps/util-linux udev,systemd sys-apps/systemd cryptsetup +if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_FALSE}" ]]; then + # util-linux[udev] -> virtual->udev -> systemd -> util-linux + break_dep_loop sys-apps/util-linux udev,systemd sys-apps/systemd cryptsetup -# systemd[cryptsetup] -> cryptsetup -> lvm2 -> virtual/udev -> systemd -break_dep_loop sys-apps/systemd cryptsetup + # systemd[cryptsetup] -> cryptsetup -> lvm2 -> virtual/udev -> systemd + break_dep_loop sys-apps/systemd cryptsetup +fi info "Merging board packages now" sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "$@" @@ -211,8 +237,10 @@ sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "$@" info "Removing obsolete packages" sudo -E "${EMERGE_CMD[@]}" --quiet --depclean @unavailable -if "portageq-${BOARD}" list_preserved_libs "${BOARD_ROOT}" >/dev/null; then - sudo -E "${EMERGE_CMD[@]}" "${REBUILD_FLAGS[@]}" @preserved-rebuild +if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + if "portageq-${BOARD}" list_preserved_libs "${BOARD_ROOT}" >/dev/null; then + sudo -E "${EMERGE_CMD[@]}" "${REBUILD_FLAGS[@]}" @preserved-rebuild + fi fi info "Checking build root" diff --git a/setup_board b/setup_board index aa2a1e5d42..c10ca694e6 100755 --- a/setup_board +++ b/setup_board @@ -21,6 +21,8 @@ DEFINE_boolean force "${FLAGS_FALSE}" \ "Force re-creating board root." DEFINE_boolean usepkg "${FLAGS_TRUE}" \ "Use binary packages when possible." +DEFINE_boolean usepkgonly "${FLAGS_FALSE}" \ + "Only use/download binary packages." DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." DEFINE_string getbinpkgver "" \ @@ -135,12 +137,26 @@ if [ -z "$FLAGS_board" ] ; then exit 1 fi +if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + for flag in usepkg getbinpkg; do + fvar="FLAGS_${flag}" + if [[ "${!fvar}" -ne "${FLAGS_TRUE}" ]]; then + die_notrace "--usepkgonly is incompatible with --no${flag}" + fi + done +fi + get_board_and_variant $FLAGS_board $FLAGS_variant # Before we can run any tools, we need to update chroot UPDATE_ARGS="--toolchain_boards=${BOARD}" if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then UPDATE_ARGS+=" --usepkg" + if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + UPDATE_ARGS+=" --usepkgonly" + else + UPDATE_ARGS+=" --usepkgonly" + fi if [[ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]]; then UPDATE_ARGS+=" --getbinpkg " else @@ -284,7 +300,12 @@ if [[ ${FLAGS_regen_configs} -eq ${FLAGS_FALSE} ]]; then if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" && \ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]] then - EMERGE_FLAGS+=" --usepkg --getbinpkg" + if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + EMERGE_FLAGS+=" --usepkgonly" + else + EMERGE_FLAGS+=" --usepkg" + fi + EMERGE_FLAGS+=" --getbinpkg" EMERGE_TOOLCHAIN_FLAGS+=" --usepkgonly --getbinpkg" else # When binary packages are disabled we need to make sure the cross diff --git a/update_chroot b/update_chroot index 665e22a82e..d0a9b35af2 100755 --- a/update_chroot +++ b/update_chroot @@ -17,6 +17,10 @@ DEFINE_boolean usepkg "${FLAGS_TRUE}" \ "Use binary packages when possible." DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ "Download binary packages from remote repository." +DEFINE_boolean usepkgonly "${FLAGS_FALSE}" \ + "Only use/download binary packages. Implies --noworkon" +DEFINE_boolean workon "${FLAGS_TRUE}" \ + "Automatically rebuild updated cros-workon packages." DEFINE_integer jobs "${NUM_JOBS}" \ "How many packages to build in parallel at maximum." DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ @@ -37,6 +41,16 @@ eval set -- "${FLAGS_ARGV}" # so will die prematurely if 'switch_to_strict_mode' is specified before now. switch_to_strict_mode +if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + for flag in usepkg getbinpkg; do + fvar="FLAGS_${flag}" + if [[ "${!fvar}" -ne "${FLAGS_TRUE}" ]]; then + die_notrace "--usepkgonly is incompatible with --no${flag}" + fi + done + FLAGS_workon="${FLAGS_FALSE}" +fi + . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" PORTAGE_STABLE_OVERLAY="${REPO_ROOT}/src/third_party/portage-stable" @@ -166,6 +180,9 @@ EMERGE_FLAGS="-uNv --with-bdeps=y --select" REBUILD_FLAGS="" if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then EMERGE_FLAGS="${EMERGE_FLAGS} --usepkg" + if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_TRUE}" ]]; then + EMERGE_FLAGS+=" --usepkgonly" + fi if [ "${FLAGS_getbinpkg}" -eq "${FLAGS_TRUE}" ]; then EMERGE_FLAGS="${EMERGE_FLAGS} --getbinpkg" fi @@ -210,9 +227,11 @@ fi # Build cros_workon packages when they are changed. CHROMITE_BIN="${GCLIENT_ROOT}/chromite/bin" -for pkg in $("${CHROMITE_BIN}/cros_list_modified_packages" --host); do - EMERGE_FLAGS+=" --reinstall-atoms=${pkg} --usepkg-exclude=${pkg}" -done +if [ "${FLAGS_workon}" -eq "${FLAGS_TRUE}" ]; then + for pkg in $("${CHROMITE_BIN}/cros_list_modified_packages" --host); do + EMERGE_FLAGS+=" --reinstall-atoms=${pkg} --usepkg-exclude=${pkg}" + done +fi # Second pass, update everything else. EMERGE_FLAGS+=" --deep"