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
|
fi
|
||||||
|
|
||||||
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||||
EMERGE_JOBS="--jobs=${FLAGS_jobs}"
|
EMERGE_FLAGS+=" --jobs=${FLAGS_jobs}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]]; then
|
if [[ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]]; then
|
||||||
@ -132,6 +132,9 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
|||||||
else
|
else
|
||||||
UPDATE_ARGS+=" --nousepkg"
|
UPDATE_ARGS+=" --nousepkg"
|
||||||
fi
|
fi
|
||||||
|
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||||
|
UPDATE_ARGS+=" --jobs=${FLAGS_jobs}"
|
||||||
|
fi
|
||||||
if [ "${FLAGS_skip_toolchain_update}" -eq "${FLAGS_TRUE}" ]; then
|
if [ "${FLAGS_skip_toolchain_update}" -eq "${FLAGS_TRUE}" ]; then
|
||||||
UPDATE_ARGS+=" --skip_toolchain_update"
|
UPDATE_ARGS+=" --skip_toolchain_update"
|
||||||
fi
|
fi
|
||||||
|
@ -370,12 +370,11 @@ function check_flags_only_and_allow_null_arg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Retry an emerge command according to $FLAGS_retries
|
# 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 () {
|
function eretry () {
|
||||||
local i
|
local i
|
||||||
for i in $(seq $FLAGS_retries); do
|
for i in $(seq $FLAGS_retries); do
|
||||||
echo "Retrying $@"
|
echo "Retrying $@"
|
||||||
"$@" $EMERGE_JOBS && return 0
|
"$@" && return 0
|
||||||
done
|
done
|
||||||
"$@" && return 0
|
"$@" && return 0
|
||||||
return 1
|
return 1
|
||||||
|
@ -216,10 +216,6 @@ EOF
|
|||||||
sudo ln -s ../../cache/distfiles/target \
|
sudo ln -s ../../cache/distfiles/target \
|
||||||
"${FLAGS_chroot}/var/lib/portage/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
|
# Add chromite/bin and depot_tools into the path globally; note that the
|
||||||
# chromite wrapper itself might also be found in depot_tools.
|
# chromite wrapper itself might also be found in depot_tools.
|
||||||
# We rely on 'env-update' getting called below.
|
# We rely on 'env-update' getting called below.
|
||||||
@ -464,6 +460,9 @@ if [[ ${FLAGS_fast} -eq ${FLAGS_TRUE} ]]; then
|
|||||||
else
|
else
|
||||||
UPDATE_ARGS+=( --nofast )
|
UPDATE_ARGS+=( --nofast )
|
||||||
fi
|
fi
|
||||||
|
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||||
|
UPDATE_ARGS+=( --jobs=${FLAGS_jobs} )
|
||||||
|
fi
|
||||||
enter_chroot "${CHROOT_TRUNK}/src/scripts/update_chroot" "${UPDATE_ARGS[@]}"
|
enter_chroot "${CHROOT_TRUNK}/src/scripts/update_chroot" "${UPDATE_ARGS[@]}"
|
||||||
|
|
||||||
CHROOT_EXAMPLE_OPT=""
|
CHROOT_EXAMPLE_OPT=""
|
||||||
|
@ -67,6 +67,8 @@ DEFINE_boolean quiet $FLAGS_FALSE \
|
|||||||
"Don't print warnings when board already exists."
|
"Don't print warnings when board already exists."
|
||||||
DEFINE_boolean skip_toolchain_update $FLAGS_FALSE \
|
DEFINE_boolean skip_toolchain_update $FLAGS_FALSE \
|
||||||
"Don't update toolchain automatically."
|
"Don't update toolchain automatically."
|
||||||
|
DEFINE_integer jobs -1 \
|
||||||
|
"How many packages to build in parallel at maximum."
|
||||||
|
|
||||||
# builds wrappers like equery-arm-generic.
|
# builds wrappers like equery-arm-generic.
|
||||||
# args:
|
# args:
|
||||||
@ -459,6 +461,9 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
|||||||
else
|
else
|
||||||
UPDATE_ARGS+=" --nousepkg"
|
UPDATE_ARGS+=" --nousepkg"
|
||||||
fi
|
fi
|
||||||
|
if [[ "${FLAGS_jobs}" -ne -1 ]]; then
|
||||||
|
UPDATE_ARGS+=" --jobs=${FLAGS_jobs}"
|
||||||
|
fi
|
||||||
"${SRC_ROOT}/scripts"/update_chroot ${UPDATE_ARGS}
|
"${SRC_ROOT}/scripts"/update_chroot ${UPDATE_ARGS}
|
||||||
|
|
||||||
get_board_and_variant $FLAGS_board $FLAGS_variant
|
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_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel"
|
||||||
DEFINE_integer retries -1 \
|
DEFINE_integer retries -1 \
|
||||||
"On build failure, the number of times to retry."
|
"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
|
# Parse command line flags
|
||||||
FLAGS "$@" || exit 1
|
FLAGS "$@" || exit 1
|
||||||
@ -56,6 +58,10 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
|
|||||||
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-libs/glibc"
|
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-libs/glibc"
|
||||||
fi
|
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.
|
# Perform an update of hard-host-depends and world in the chroot.
|
||||||
EMERGE_CMD="emerge"
|
EMERGE_CMD="emerge"
|
||||||
if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
|
if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user