mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-13 17:07:31 +00:00
BUILD: simplify the date and version retrieval in the makefile
The makefile currently uses some complex and non-always portable methods to retrieve the date and version (eg: linux's date command). For the date, we can use git log -1 --pretty=format:%ci instead of date+sed. For the version, it's easier and safer to count single log lines. Note that the VERSION variable was wrong since it could contain the version+subversion instead of just the version. This is now fixed by adding --abbrev=0 in describe.
This commit is contained in:
parent
439cfde55b
commit
689e4d733f
22
Makefile
22
Makefile
@ -343,11 +343,11 @@ endif
|
|||||||
# holding the same names in the current directory.
|
# holding the same names in the current directory.
|
||||||
|
|
||||||
ifeq ($(IGNOREGIT),)
|
ifeq ($(IGNOREGIT),)
|
||||||
VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*') 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
|
VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
|
||||||
ifneq ($(VERSION),)
|
ifneq ($(VERSION),)
|
||||||
# OK git is there and works.
|
# OK git is there and works.
|
||||||
SUBVERS := $(shell comms=`git log --no-merges v$(VERSION).. 2>/dev/null |grep -c ^commit `; [ $$comms -gt 0 ] && echo "-$$comms" )
|
SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l`; [ $$comms -gt 0 ] && echo "-$$comms")
|
||||||
VERDATE := $(shell date +%Y/%m/%d -d "`git log --pretty=fuller HEAD^.. 2>/dev/null | sed -ne '/^CommitDate:/{s/\(^[^ ]*:\)\|\( [-+].*\)//gp;q}'`" )
|
VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ clean:
|
|||||||
rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
|
rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
|
||||||
for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
|
for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
|
||||||
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION)$(SUBVERS).tar.gz
|
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION)$(SUBVERS).tar.gz
|
||||||
rm -f haproxy-$(VERSION) nohup.out gmon.out
|
rm -f haproxy-$(VERSION) haproxy-$(VERSION)$(SUBVERS) nohup.out gmon.out
|
||||||
rm -f haproxy-systemd-wrapper
|
rm -f haproxy-systemd-wrapper
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
@ -721,15 +721,15 @@ cscope:
|
|||||||
find src include -name "*.[ch]" -print | cscope -q -b -i -
|
find src include -name "*.[ch]" -print | cscope -q -b -i -
|
||||||
|
|
||||||
tar: clean
|
tar: clean
|
||||||
ln -s . haproxy-$(VERSION)
|
ln -s . haproxy-$(VERSION)$(SUBVERS)
|
||||||
tar --exclude=haproxy-$(VERSION)/.git \
|
tar --exclude=haproxy-$(VERSION)$(SUBVERS)/.git \
|
||||||
--exclude=haproxy-$(VERSION)/haproxy-$(VERSION) \
|
--exclude=haproxy-$(VERSION)$(SUBVERS)/haproxy-$(VERSION)$(SUBVERS) \
|
||||||
--exclude=haproxy-$(VERSION)/haproxy-$(VERSION).tar.gz \
|
--exclude=haproxy-$(VERSION)$(SUBVERS)/haproxy-$(VERSION)$(SUBVERS).tar.gz \
|
||||||
-cf - haproxy-$(VERSION)/* | gzip -c9 >haproxy-$(VERSION).tar.gz
|
-cf - haproxy-$(VERSION)$(SUBVERS)/* | gzip -c9 >haproxy-$(VERSION)$(SUBVERS).tar.gz
|
||||||
rm -f haproxy-$(VERSION)
|
rm -f haproxy-$(VERSION)$(SUBVERS)
|
||||||
|
|
||||||
git-tar:
|
git-tar:
|
||||||
git archive --format=tar --prefix="haproxy-$(VERSION)/" HEAD | gzip -9 > haproxy-$(VERSION)$(SUBVERS).tar.gz
|
git archive --format=tar --prefix="haproxy-$(VERSION)$(SUBVERS)/" HEAD | gzip -9 > haproxy-$(VERSION)$(SUBVERS).tar.gz
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@echo "VERSION: $(VERSION)"
|
@echo "VERSION: $(VERSION)"
|
||||||
|
Loading…
Reference in New Issue
Block a user