summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres P <aepd87@gmail.com>2010-06-17 14:44:46 +0200
committerAllan McRae <allan@archlinux.org>2010-06-20 17:04:57 +0200
commitcd042640c66e73f3fe4f5299a36e4cca5384b34b (patch)
treecf8ab6345d7cc1b6243017741c012a5a1bb6d423
parent13748ca052975cbf6354cfc4554f49a3d8ff46fe (diff)
downloadpacman-cd042640c66e73f3fe4f5299a36e4cca5384b34b.tar.gz
pacman-cd042640c66e73f3fe4f5299a36e4cca5384b34b.tar.xz
makepkg: less code repetition for empty variable checking
Signed-off-by: Andres P <aepd87@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in19
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 28c7879e..ab5ffab7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1156,18 +1156,13 @@ install_package() {
check_sanity() {
# check for no-no's in the build script
- if [[ -z $pkgname ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgname"
- return 1
- fi
- if [[ -z $pkgver ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgver"
- return 1
- fi
- if [[ -z $pkgrel ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
- return 1
- fi
+ local i
+ for i in 'pkgname' 'pkgrel' 'pkgver'; do
+ if [[ -z ${!i} ]]; then
+ error "$(gettext "%s is not allowed to be empty.")" "$i"
+ return 1
+ fi
+ done
local name
for name in "${pkgname[@]}"; do