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

fix: build-in version for release tags

* Change Makefile to remove the leading `v` from the git tag
   in the case of release tags. Previously this was only done for
   pre-release git tags.
This commit is contained in:
Bernhard Reiter 2024-11-15 11:46:26 +01:00 committed by Paul Schwabauer
parent 3e9b5e1ebb
commit ace8aeaf98

View file

@ -47,13 +47,13 @@ tag_checked_out:
# In this case we might in some situations see an error like # In this case we might in some situations see an error like
# `/bin/bash: line 1: 2b55bbb: value too great for base (error token is "2b55bbb")` # `/bin/bash: line 1: 2b55bbb: value too great for base (error token is "2b55bbb")`
# which can be ignored. # which can be ignored.
GITDESC := $(shell git describe --tags --always) GITDESC := $(shell git describe --tags --always | sed -E 's/^v//')
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/') GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 ))) SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
# Hint: The regexp in the next line only matches if there is a hyphen (`-`) # Hint: The regexp in the next line only matches if there is a hyphen (`-`)
# followed by a number, by which we assume that git describe # followed by a number, by which we assume that git describe
# has added a string after the tag # 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/' ) SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' )
testsemver: testsemver:
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\' @echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'