Avoid fetching some repos twice

Also enables a nice bit of logic cleanup
This commit is contained in:
ISSOtm
2026-07-02 10:39:59 -04:00
committed by Rangi
parent 04b9c7fa3d
commit 1f9cc9651a
2 changed files with 37 additions and 22 deletions
+18 -3
View File
@@ -17,6 +17,7 @@ EOF
# Parse options in pure Bash because macOS `getopt` is stuck
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
nonfree=true
free=true
actionname=
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -27,6 +28,9 @@ while [[ $# -gt 0 ]]; do
--only-free)
nonfree=false
;;
--only-nonfree)
free=false
;;
--get-hash|--get-paths)
actionname="$1"
;;
@@ -41,6 +45,11 @@ while [[ $# -gt 0 ]]; do
shift
done
if ! "$nonfree" && ! "$free"; then
echo "Specifying --only-nonfree with --only-free is a contradiction"
exit 1
fi
case "$actionname" in
--get-hash)
action() {
@@ -76,8 +85,14 @@ esac
for cfg in *.cfg; do (
# Sourcing "$cfg" defines `EXT_TEST_*` variables that get used by `action`.
. "$cfg"
# Only run a nonfree action if nonfree tests are opted into.
if ! $EXT_TEST_IS_NONFREE || $nonfree; then
action
if $EXT_TEST_IS_NONFREE; then
if $nonfree; then
action
fi
else
if $free; then
action
fi
fi
); done