Override build user+host+timestamp

to make kata-linux-container package builds reproducible.

See https://reproducible-builds.org/ for why this is good.

Uses -u to be independent of timezone.
Uses LANG=C to not have Day-of-Week and Month names vary.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
This commit is contained in:
Bernhard M. Wiedemann 2019-03-12 14:28:17 +01:00
parent 9a8553fa4a
commit 693d240971
No known key found for this signature in database
GPG Key ID: 49360B3B1DFBA164
2 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,11 @@ override_dh_auto_build:
rm -f .config
find $(KERNEL_CONFIGS) -name "$(KERNEL_ARCH)_kata_kvm_*" -exec cp {} .config \;
[ -f .config ] || (@echo "ERROR: cannot find the kernel config file for the $(KERNEL_ARCH) architecture"; exit 1)
# https://github.com/kata-containers/packaging/issues/394 enable reproducible builds:
export KBUILD_BUILD_USER=katabuilduser
export KBUILD_BUILD_HOST=katabuildhost
# Default to zero seconds after midnight 1970-01-01 (the epoch)
export KBUILD_BUILD_TIMESTAMP="$(LANG=C date -u -d "@${SOURCE_DATE_EPOCH:-0}")"
make -s ARCH=$(KERNEL_ARCH) oldconfig > /dev/null
make -s CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=$(KERNEL_ARCH)

View File

@ -87,6 +87,11 @@ BuildKernel() {
export CFLAGS="-Wno-error=restrict"
export EXTRA_CFLAGS="-Wno-format-truncation -Wno-cast-function-type -Wno-error=restrict -Wno-error"
%endif
# https://github.com/kata-containers/packaging/issues/394 enable reproducible builds:
export KBUILD_BUILD_USER=katabuilduser
export KBUILD_BUILD_HOST=katabuildhost
# Default to zero seconds after midnight 1970-01-01 (the epoch)
export KBUILD_BUILD_TIMESTAMP="$(LANG=C date -u -d "@${SOURCE_DATE_EPOCH:-0}")"
make -s ARCH=$kernelArch oldconfig > /dev/null
make -s CONFIG_DEBUG_SECTION_MISMATCH=y %{?_smp_mflags} ARCH=$kernelArch %{?sparse_mflags} || exit 1