On 17/06/10 22:44, Andres P wrote:
During check_sanity, use regex and abstract the series of variable checks into
a list.
Signed-off-by: Andres P<[email protected]>
---
scripts/makepkg.sh.in | 70 +++++++++++++++++++-----------------------------
1 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 23e3b36..991ad0f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1161,6 +1161,19 @@ install_package() {
fi
}
+var_lint() {
+ local pattern="$1"
+ local directive="$2"
+ shift 2
+
+ local i
+ for i; do
+ [[ $i =~ $pattern ]] || continue
+ error "$(gettext "'%s' is an invalid value for %s")" "$i"
"$directive"
+ return 1
+ done
+}
I am against this as the error messages are no longer informative.
Allan