[Server-devel] [PATCH] ds-backup packaging - use git describe for versioning.

martin.langhoff at gmail.com martin.langhoff at gmail.com
Sun Jul 20 21:08:34 EDT 2008


From: Martin Langhoff <martin at laptop.org>

Make the rpm versioning dependent on git describe, which does
a very sensible thing - finds the closest tag. If the match
is perfect, it will use the version there stripping a possible
leading 'v' and replacing - with . (so v1.0-33 becomes v1.0.33).

If the match is not perfect, it will count commits of distance,
so 2.0.45.<sha1> is 45 commits after v2.0, with a particular sha1.

It retains the 'snapshot' build number counter, which is a handy
shortcut while testing.
---
 Makefile.fedora  |    5 ++---
 Makefile.package |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Makefile.fedora b/Makefile.fedora
index 915a079..dde1ccb 100644
--- a/Makefile.fedora
+++ b/Makefile.fedora
@@ -19,7 +19,6 @@ include ./Makefile.package
 
 # Select build id.
 
-SNAPSHOT   := $(shell date +%Y%m%d)git$(shell git log | head -n1 | awk '{print substr($$2,0,6)}')
 BUILDNO    := $(shell if [ -f "build-no" ]; then cat build-no; else echo 1; fi)
 OLDBUILDNO := $(shell echo '$(BUILDNO) - 1' | bc)
 incr-build:
@@ -28,7 +27,7 @@ incr-build:
 ifeq (,$(findstring snapshot,$(MAKECMDGOALS)))
   VERSION=$(COMPLETION)
 else
-  VERSION=$(COMPLETION).$(BUILDNO).$(SNAPSHOT)
+  VERSION=$(COMPLETION).$(BUILDNO)
 endif
 
 NV    = $(PKGNAME)-$(VERSION)
@@ -111,7 +110,7 @@ clean:
 
 # Snapshot and Release Rules
 
-snapshot-deploy: VERSION=$(COMPLETION).$(OLDBUILDNO).$(SNAPSHOT)
+snapshot-deploy: VERSION=$(COMPLETION).$(OLDBUILDNO)
 
 snapshot-lint release-lint: lint
 
diff --git a/Makefile.package b/Makefile.package
index ed65bd4..2c31372 100644
--- a/Makefile.package
+++ b/Makefile.package
@@ -1,6 +1,6 @@
 
 PKGNAME     = ds-backup
-COMPLETION  = 0.6
+COMPLETION  = $(shell git describe | sed 's/^v//' | sed 's/-/./g')
 RELEASE     = 1
 SOURCES     = README AUTHORS COPYING Makefile.build client server
 
-- 
1.5.6.dirty



More information about the Server-devel mailing list