1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Improve Makefile for release version numbers

* Improve the pattern to leave tagged release version numbers like
   `0.2.2-alpha` alone and only increase version numbers where
   git describe has added a string starting with a number.
This commit is contained in:
Bernhard Reiter 2022-05-11 10:42:39 +02:00
parent 4d7538db41
commit d8d6eb3f43
No known key found for this signature in database
GPG key ID: 2B7BA3BF9BC3A554

View file

@ -45,8 +45,9 @@ GITDESC := $(shell git describe)
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
# Hint: The regexp in the next line only matches if there is a hyphen (`-`)
# and we can assume that git describe has added a string after the tag
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-.*)/\1$(SEMVERPATCH)\3/' )
# followed by a number, by which we assume that git describe
# has added a string after the tag
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' )
testsemver:
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'