From: Ken Dreyer Date: Tue, 7 Mar 2017 18:01:15 +0000 (-0700) Subject: Makefile: handle "rc" version tags X-Git-Tag: v2.2.0rc1~13^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1350%2Fhead;p=ceph-ansible.git 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. --- 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