[pacman-dev] [PATCH 1/2] makepkg: less code rep with single redirection

Andres P aepd87 at gmail.com
Sun May 23 07:20:04 EDT 2010


Signed-off-by: Andres P <aepd87 at gmail.com>
---
 scripts/makepkg.sh.in |   50 ++++++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 1707245..7f27361 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -904,56 +904,56 @@ write_pkginfo() {
 	size="$(( ${size%%[^0-9]*} * 1024 ))"
 
 	msg2 "$(gettext "Generating .PKGINFO file...")"
-	echo "# Generated by makepkg $myver" >.PKGINFO
+	echo "# Generated by makepkg $myver"
 	if (( INFAKEROOT )); then
-		echo "# using $(fakeroot -v)" >>.PKGINFO
-	fi
-	echo "# $(LC_ALL=C date -u)" >>.PKGINFO
-	echo "pkgname = $1" >>.PKGINFO
-	(( SPLITPKG )) && echo pkgbase = $pkgbase >>.PKGINFO
-	echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
-	echo "pkgdesc = $pkgdesc" >>.PKGINFO
-	echo "url = $url" >>.PKGINFO
-	echo "builddate = $builddate" >>.PKGINFO
-	echo "packager = $packager" >>.PKGINFO
-	echo "size = $size" >>.PKGINFO
-	echo "arch = $PKGARCH" >>.PKGINFO
+		echo "# using $(fakeroot -v)"
+	fi
+	echo "# $(LC_ALL=C date -u)"
+	echo "pkgname = $1"
+	(( SPLITPKG )) && echo pkgbase = $pkgbase
+	echo "pkgver = $pkgver-$pkgrel"
+	echo "pkgdesc = $pkgdesc"
+	echo "url = $url"
+	echo "builddate = $builddate"
+	echo "packager = $packager"
+	echo "size = $size"
+	echo "arch = $PKGARCH"
 	if [[ $(check_option force) = "y" ]]; then
-		echo "force = true" >> .PKGINFO
+		echo "force = true"
 	fi
 
 	local it
 	for it in "${license[@]}"; do
-		echo "license = $it" >>.PKGINFO
+		echo "license = $it"
 	done
 	for it in "${replaces[@]}"; do
-		echo "replaces = $it" >>.PKGINFO
+		echo "replaces = $it"
 	done
 	for it in "${groups[@]}"; do
-		echo "group = $it" >>.PKGINFO
+		echo "group = $it"
 	done
 	for it in "${depends[@]}"; do
-		echo "depend = $it" >>.PKGINFO
+		echo "depend = $it"
 	done
 	for it in "${optdepends[@]}"; do
-		echo "optdepend = $it" >>.PKGINFO
+		echo "optdepend = $it"
 	done
 	for it in "${conflicts[@]}"; do
-		echo "conflict = $it" >>.PKGINFO
+		echo "conflict = $it"
 	done
 	for it in "${provides[@]}"; do
-		echo "provides = $it" >>.PKGINFO
+		echo "provides = $it"
 	done
 	for it in "${backup[@]}"; do
-		echo "backup = $it" >>.PKGINFO
+		echo "backup = $it"
 	done
 	for it in "${packaging_options[@]}"; do
 		local ret="$(check_option $it)"
 		if [[ $ret != "?" ]]; then
 			if [[ $ret = y ]]; then
-				echo "makepkgopt = $it" >>.PKGINFO
+				echo "makepkgopt = $it"
 			else
-				echo "makepkgopt = !$it" >>.PKGINFO
+				echo "makepkgopt = !$it"
 			fi
 		fi
 	done
@@ -964,7 +964,7 @@ write_pkginfo() {
 		warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT"
 		plain "$(gettext "Example for GPL\'ed software: license=('GPL').")"
 	fi
-}
+} > .PKGINFO
 
 check_package() {
 	cd "$pkgdir"
-- 
1.7.1



More information about the pacman-dev mailing list