From 5ca8bfcacb3be58c46965ab52fba72ac6dfb828c Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Wed, 18 Oct 2023 21:18:32 +0000 Subject: build: allow for reproducible builds Setting and using the SOURCE_DATE_EPOCH variable takes care of most of the magic necessary. https://reproducible-builds.org/docs/source-date-epoch/ vpp-ext-deps packages after this change is being built with that date set to date of the last modification of the subtree (similar logic to deriving the "number" for the package version) For the rest of the packages, pinning the following three variables should result in bit-identical artifacts across multiple runs: export SOURCE_DATE_EPOCH=$(date +%s) export VPP_BUILD_HOST="buildhost" export VPP_BUILD_USER="builduser" Add a blurb in the docs describing this new functionality. Type: improvement Change-Id: I71b085f0577b2358aa98f01dafd8e392239420a6 Signed-off-by: Andrew Yourtchenko --- build/external/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'build') diff --git a/build/external/Makefile b/build/external/Makefile index d648f4fa1c7..fb3cd94e526 100644 --- a/build/external/Makefile +++ b/build/external/Makefile @@ -21,6 +21,7 @@ BUILD_DIR ?= $(CURDIR)/_build INSTALL_DIR ?= $(CURDIR)/_install PKG_VERSION ?= $(shell git describe --abbrev=0 --match 'v[0-9]*' | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2) PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l) +SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct .) JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\ $(shell grep -c ^processor /proc/cpuinfo), 2) @@ -68,7 +69,7 @@ deb/debian/changelog: Makefile @echo "" >> $@ @echo " * Version $(DEB_VER)" >> $@ @echo "" >> $@ - @echo " -- VPP Dev $(shell date -R)" >> $@ + @echo " -- VPP Dev $(shell date -R --date=@${SOURCE_DATE_EPOCH})" >> $@ $(DEV_DEB): deb/debian/changelog @cd deb && dpkg-buildpackage -b -uc -us -- cgit 1.2.3-korg