makepkg: less code repetition for empty variable checking

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andres P 2010-06-17 08:14:46 -04:30 committed by Allan McRae
parent 13748ca052
commit cd042640c6

View file

@ -1156,18 +1156,13 @@ install_package() {
check_sanity() { check_sanity() {
# check for no-no's in the build script # check for no-no's in the build script
if [[ -z $pkgname ]]; then local i
error "$(gettext "%s is not allowed to be empty.")" "pkgname" for i in 'pkgname' 'pkgrel' 'pkgver'; do
return 1 if [[ -z ${!i} ]]; then
fi error "$(gettext "%s is not allowed to be empty.")" "$i"
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 return 1
fi fi
done
local name local name
for name in "${pkgname[@]}"; do for name in "${pkgname[@]}"; do