[pacman-dev] [PATCH] makepkg: set default value for PACKAGER

Allan McRae allan at archlinux.org
Thu Jul 6 03:36:30 UTC 2017


In write_pkginfo, we checked if $PACKAGER was undefined, and gave a default
value if not.  Just do this upfront to simplify this function.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 90f52abe..3c29c2d8 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -622,12 +622,6 @@ write_kv_pair() {
 }
 
 write_pkginfo() {
-	if [[ -n $PACKAGER ]]; then
-		local packager="$PACKAGER"
-	else
-		local packager="Unknown Packager"
-	fi
-
 	local size="$(@DUPATH@ @DUFLAGS@)"
 	size="$(( ${size%%[^0-9]*} * 1024 ))"
 
@@ -651,7 +645,7 @@ write_pkginfo() {
 	write_kv_pair "pkgdesc" "$spd"
 	write_kv_pair "url" "$url"
 	write_kv_pair "builddate" "$SOURCE_DATE_EPOCH"
-	write_kv_pair "packager" "$packager"
+	write_kv_pair "packager" "$PACKAGER"
 	write_kv_pair "size" "$size"
 	write_kv_pair "arch" "$pkgarch"
 
@@ -1430,6 +1424,7 @@ PKGEXT=${_PKGEXT:-$PKGEXT}
 SRCEXT=${_SRCEXT:-$SRCEXT}
 GPGKEY=${_GPGKEY:-$GPGKEY}
 PACKAGER=${_PACKAGER:-$PACKAGER}
+PACKAGER=${PACKAGER:-"Unknown Packager"} #default if undefined
 CARCH=${_CARCH:-$CARCH}
 
 if (( ! INFAKEROOT )); then
-- 
2.13.2


More information about the pacman-dev mailing list