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.
pull/1350/head
Ken Dreyer 2017-03-07 11:01:15 -07:00
parent db241751db
commit 08a87e59e4
1 changed files with 18 additions and 0 deletions

View File

@ -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