]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: build: handle whitespaces in wc -l output
authorLukas Tribus <luky-37@hotmail.com>
Mon, 14 Apr 2014 13:38:26 +0000 (15:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Apr 2014 13:53:32 +0000 (15:53 +0200)
Certain implementations (for example ksh/OpenBSD) prefix the
'wc -l' output with whitespaces. This breaks the build since
689e4d733 ("BUILD: simplify the date and version retrieval in
the makefile").

Fix this by piping the wc output into tr -dc '0-9'.

Workaround is to build with IGNOREGIT=1.

HAProxy-1.4 is affected as well.

Makefile

index d47e6764b738c155a92d1d8d5092fb4d52205540..f95ba03ac60f936f3181714aa448222cd147df6f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -354,7 +354,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`; [ $$comms -gt 0 ] && echo "-$$comms")
+SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; [ $$comms -gt 0 ] && echo "-$$comms")
 VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/')
 endif
 endif