summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-09-29 22:49:33 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-09-29 22:49:33 (EDT)
commit01e3ee8e47b63c4c4e03d22dabdccfd7c17e1ceb (patch)
treeea76f3f81f7a5855ff91dc39e7eb61429d833ebb
parentc133181e5184b77c8e3e5cf4f1ba9a54ade05c00 (diff)
Simplify wildcard matching in ob_match_arch().
-rw-r--r--lib/metadata.sh24
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/metadata.sh b/lib/metadata.sh
index 687d96a..b33fd0e 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -170,25 +170,15 @@ ob_match_arch()
return ${?}
fi
- # Compile patterns to match hyphenated architectures.
- _obma_a_pat_norm="$(echo "${_obma_a}" | \
- sed 's/^any-/*-/;s/-any-/-*-/g;s/-any$/-*/g')"
- _obma_a_pat_hyph="$(echo "${_obma_a}" | \
- sed 's/^any-/*-*-/;s/-any-/-*-*-/g;s/-any$/-*-*/g')"
+ # Generate an ERE to match hyphenated architectures.
+ _obma_a_ere="$(echo "${_obma_a}" | \
+ sed 's/^any-/[^-]+-/;s/-any-/-[^-]+-/g;s/-any$/-[^-]+/g')"
# "foo-bar-baz" == "foo-any-any"
- case "${_obma_arch}" in
- ${_obma_a_pat_hyph})
- continue
- ;;
- ${_obma_a_pat_norm})
- _ob_return 0
- return ${?}
- ;;
- *)
- continue
- ;;
- esac
+ if echo "${_obma_arch}" | grep -R "${_obma_a_ere}"; then
+ _ob_return 0
+ return ${?}
+ fi
done