summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/metadata.sh28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/metadata.sh b/lib/metadata.sh
index 8ce838d..c2aec99 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -188,7 +188,10 @@ ob_match_arch()
local arch=
local arch_field=
local a=
- local a_ere=
+ local match_arch_rest=
+ local field_arch_rest=
+ local match_arch_part=
+ local field_arch_part=
if [ ${#} -eq 2 ]; then
arch="${1}"
@@ -213,14 +216,23 @@ ob_match_arch()
return 0
fi
- # Generate an ERE to match hyphenated architectures.
- a_ere="$(echo "${a}" | \
- sed 's/^any-/[^-]+-/;s/-any-/-[^-]+-/g;s/-any$/-[^-]+/g')"
-
# "foo-bar-baz" == "foo-any-any"
- if echo "${arch}" | grep -E "${a_ere}" >/dev/null 2>&1; then
- return 0
- fi
+ match_arch_rest="${arch}"
+ field_arch_rest="${a}"
+ while [ -n "${match_arch_rest}" ] && [ -n "${field_arch_rest}" ]
+ do
+ IFS='-' read match_arch_part match_arch_rest <<-EOF
+ ${match_arch_rest}
+ EOF
+ IFS='-' read field_arch_part field_arch_rest <<-EOF
+ ${field_arch_rest}
+ EOF
+ case "${field_arch_part}" in
+ "${match_arch_part}" | 'any') ;;
+ *) continue 2;; # Failed match, go to next arch
+ esac
+ done
+ return 0
done