Code

Simplify naming (versioning) of non-release tig tarball and rpm file
authorJakub Narebski <jnareb@gmail.com>
Fri, 22 Jun 2007 21:39:42 +0000 (23:39 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Fri, 22 Jun 2007 22:18:30 +0000 (00:18 +0200)
Use the tag part of git-describe output, with `tig-' prefix stripped
off, as version number. Use number of commits since given tag as
release number, using 0 if we are at tagged version, and adding
'.dirty' suffix if working directory is dirty. Do not use 'g<sha 1>'
part of git-describe output.

For example, when git-describe output was tig-0.7-8-g26d0386, before
this commit tarball was named tig-0.7.8.g26d0386.tar.gz and rpm was
named tig-0.7.8.g26d0386-1.src.rpm (for dirty tree tarball was
tig-0.7.8.g26d0386.dirty.tar.gz), now tarball is named
tig-0.7-8.tar.gz and rpm is named tig-0.7-8.src.rpm (for dirty tree
tarball is tig-0.7-8.dirty.tar.gz).

[ Simplify the version extraction a bit. --jonas ]

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Makefile
contrib/tig.spec.in

index 4caba6c3922b7999be056180c43a6d6e98099562..ba42a900748c9355a7d0ce524933dcea9123c763 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,11 @@ ifdef DIST_VERSION
 VERSION = $(DIST_VERSION)
 endif
 
-RPM_VERSION = $(subst -,.,$(VERSION))
+# Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET"
+# and append 0 as a fallback offset for "exact" tagged versions.
+RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0
+RPM_VERSION = $(word 1,$(RPM_VERLIST))
+RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)
 
 LDLIBS = -lcurses
 CFLAGS = -Wall -O2
@@ -26,7 +30,7 @@ PROGS = tig
 MANDOC = tig.1 tigrc.5
 HTMLDOC = tig.1.html tigrc.5.html manual.html README.html
 ALLDOC = $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf
-TARNAME        = tig-$(RPM_VERSION)
+TARNAME        = tig-$(RPM_VERSION)-$(RPM_RELEASE)
 
 override CFLAGS += '-DVERSION="$(VERSION)"'
 
@@ -106,7 +110,8 @@ release-dist: release-doc
        install-doc-man install-doc-html clean spell-check dist rpm
 
 tig.spec: contrib/tig.spec.in
-       sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@
+       sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \
+           -e 's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@
 
 tig: tig.c
 
index d613870a8462320bca1b8e91a49e708b54f4d47a..9a75a8f5923dc57ad27065a3928cc4c3fb7c4561 100644 (file)
@@ -4,7 +4,7 @@
 Summary:       Tig: text-mode interface for git
 Name:          tig
 Version:       @@VERSION@@
-Release:       1%{?dist}
+Release:       @@RELEASE@@%{?dist}
 License:       GPL
 Group:                 Development/Tools
 Vendor:        Jonas Fonseca <fonseca@diku.dk>