Hi,

extra integration testing did show a series of issues with rpm
autogenerated version system.

the following patch addresses them.

Issues details:

1) a version trunk-1.r1234 is < 0.XX release breaking upgrade paths from
release X to trunk to release X+1.

2) alpha tag can contain M or S or MS. Eg. r1234M is < r1234 breaking
rpm upgrade path.

Solution:

after investigation, the only natural and clean solution is to use the
"svn previous tag" version number + a clean alpha tag.

In order to address #1 we need to introduce an helper script
(svn-helper.sh) to determine the last known tag in svn.
the script will return "unknown" if it is not possible to determine
those information or the tools to determine those information are not
available.

Makefile.am defines an RPMVERSION detected by svn-helper.sh. The value
can be easily overridden at make srpm/rpm invokation time.
For eg:

make srpm RPMVERSION=x.y.z

this is useful if svn-helper.sh can't detect the information and we need
to create a specific rpm version.

In order to address #2 we simply apply a regexp to filter out unrequired
data.

Fabio
Index: svn-helper.sh
===================================================================
--- svn-helper.sh	(revision 0)
+++ svn-helper.sh	(revision 0)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+get_svn_data() {
+	lastrev=0
+	svn info ../tags/* | \
+	grep -E '(^Path|Last Changed Rev)' | \
+	while read line; do
+		entry=$(echo $line | cut -d ":" -f 1)
+		data=$(echo $line | cut -d ":" -f 2)
+		case $entry in
+			"Path")
+				newpath="$data"
+				;;
+			"Last Changed Rev")
+				if [ "$data" -gt "$lastrev" ]; then
+					lastrev="$data"
+					lastpath="$newpath"
+					echo $lastpath
+				fi
+				;;
+			*)
+				echo doh!
+				exit 1
+				;;
+		esac
+	done;
+}
+
+if [ ! -d ../tags/.svn ] || ! type svn 1>/dev/null 2>&1; then
+	echo "unknown"
+	exit 0
+fi
+
+get_svn_data | \
+	tail -n 1 | \
+	sed -e "s#.*-##g"
+
+exit 0
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 2301)
+++ Makefile.am	(working copy)
@@ -31,10 +31,13 @@
 
 SPEC			= $(PACKAGE_NAME).spec
 
-TARFILE			= $(PACKAGE_NAME)-$(VERSION).tar.gz
+RPMVERSION		= $(shell sh ./svn-helper.sh)
 
-EXTRA_DIST		= autogen.sh conf/corosync.conf.example $(SPEC).in
+TARFILE			= $(PACKAGE_NAME)-$(RPMVERSION).tar.gz
 
+EXTRA_DIST		= autogen.sh conf/corosync.conf.example $(SPEC).in \
+			  svn-helper.sh
+
 AUTOMAKE_OPTIONS	= foreign
 
 MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 configure depcomp \
@@ -78,17 +81,17 @@
 $(SPEC): $(SPEC).in
 	rm -f $...@-t $@
 	LC_ALL=C date="$(shell date "+%a %b %d %Y")" && \
-	alphatag="$(shell svnversion)" && \
+	alphatag="$(shell svnversion | sed -e "s#.*:##g" -e "s#[MS]##g")" && \
 	sed \
 		-e "s...@alphatag@#r$$alphatag#g" \
-		-e "s...@version@#$(VERSION)#g" \
+		-e "s...@version@#$(RPMVERSION)#g" \
 		-e "s...@date@#$$date#g" \
 	$< > $...@-t
 	chmod a-w $...@-t
 	mv $...@-t $@
 
 $(TARFILE):
-	$(MAKE) dist
+	$(MAKE) dist VERSION=$(RPMVERSION)
 
 RPMBUILDOPTS	= --define "_sourcedir $(abs_builddir)" \
 		  --define "_specdir $(abs_builddir)" \
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to