Skip to content

Commit

Permalink
BuildPackages.sh: add option to abort upon failure
Browse files Browse the repository at this point in the history
With --strict given, BuildPackages.sh immediately aborts with a non-zero
exit code if there are any errors building a package. This way, it can
be used effectively from other scripts, e.g. for package's Travis tests.
  • Loading branch information
fingolfin authored and alex-konovalov committed Dec 13, 2017
1 parent a86e045 commit 36abc90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/BuildPackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fi
CURDIR="$(pwd)"
GAPROOT="$(cd .. && pwd)"
COLORS=yes
STRICT=no # exit with non-zero exit code when encountering any failures
PACKAGES=()

# If output does not go into a terminal (but rather into a log file),
Expand All @@ -44,7 +45,13 @@ while [[ "$#" -ge 1 ]]; do
case "$option" in
--with-gaproot) GAPROOT="$1"; shift ;;
--with-gaproot=*) GAPROOT=${option#--with-gaproot=}; ;;

--no-color) COLORS=no ;;
--color) COLORS=yes ;;

--no-strict) STRICT=no ;;
--strict) STRICT=yes ;;

-*) echo "ERROR: unsupported argument $option" ; exit 1;;
*) PACKAGES+=("$option") ;;
esac
Expand Down Expand Up @@ -183,6 +190,10 @@ build_fail() {
echo ""
warning "Failed to build $PKG"
echo "$PKG" >> "$LOGDIR/fail.log"
if [[ $STRICT = yes ]]
then
exit 1
fi
}

run_configure_and_make() {
Expand Down

0 comments on commit 36abc90

Please sign in to comment.