Skip to content

Commit 112a1ee

Browse files
committed
different matching for variants/libs
1 parent bf71800 commit 112a1ee

File tree

4 files changed

+36
-40
lines changed

4 files changed

+36
-40
lines changed

local-libs.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
* -
2-
* *
31
5.6.2 -
2+
* *

per-local-lib

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,34 @@ bare_version="${perl_version/-*/}"
55
local_lib="${1/*@/}"
66
[ "$local_lib" == "$1" ] && unset local_lib
77
shift
8+
cmd="$1"
9+
shift
810

911
declare -a local_libs
10-
declare -a defaults
11-
declare -a all_local_libs
12-
13-
all_local_libs=($(cat $HELPER_ROOT/share/local-libs.txt | awk '{ print $1 }' | sort -u))
12+
declare -a all_local_libs=($(cat $HELPER_ROOT/share/local-libs.txt | awk '{ print $1 }' | grep -v -x travis | sort -u))
1413

1514
if [ -n "$local_lib" ]; then
1615
local_libs=("$local_lib")
1716
else
17+
found=''
1818
while read version ll; do
19-
declare -a libs
20-
if [ "$ll" == "*" ]; then
21-
libs=("${all_local_libs[@]}")
22-
elif [ "$ll" == '-' ]; then
23-
libs=('')
24-
else
25-
libs=("$ll")
26-
fi
19+
if [ -n "$found" ] && [ "$found" != "$version" ]; then
20+
true
21+
elif [[ "$bare_version" = $version ]]; then
22+
found="$version"
2723

28-
if [ "$version" == "*" ]; then
29-
default_local_libs+=("${libs[@]}")
30-
elif [ "$version" == "$bare_version" ]; then
31-
local_libs+=("${libs[@]}")
24+
if [ "$ll" == "*" ]; then
25+
local_libs+=("${all_local_libs[@]}")
26+
elif [ "$ll" == '-' ]; then
27+
local_libs+=('')
28+
else
29+
local_libs+=("$ll")
30+
fi
3231
fi
3332
done < local-libs.txt
3433
fi
3534

36-
if [ "${#local_libs[@]}" == "0" ]; then
37-
local_libs=("${default_local_libs[@]}")
38-
fi
39-
4035
for ll in "${local_libs[@]}"; do
4136
[ -n "$ll" ] && ll="@$ll"
42-
"$@" "$perl_version$ll"
37+
"$cmd" "$perl_version$ll" "$@"
4338
done

per-variant

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ bare_version="${perl_version/-*/}"
55
local_lib="${1/*@/}"
66
[ "$local_lib" == "$1" ] && unset local_lib
77
shift
8+
cmd="$1"
9+
shift
810

911
declare -a variants
1012

1113
if [ "$bare_version" != "$perl_version" ]; then
1214
variants=("$perl_version")
1315
else
14-
declare -a defaults
16+
found=''
1517
while read version variant; do
16-
full="$perl_version"
17-
if [ "$variant" != "-" ]; then
18-
full+="-$variant"
19-
fi
20-
if [ "$version" == "*" ]; then
21-
defaults+=("$full")
22-
elif [ "$version" == "$perl_version" ]; then
23-
variants+=("$full")
18+
if [ -n "$found" ] && [ "$found" != "$version" ]; then
19+
true
20+
elif [[ "$bare_version" = $version ]]; then
21+
found="$version"
22+
23+
if [ "$variant" == "-" ]; then
24+
variants+=("$perl_version")
25+
else
26+
variants+=("$perl_version-$variant")
27+
fi
2428
fi
2529
done < variants.txt
26-
27-
if [ "${#variants[@]}" == "0" ]; then
28-
variants=("${defaults[@]}")
29-
fi
3030
fi
3131

3232
for variant in "${variants[@]}"; do
33-
"$@" "$variant"
33+
"$cmd" "$variant" "$@"
3434
done

variants.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
* -
2-
* thr
3-
5.6.2 -
1+
5.6.2 -
2+
5.[0-9] -
3+
5.[0-9][0-9] -
4+
* -
5+
* thr

0 commit comments

Comments
 (0)