[pacman-dev] [PATCH] makepkg: enable passing PKGBUILD from pipe

Allan McRae allan at archlinux.org
Tue Oct 28 08:07:00 EDT 2008


Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD
from a pipe.  Fixes FS#9187.

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

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 52784b6..f5caa12 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1048,6 +1048,10 @@ devel_check() {
 	if [ "$HOLDVER" = "1" ]; then
 		return
 	fi
+	# Cannot update pkgver/pkgrel if reading PKGBUILD from pipe
+	if [ ! -f "./$BUILDSCRIPT" ]; then
+		return
+	fi
 	if [ "$FORCE_VER" = "" ]; then
 		# Check if this is a svn/cvs/etc PKGBUILD; set $newpkgver if so.
 		# This will only be used on the first call to makepkg; subsequent
@@ -1115,9 +1119,11 @@ devel_update() {
 	#
 	if [ "$newpkgver" != "" ]; then
 		if [ "$newpkgver" != "$pkgver" ]; then
-			sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT
-			sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" ./$BUILDSCRIPT
-			source $BUILDSCRIPT
+			if [ -f "./$BUILDSCRIPT" ]; then
+				sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT
+				sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" ./$BUILDSCRIPT
+				source $BUILDSCRIPT
+			fi
 		fi
 	fi
 }
-- 
1.6.0.3




More information about the pacman-dev mailing list