Plus a couple of other minor points. Qt daily snapshots are only
available via rsync (and tarballs) so I added _rsyncroot and
_rsyncmod awareness to makepkg.

elif [ ! -z ${_rsyncroot} ] && [ ! -z ${_rsyncmod} ] ; then               
    [ $(type -p rsync) ] || return 0                                  
    msg "$(gettext "Determining latest rsync revision...")"           
    newpkgver=$(date -u +%Y%m%d%H)                                    

The date format is per hour so multiple updates per day are possible
and the -u is UTC so the the timestamp is universal worldwide. Whilst
submitting a patch I thought I'd throw in this option for consideration
which is to use the pkgrel variable as the VCS version field rather
than pkgver.

if [ "$USE_PKGREL" != "" ]; then
    msg2 "$(gettext "Package release version found: %s")" "$newpkgver"
    pkgrel=$newpkgver
else
    msg2 "$(gettext "Version found: %s")" "$newpkgver"
    pkgver=$newpkgver
fi

It requires a new USE_PKGREL argument (see attached diff). It makes
it easier to offer packages called qt-snaphot-4.4.1-2008092301 and
qt-snaphot-4.5.0-2008092301

And finally, this minor tweak ensures that a pkgver=$(date) or
pkgver=$EXPORTED_GLOBAL_VAR will not be overwritten...

- sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT
+ sed -i "s/^pkgver=[^\( |\$\)]*/pkgver=$newpkgver/" ./$BUILDSCRIPT

--markc
--- /usr/bin/makepkg.orig	2008-09-22 20:18:21.000000000 +1000
+++ /usr/bin/makepkg	2008-09-23 15:11:14.000000000 +1000
@@ -62,6 +62,7 @@
 SOURCEONLY=0
 IGNOREARCH=0
 HOLDVER=0
+USE_PKGREL=0
 
 # Forces the pkgver of the current PKGBUILD. Used by the fakeroot call
 # when dealing with svn/cvs/etc PKGBUILDs.
@@ -1064,11 +1065,20 @@
 			fi
 			newpkgver=$(hg tip | sed -n '1s/[^0-9]*\([^:]*\):.*$/\1/p')
 			cd ../../
+		elif [ ! -z ${_rsyncroot} ] && [ ! -z ${_rsyncmod} ] ; then
+			[ $(type -p rsync) ] || return 0
+			msg "$(gettext "Determining latest rsync revision...")"
+			newpkgver=$(date -u +%Y%m%d%H)
 		fi
 
 		if [ "$newpkgver" != "" ]; then
-			msg2 "$(gettext "Version found: %s")" "$newpkgver"
-			pkgver=$newpkgver
+			if [ "$USE_PKGREL" != "" ]; then
+				msg2 "$(gettext "Package release version found: %s")" "$newpkgver"
+				pkgrel=$newpkgver
+			else
+				msg2 "$(gettext "Version found: %s")" "$newpkgver"
+				pkgver=$newpkgver
+			fi
 		fi
 
 	else
@@ -1089,7 +1099,7 @@
 	#
 	if [ "$newpkgver" != "" ]; then
 		if [ "newpkgver" != "$pkgver" ]; then
-			sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT
+			sed -i "s/^pkgver=[^\( |\$\)]*/pkgver=$newpkgver/" ./$BUILDSCRIPT
 			source $BUILDSCRIPT
 		fi
 	fi
@@ -1121,6 +1131,7 @@
 	echo "$(gettext "      --allsource  Generate a source-only tarball including downloaded sources")"
 	echo "$(gettext "      --asroot     Allow makepkg to run as root user")"
 	echo "$(gettext "      --holdver    Prevent automatic version bumping for development PKGBUILDs")"
+	echo "$(gettext "      --usepkgrel  Use pkgrel field for development PKGBUILD auto versioning")"
 	echo "$(gettext "      --source     Generate a source-only tarball without downloaded sources")"
 	echo
 	echo "$(gettext "These options can be passed to pacman:")"
@@ -1178,7 +1189,7 @@
 # Parse Command Line Options.
 OPT_SHORT="AbcCdefFghiLmop:rRsV"
 OPT_LONG="allsource,asroot,ignorearch,builddeps,clean,cleancache,nodeps"
-OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver"
+OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver,usepkgrel"
 OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source"
 OPT_LONG="$OPT_LONG,syncdeps,version"
 # Pacman Options
@@ -1211,6 +1222,7 @@
 		-F)               INFAKEROOT=1 ;;
 		-g|--geninteg)    GENINTEG=1 ;;
 		--holdver)        HOLDVER=1 ;;
+		--usepkgrel)      USE_PKGREL=1 ;;
 		-i|--install)     INSTALL=1 ;;
 		-L|--log)         LOGGING=1 ;;
 		-m|--nocolor)     USE_COLOR='n' ;;
_______________________________________________
pacman-dev mailing list
[email protected]
http://archlinux.org/mailman/listinfo/pacman-dev

Reply via email to