]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Makefile: bail out on unknown Git tag formats
authorKen Dreyer <kdreyer@redhat.com>
Thu, 10 May 2018 20:39:07 +0000 (14:39 -0600)
committerSébastien Han <seb@redhat.com>
Thu, 10 May 2018 22:36:15 +0000 (15:36 -0700)
Prior to this change, if we created entirely new Git tags patterns like
"3.2.0alpha" or "3.2.0foobar", the Makefile would incorrectly translate
the Git tag name into a Name-Version-Release that would prevent upgrades
to "newer" versions.

This happened for example in
https://bugs.centos.org/view.php?id=14593, "Incorrect naming scheme for
a build of ceph-ansible prevents subsequent updates to be installed"

If we encounter a new Git tag format that we cannot parse,
pessimistically bail out early instead of trying to build an RPM.

The purpose of this safeguard is to prevent Jenkins from building RPMs
that cannot be easily upgraded.

Makefile

index 14deda16f2494d72b54b66e5b1b6014cc6c5e0e5..a9c01452fff8c862c5c73b90d7022beac596754e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,13 @@ ifneq (,$(findstring rc,$(VERSION)))
     RELEASE := 0.$(RC).$(RELEASE)
     VERSION := $(subst $(RC),,$(VERSION))
 endif
+
+ifneq (,$(shell echo $(VERSION) | grep [a-zA-Z]))
+    # If we still have alpha characters in our Git tag string, we don't know
+    # how to translate that into a sane RPM version/release. Bail out.
+    $(error cannot translate Git tag version $(VERSION) to an RPM NVR)
+endif
+
 NVR := $(NAME)-$(VERSION)-$(RELEASE).el7
 
 all: srpm