From 08a87e59e47e86aa7478b956ffcbc7fea99664b4 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Tue, 7 Mar 2017 11:01:15 -0700 Subject: [PATCH] Makefile: handle "rc" version tags 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 214615019..659fccd5a 100644 --- 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 -- 2.47.3