Skip to content

Commit

Permalink
Restore some of --strict to BuildPackages script
Browse files Browse the repository at this point in the history
#4384

The addition of the --parallel option to the bin/BuildPackages.sh
script unfortunately broke the operation of the --strict option.

This restores the functionality of --strict when --parallel is not used.

I am not 1337 enough to work out how to do catch the error codes
of parallel background processes!
  • Loading branch information
wilfwilson committed Apr 19, 2021
1 parent 01d4593 commit 27c4e1f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/BuildPackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ then
"Type: cd ../pkg; ../bin/BuildPackages.sh"
fi

if [ "x$PARALLEL" = "xyes" ] && [ "x$STRICT" = "xyes" ]; then
error "The options --strict and --parallel cannot be used simultaneously"
fi

if [ "x$PARALLEL" = "xyes" ]; then
export MAKEFLAGS="${MAKEFLAGS:--j3}"
fi;
Expand Down Expand Up @@ -268,7 +272,7 @@ build_one_package() {
date >> "$LOGDIR/fail.log"
for PKG in "${PACKAGES[@]}"
do
(
( # start a background process
# cut off the ending slash (if exists)
PKG="${PKG%/}"
# cut off everything before the first slash to only keep the package name
Expand Down Expand Up @@ -306,6 +310,7 @@ do
warning "$PKG does not seem to be a package directory, skipping"
fi
) &
BUILD_PID=$!
if [ "x$PARALLEL" = "xyes" ]; then
# If more than 4 background jobs are running, wait for one to finish (if
# <wait -n> is available) or for all to finish (if only <wait> is available)
Expand All @@ -314,7 +319,10 @@ do
fi
else
# wait for this package to finish building
wait
if ! wait $BUILD_PID && [[ $STRICT = yes ]]
then
exit 1
fi
fi;
done
# Wait until all packages are built, if in parallel
Expand Down

0 comments on commit 27c4e1f

Please sign in to comment.