[pacman-dev] [PATCH 2/2] makepkg: avoid unnecessary local variable

Dave Reisner d at falconindy.com
Wed Mar 14 16:41:11 EDT 2012


Use a simple default value parameter expansion instead of using an
intermediate local variable to write the packager name in write_pkginfo.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 scripts/makepkg.sh.in |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c2941b2..4be17e5 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1151,11 +1151,6 @@ check_license() {
 
 write_pkginfo() {
 	local builddate=$(date -u "+%s")
-	if [[ -n $PACKAGER ]]; then
-		local packager="$PACKAGER"
-	else
-		local packager="Unknown Packager"
-	fi
 	local size="$(@DUPATH@ -sk)"
 	size="$(( ${size%%[^0-9]*} * 1024 ))"
 
@@ -1171,7 +1166,7 @@ write_pkginfo() {
 	echo "pkgdesc = $pkgdesc"
 	echo "url = $url"
 	echo "builddate = $builddate"
-	echo "packager = $packager"
+	echo "packager = ${PACKAGER:-Unknown Packager}"
 	echo "size = $size"
 	echo "arch = $PKGARCH"
 
-- 
1.7.9.4



More information about the pacman-dev mailing list