From 905ae640cfb0787e9bdfbcacf21c62e64cc27512 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 6 Sep 2011 14:40:29 -0400 Subject: 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 --- scripts/makepkg.sh.in | 12 ++++++------ 1 file 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" -- cgit v1.2.3-24-g4f1b