[pacman-dev] [PATCH 3/3] makepkg: complain when the buildfile isn't writeable

Dave Reisner d at falconindy.com
Tue Feb 14 13:58:00 EST 2012


If the PKGBUILD isn't writeable for devel_update, throw a warning
instead of silently ignoring it. Some logical reordering is present in
this patch to reduce the number of nested if's.

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

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c7bde9c..5cdf2f5 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1785,13 +1785,13 @@ devel_update() {
 	#  ...
 	#  _foo=pkgver
 	#
-	if [[ -n $newpkgver ]]; then
-		if [[ $newpkgver != "$pkgver" ]]; then
-			if [[ -f $BUILDFILE && -w $BUILDFILE ]]; then
-				@SEDINPLACE@ "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE"
-				@SEDINPLACE@ "s/^pkgrel=[^ ]*/pkgrel=1/" "$BUILDFILE"
-				source_safe "$BUILDFILE"
-			fi
+	if [[ -n $newpkgver && $newpkgver != "$pkgver" && -f $BUILDFILE ]]; then
+		if [[ -w $BUILDFILE ]]; then
+			@SEDINPLACE@ "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE"
+			@SEDINPLACE@ "s/^pkgrel=[^ ]*/pkgrel=1/" "$BUILDFILE"
+			source "$BUILDFILE"
+		else
+			warning "$(gettext "%s is not writeable -- pkgver will not be updated")" "$BUILDFILE"
 		fi
 	fi
 }
-- 
1.7.9



More information about the pacman-dev mailing list