mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
Allow specifying build date from a variable (#1200)
Just like the existing infrastructure for `BUILDINFO_TAG`, this can ease the production of [reproducible builds](https://wiki.freebsd.org/ReproducibleBuilds). (e.g. in FreeBSD the date the port was committed is used at build time, not the actual build time, so that an identical port produced at different times produces an identical executable)
This commit is contained in:
parent
7644efae01
commit
3d20fd20d0
1 changed files with 2 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -1,5 +1,6 @@
|
||||||
PKG_PREFIX := github.com/VictoriaMetrics/VictoriaMetrics
|
PKG_PREFIX := github.com/VictoriaMetrics/VictoriaMetrics
|
||||||
|
|
||||||
|
DATEINFO_TAG ?= $(shell date -u +'%Y%m%d-%H%M%S')
|
||||||
BUILDINFO_TAG ?= $(shell echo $$(git describe --long --all | tr '/' '-')$$( \
|
BUILDINFO_TAG ?= $(shell echo $$(git describe --long --all | tr '/' '-')$$( \
|
||||||
git diff-index --quiet HEAD -- || echo '-dirty-'$$(git diff-index -u HEAD | openssl sha1 | cut -c 10-17)))
|
git diff-index --quiet HEAD -- || echo '-dirty-'$$(git diff-index -u HEAD | openssl sha1 | cut -c 10-17)))
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ ifeq ($(PKG_TAG),)
|
||||||
PKG_TAG := $(BUILDINFO_TAG)
|
PKG_TAG := $(BUILDINFO_TAG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GO_BUILDINFO = -X '$(PKG_PREFIX)/lib/buildinfo.Version=$(APP_NAME)-$(shell date -u +'%Y%m%d-%H%M%S')-$(BUILDINFO_TAG)'
|
GO_BUILDINFO = -X '$(PKG_PREFIX)/lib/buildinfo.Version=$(APP_NAME)-$(DATEINFO_TAG)-$(BUILDINFO_TAG)'
|
||||||
|
|
||||||
.PHONY: $(MAKECMDGOALS)
|
.PHONY: $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue