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>
This commit is contained in:
Allan McRae 2011-07-22 16:30:41 +10:00 committed by Dan McGee
parent 00949db191
commit 819f675004
1 changed files with 14 additions and 8 deletions

View File

@ -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"