From 011100df7837c89682d9da777e959a4a9224dcfa Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Tue, 14 Sep 2021 10:51:31 +0200 Subject: spec: Fix issue with $NEXT_VERSION (#390) --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1