]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Makefile: handle "rc" version tags 1350/head
authorKen Dreyer <kdreyer@redhat.com>
Tue, 7 Mar 2017 18:01:15 +0000 (11:01 -0700)
committerKen Dreyer <kdreyer@redhat.com>
Tue, 7 Mar 2017 18:16:11 +0000 (11:16 -0700)
When "git describe" returns an "rc" tag (eg "2.2.0rc1"), insert the RC
number into the RPM's "Release" field.

Add comments with some git-describe values and NVRs.

Makefile

index 21461501997aba80274acfeb0ab70f2fdb31b61c..659fccd5a3b76cd29ae5c94d9ba6d9d69333e4f9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,19 @@
 # Try "make" (for SRPMS) or "make rpm"
 
 NAME = ceph-ansible
+
+# Set the RPM package NVR from "git describe".
+# Examples:
+#
+#  A "git describe" value of "v2.2.0rc1" would create an NVR
+#  "ceph-ansible-2.2.0-0.rc1.1.el7"
+#
+#  A "git describe" value of "v2.2.0rc1-1-gc465f85" would create an NVR
+#  "ceph-ansible-2.2.0-0.rc1.1.gc465f85.el7"
+#
+#  A "git describe" value of "v2.2.0" creates an NVR
+#  "ceph-ansible-2.2.0-1.el7"
+
 VERSION := $(shell git describe --tags --abbrev=0 --match 'v*' | sed 's/^v//')
 COMMIT := $(shell git rev-parse HEAD)
 SHORTCOMMIT := $(shell echo $(COMMIT) | cut -c1-7)
@@ -12,6 +25,11 @@ RELEASE := $(shell git describe --tags --match 'v*' \
 ifeq ($(VERSION),$(RELEASE))
   RELEASE = 1
 endif
+ifneq (,$(findstring rc,$(VERSION)))
+    RC := $(shell echo $(VERSION) | sed 's/.*rc/rc/')
+    RELEASE := 0.$(RC).$(RELEASE)
+    VERSION := $(subst $(RC),,$(VERSION))
+endif
 NVR := $(NAME)-$(VERSION)-$(RELEASE).el7
 
 all: srpm