summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-07-22 08:30:41 +0200
committerDan McGee <dan@archlinux.org>2011-07-27 19:45:06 +0200
commit819f6750047cbdb7ecb7fa4724f90e532cd73446 (patch)
tree6d190756f34bd283791ffb4db84b8cc7ae788eab
parent00949db191d0f31add4919ae56ebdfef9813a90e (diff)
downloadpacman-819f6750047cbdb7ecb7fa4724f90e532cd73446.tar.gz
pacman-819f6750047cbdb7ecb7fa4724f90e532cd73446.tar.xz
makepkg: check overrides for pkgrel and pkgver
Enforce syntax checking for pkgrel and pkgver overrides in package functions. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 96fe4004..da1cec85 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1344,15 +1344,21 @@ check_sanity() {
ret=1
fi
- if [[ $pkgver =~ [[:space:]:-] ]]; then
- error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
- ret=1
- fi
+ awk -F'=' '/^[[:space:]]*pkgver=/ { $1=""; print $0 }' "$BUILDFILE" |
+ while read i _; do
+ if [[ $i =~ [[:space:]:-] ]]; then
+ error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
+ return 1
+ fi
+ done || ret=1
- if [[ $pkgrel =~ [[:space:]-] ]]; then
- error "$(gettext "%s is not allowed to contain hyphens or whitespace.")" "pkgrel"
- ret=1
- fi
+ awk -F'=' '/^[[:space:]]*pkgrel=/ { $1=""; print $0 }' "$BUILDFILE" |
+ while read i _; do
+ if [[ $i =~ [[:space:]-] ]]; then
+ error "$(gettext "%s is not allowed to contain hyphens or whitespace.")" "pkgrel"
+ return 1
+ fi
+ done || ret=1
if [[ ! $epoch =~ ^[0-9]*$ ]]; then
error "$(gettext "%s must be an integer.")" "epoch"