Browse code

packaging: add short has and branch name in package version for unofficial builds

Serge van Ginderachter authored on 2014/08/06 20:00:14
Showing 1 changed files
... ...
@@ -39,6 +39,11 @@ VERSION := $(shell cat VERSION)
39 39
 # Get the branch information from git
40 40
 ifneq ($(shell which git),)
41 41
 GIT_DATE := $(shell git log -n 1 --format="%ai")
42
+GIT_HASH := $(shell git log -n 1 --format="%h")
43
+GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/[-_.]//g')
44
+GITINFO = .$(GIT_HASH).$(GIT_BRANCH)
45
+else
46
+GITINFO = ''
42 47
 endif
43 48
 
44 49
 ifeq ($(shell echo $(OS) | egrep -c 'Darwin|FreeBSD|OpenBSD'),1)
... ...
@@ -60,7 +65,7 @@ ifeq ($(OFFICIAL),yes)
60 60
         DEBUILD_OPTS += -k$(DEBSIGN_KEYID)
61 61
     endif
62 62
 else
63
-    DEB_RELEASE = 0.git$(DATE)
63
+    DEB_RELEASE = 0.git$(DATE)$(GITINFO)
64 64
     # Do not sign unofficial builds
65 65
     DEBUILD_OPTS += -uc -us
66 66
     DPUT_OPTS += -u
... ...
@@ -76,7 +81,7 @@ RPMSPEC = $(RPMSPECDIR)/ansible.spec
76 76
 RPMDIST = $(shell rpm --eval '%{?dist}')
77 77
 RPMRELEASE = 1
78 78
 ifneq ($(OFFICIAL),yes)
79
-    RPMRELEASE = 0.git$(DATE)
79
+    RPMRELEASE = 0.git$(DATE)$(GITINFO)
80 80
 endif
81 81
 RPMNVR = "$(NAME)-$(VERSION)-$(RPMRELEASE)$(RPMDIST)"
82 82