diff options
author | Dave Reisner <dreisner@archlinux.org> | 2011-09-06 14:40:29 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-07 21:05:05 -0500 |
commit | 905ae640cfb0787e9bdfbcacf21c62e64cc27512 (patch) | |
tree | e0b8c3f0b20e6d3c68be10168a74760598e9cc6d | |
parent | 4ed12aec30be0a36fff2937039c904526aeb3b79 (diff) |
makepkg: use more awk'ish syntax in sanity checks
This simplifies the flow a bit, making the pipeline a little easier to
grok.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 881b6f5e..5981603b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1448,8 +1448,8 @@ check_sanity() { ret=1 fi - awk -F'=' '/^[[:space:]]*pkgver=/ { $1=""; print $0 }' "$BUILDFILE" | - while read -r i; do + awk -F'=' '$1 ~ /^[[:space:]]*pkgver$/' "$BUILDFILE" | + while IFS='=' read -r _ i; do eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$i")\" if [[ $i = *[[:space:]:-]* ]]; then error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver" @@ -1457,8 +1457,8 @@ check_sanity() { fi done || ret=1 - awk -F'=' '/^[[:space:]]*pkgrel=/ { $1=""; print $0 }' "$BUILDFILE" | - while read -r i; do + awk -F'=' '$1 ~ /^[[:space:]]*pkgrel$/' "$BUILDFILE" | + while IFS='=' read -r _ i; do eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$i")\" if [[ $i = *[[:space:]-]* ]]; then error "$(gettext "%s is not allowed to contain hyphens or whitespace.")" "pkgrel" @@ -1466,8 +1466,8 @@ check_sanity() { fi done || ret=1 - awk -F'=' '/^[[:space:]]*epoch=/ { $1=""; print $0 }' "$BUILDFILE" | - while read -r i; do + awk -F'=' '$1 ~ /^[[:space:]]*epoch$/' "$BUILDFILE" | + while IFS='=' read -r _ i; do eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$i")\" if [[ $i != *([[:digit:]]) ]]; then error "$(gettext "%s must be an integer.")" "epoch" |