packages: builder - make builder -u to work

glen glen at pld-linux.org
Thu Apr 8 14:13:37 CEST 2010


Author: glen                         Date: Thu Apr  8 12:13:37 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- make builder -u to work

---- Files affected:
packages:
   builder (1.615 -> 1.616) 

---- Diffs:

================================================================
Index: packages/builder
diff -u packages/builder:1.615 packages/builder:1.616
--- packages/builder:1.615	Mon Apr  5 17:13:27 2010
+++ packages/builder	Thu Apr  8 14:13:31 2010
@@ -33,10 +33,9 @@
 #	Try `basename --help' for more information.
 #	-- and the normal usage info --
 
-
-RCSID='$Id$'
-r=${RCSID#* * }
-rev=${r%% *}
+PROGRAM=${0##*/}
+APPDIR=$(d=$0; [ -L "$d" ] && d=$(readlink -f "$d"); dirname "$d")
+RCSID='$Id$' r=${RCSID#* * } rev=${r%% *}
 VERSION="v0.35/$rev"
 VERSIONSTRING="\
 Build package utility from PLD Linux CVS repository
@@ -554,7 +553,7 @@
 
 get_icons() {
 	update_shell_title "get icons"
-	ICONS=$(awk '/^Icon:/ {print $2}' ${ASSUMED_NAME}/${SPECFILE})
+	ICONS=$(awk '/^Icon:/ {print $2}' $PACKAGE_DIR/${SPECFILE})
 	if [ -z "$ICONS" ]; then
 		return
 	fi
@@ -1380,6 +1379,27 @@
 	fi
 }
 
+# from relup.sh
+set_release() {
+	local specfile="$1"
+	local rel="$2"
+	local newrel="$3"
+	sed -i -e "
+		s/^\(%define[ \t]\+_\?rel[ \t]\+\)$rel\$/\1$newrel/
+		s/^\(Release:[ \t]\+\)$rel\$/\1$newrel/
+	" $specfile
+}
+
+set_version() {
+	local specfile="$1"
+	local ver="$2"
+	local newver="$3"
+	sed -i -e "
+		s/^\(%define[ \t]\+_\?ver[ \t]\+\)$ver\$/\1$newver/
+		s/^\(Version:[ \t]\+\)$ver\$/\1$newver/
+	" $specfile
+}
+
 build_package() {
 	update_shell_title "build_package"
 	if [ -n "$DEBUG" ]; then
@@ -1390,29 +1410,29 @@
 	cd "$PACKAGE_DIR"
 
 	if [ -n "$TRY_UPGRADE" ]; then
+		local TNOTIFY TNEWVER TOLDVER
 		update_shell_title "build_package: try_upgrade"
+
 		if [ -n "$FLOAT_VERSION" ]; then
-			TNOTIFY=$(./pldnotify.awk $SPECFILE -n) || exit 1
+			TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE -n) || exit 1
 		else
-			TNOTIFY=$(./pldnotify.awk $SPECFILE) || exit 1
+			TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE) || exit 1
 		fi
 
 		TNEWVER=$(echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }')
 
 		if [ -n "$TNEWVER" ]; then
 			TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
-			echo "New version found, updating spec file to version " $TNEWVER
+			echo "New version found, updating spec file from $TOLDVER to version $TNEWVER"
 			if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
 				cp -f $SPECFILE $SPECFILE.bak
 			fi
 			chmod +w $SPECFILE
-			eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
-			eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
+			set_release $SPECFILE $PACKAGE_RELEASE 0.1
+			set_version $SPECFILE $PACKAGE_VERSION $TNEWVER
 			parse_spec
 			NODIST="yes" get_files $SOURCES $PATCHES
 			update_md5 $SOURCES
-
-			unset TOLDVER TNEWVER TNOTIFY
 		fi
 	fi
 	cd "$PACKAGE_DIR"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/builder?r1=1.615&r2=1.616&f=u



More information about the pld-cvs-commit mailing list