mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
Fix --jobs flags to actually work.
The --jobs=<n> option wasn't actually being passed to parallel_emerge -- which meant it didn't do anything. BUG=chromium-os:26827 TEST=Ran with --jobs=N and made sure only N parallel_emerge processes were started. Change-Id: I581fc5588b54e246acaefd0c7e528e55adf9ba8a Reviewed-on: https://gerrit.chromium.org/gerrit/16570 Reviewed-by: Michael Krebs <mkrebs@chromium.org> Commit-Ready: David James <davidjames@chromium.org> Tested-by: David James <davidjames@chromium.org>
This commit is contained in:
parent
a973d2bdb4
commit
184e39019d
@ -111,7 +111,7 @@ if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||
EMERGE_JOBS="--jobs=${FLAGS_jobs}"
|
||||
EMERGE_FLAGS+=" --jobs=${FLAGS_jobs}"
|
||||
fi
|
||||
|
||||
if [[ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]]; then
|
||||
@ -132,6 +132,9 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
||||
else
|
||||
UPDATE_ARGS+=" --nousepkg"
|
||||
fi
|
||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||
UPDATE_ARGS+=" --jobs=${FLAGS_jobs}"
|
||||
fi
|
||||
if [ "${FLAGS_skip_toolchain_update}" -eq "${FLAGS_TRUE}" ]; then
|
||||
UPDATE_ARGS+=" --skip_toolchain_update"
|
||||
fi
|
||||
|
@ -370,12 +370,11 @@ function check_flags_only_and_allow_null_arg {
|
||||
}
|
||||
|
||||
# Retry an emerge command according to $FLAGS_retries
|
||||
# The $EMERGE_JOBS flags will only be added the first time the command is run
|
||||
function eretry () {
|
||||
local i
|
||||
for i in $(seq $FLAGS_retries); do
|
||||
echo "Retrying $@"
|
||||
"$@" $EMERGE_JOBS && return 0
|
||||
"$@" && return 0
|
||||
done
|
||||
"$@" && return 0
|
||||
return 1
|
||||
|
@ -216,10 +216,6 @@ EOF
|
||||
sudo ln -s ../../cache/distfiles/target \
|
||||
"${FLAGS_chroot}/var/lib/portage/distfiles-target"
|
||||
|
||||
if [[ $FLAGS_jobs -ne -1 ]]; then
|
||||
EMERGE_JOBS="--jobs=$FLAGS_jobs"
|
||||
fi
|
||||
|
||||
# Add chromite/bin and depot_tools into the path globally; note that the
|
||||
# chromite wrapper itself might also be found in depot_tools.
|
||||
# We rely on 'env-update' getting called below.
|
||||
@ -464,6 +460,9 @@ if [[ ${FLAGS_fast} -eq ${FLAGS_TRUE} ]]; then
|
||||
else
|
||||
UPDATE_ARGS+=( --nofast )
|
||||
fi
|
||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||
UPDATE_ARGS+=( --jobs=${FLAGS_jobs} )
|
||||
fi
|
||||
enter_chroot "${CHROOT_TRUNK}/src/scripts/update_chroot" "${UPDATE_ARGS[@]}"
|
||||
|
||||
CHROOT_EXAMPLE_OPT=""
|
||||
|
@ -67,6 +67,8 @@ 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_integer jobs -1 \
|
||||
"How many packages to build in parallel at maximum."
|
||||
|
||||
# builds wrappers like equery-arm-generic.
|
||||
# args:
|
||||
@ -459,6 +461,9 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
||||
else
|
||||
UPDATE_ARGS+=" --nousepkg"
|
||||
fi
|
||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||
UPDATE_ARGS+=" --jobs=${FLAGS_jobs}"
|
||||
fi
|
||||
"${SRC_ROOT}/scripts"/update_chroot ${UPDATE_ARGS}
|
||||
|
||||
get_board_and_variant $FLAGS_board $FLAGS_variant
|
||||
|
@ -23,6 +23,8 @@ DEFINE_boolean usepkg $FLAGS_TRUE \
|
||||
DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel"
|
||||
DEFINE_integer retries -1 \
|
||||
"On build failure, the number of times to retry."
|
||||
DEFINE_integer jobs -1 \
|
||||
"How many packages to build in parallel at maximum."
|
||||
|
||||
# Parse command line flags
|
||||
FLAGS "$@" || exit 1
|
||||
@ -56,6 +58,10 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
||||
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-libs/glibc"
|
||||
fi
|
||||
|
||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||
EMERGE_FLAGS+=" --jobs=${FLAGS_jobs}"
|
||||
fi
|
||||
|
||||
# Perform an update of hard-host-depends and world in the chroot.
|
||||
EMERGE_CMD="emerge"
|
||||
if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user