docker/bsc1064781-0001-Allow-to-override-build-date.patch
Aleksa Sarai 91fa19e925 Accepting request 536268 from home:cyphar:containers:boo1064781_docker_version
- Correctly set `docker version` information, including the version, git
  commit, and SOURCE_DATE_EPOCH (requires a backport). This should
  *effectively* make Docker builds reproducible, with minimal cost. boo#1064781
  + bsc1064781-0001-Allow-to-override-build-date.patch

OBS-URL: https://build.opensuse.org/request/show/536268
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=208
2017-10-24 10:02:17 +00:00

34 lines
1.1 KiB
Diff

From 760763e9957840f1983a5006f4e66d6920ec496e Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Wed, 19 Jul 2017 06:17:19 +0200
Subject: [PATCH] Allow to override build date
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
SUSE-Bugfix: https://bugzilla.suse.com/show_bug.cgi?id=1064781
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
hack/make.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hack/make.sh b/hack/make.sh
index b7d59ba94a00..7d18d649b540 100755
--- a/hack/make.sh
+++ b/hack/make.sh
@@ -68,7 +68,7 @@ DEFAULT_BUNDLES=(
)
VERSION=$(< ./VERSION)
-! BUILDTIME=$(date --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
+! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
if [ "$DOCKER_GITCOMMIT" ]; then
GITCOMMIT="$DOCKER_GITCOMMIT"
elif command -v git &> /dev/null && [ -d .git ] && git rev-parse &> /dev/null; then
--
2.14.2