aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2021-09-14 10:51:31 +0200
committerGitHub <noreply@github.com>2021-09-14 10:51:31 +0200
commit011100df7837c89682d9da777e959a4a9224dcfa (patch)
tree142a870110a78ab5febe65ff2199fb373904eeaa
parent6826a89d82bedb72e14a91199591770c5fa36401 (diff)
downloadinitscripts-011100df7837c89682d9da777e959a4a9224dcfa.tar
initscripts-011100df7837c89682d9da777e959a4a9224dcfa.tar.gz
initscripts-011100df7837c89682d9da777e959a4a9224dcfa.tar.bz2
initscripts-011100df7837c89682d9da777e959a4a9224dcfa.tar.xz
initscripts-011100df7837c89682d9da777e959a4a9224dcfa.zip
spec: Fix issue with $NEXT_VERSION (#390)
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index eb67cc0c..6438d4a1 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,13 @@ localstatedir = /var
sharedstatedir = $(localstatedir)/lib
VERSION := $(shell gawk '/Version:/ { print $$2 }' initscripts.spec)
-NEXT_VERSION := $(shell sed -nr 's/Version:[ ]*([0-9]*)\.([0-9]*)\.([0-9]*)/echo "\1\.\2\.$$((\3+1))"/gep' initscripts.spec)
+# NOTE: First check version type. We currently support two types:
+# * upstream version ##.## (e.g. 10.01)
+# * downstream version ##.##.## (e.g. 10.01.1)
+# Then based on type of version, increment last number by one using sed - https://stackoverflow.com/a/14348899
+NEXT_VERSION := $(shell grep -q "^Version:[ ]*[0-9]*\.[0-9]*$$" initscripts.spec && \
+ sed -nr 's/Version:[ ]*([0-9]*)\.([0-9]*)/echo "\1\.$$((\2+1))"/gep' initscripts.spec || \
+ sed -nr 's/Version:[ ]*([0-9]*)\.([0-9]*)\.([0-9]*)/echo "\1\.\2\.$$((\3+1))"/gep' initscripts.spec)
all: make-binaries make-translations