From: Willy Tarreau Date: Sat, 22 Jun 2019 05:51:02 +0000 (+0200) Subject: BUILD: makefile: use :space: instead of digits to count commits X-Git-Tag: v2.1-dev1~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30a6f6402e385e76870618e3b1950ac989e93612;p=thirdparty%2Fhaproxy.git BUILD: makefile: use :space: instead of digits to count commits The 'tr' command on Solaris doesn't conform to POSIX and requires brackets around ranges. So the sequence '0-9' is understood as the 3 characters '0', '-', and '9'. This causes tagged versions (those with no commit after the last commit) to be numberred as an empty string, resulting in an error being reported while computing the version number. All implementations support '[:space:]' to delete heading spaces, so let's use this instead. This may be backported to all stable versions. --- diff --git a/Makefile b/Makefile index d62fead7a3..1387097b1d 100644 --- a/Makefile +++ b/Makefile @@ -399,7 +399,7 @@ ifeq ($(IGNOREGIT),) VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}") ifneq ($(VERSION),) # OK git is there and works. -SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms") +SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -d '[:space:]'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms") VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/') endif endif