summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-09-27 22:06:02 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-10-03 07:55:42 +0200
commit88993256222bab1866247721d9846253e9ef12f5 (patch)
treed6b6a425cc8ced79db24d905e0f8102a7afb2503
parent41a6284570fc1a014cb6b2b7ebd7470e2d3e1770 (diff)
downloadptxdist-88993256222bab1866247721d9846253e9ef12f5.tar.gz
ptxdist-88993256222bab1866247721d9846253e9ef12f5.tar.xz
define and use SOURCE_DATE_EPOCH
This is useful for more reproducible builds. See also: https://reproducible-builds.org/specs/source-date-epoch/ It is used by the opkg-utils 0.3.6, so define this before updating that package. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/host-systemd.make2
-rw-r--r--rules/systemd.make2
-rw-r--r--scripts/lib/ptxd_lib_reproducible.sh17
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh2
4 files changed, 20 insertions, 3 deletions
diff --git a/rules/host-systemd.make b/rules/host-systemd.make
index 7f97a75bc..ace824a58 100644
--- a/rules/host-systemd.make
+++ b/rules/host-systemd.make
@@ -107,7 +107,7 @@ HOST_SYSTEMD_CONF_OPT := \
-Dsystem-uid-max=999 \
-Dsysusers=false \
-Dtests=false \
- -Dtime-epoch=`date --date "$(PTXDIST_VERSION_YEAR)-$(PTXDIST_VERSION_MONTH)-01 UTC" +%s` \
+ -Dtime-epoch=$(SOURCE_DATE_EPOCH) \
-Dtimedated=false \
-Dtimesyncd=false \
-Dtmpfiles=false \
diff --git a/rules/systemd.make b/rules/systemd.make
index 5fd1170ae..bad43049f 100644
--- a/rules/systemd.make
+++ b/rules/systemd.make
@@ -146,7 +146,7 @@ SYSTEMD_CONF_OPT := \
-Dsysvrcnd-path= \
-Dtelinit-path=/usr/bin/telinit \
-Dtests=false \
- -Dtime-epoch=`date --date "$(PTXDIST_VERSION_YEAR)-$(PTXDIST_VERSION_MONTH)-01 UTC" +%s` \
+ -Dtime-epoch=$(SOURCE_DATE_EPOCH) \
-Dtimedated=$(call ptx/truefalse,PTXCONF_SYSTEMD_TIMEDATE) \
-Dtimesyncd=$(call ptx/truefalse,PTXCONF_SYSTEMD_TIMEDATE) \
-Dtmpfiles=true \
diff --git a/scripts/lib/ptxd_lib_reproducible.sh b/scripts/lib/ptxd_lib_reproducible.sh
new file mode 100644
index 000000000..f0c1bcf8f
--- /dev/null
+++ b/scripts/lib/ptxd_lib_reproducible.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_lib_reproducible() {
+ SOURCE_DATE_EPOCH="$(echo $(date --date="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))"
+ export SOURCE_DATE_EPOCH
+}
+export -f ptxd_lib_reproducible
+
+ptxd_lib_reproducible
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 8c49cba9e..b3f2f20f3 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -916,7 +916,7 @@ executing '${pkg_label}.${1}'
export -f ptxd_install_run
ptxd_install_fixup_timestamps() {
- local timestamp="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC"
+ local timestamp="@${SOURCE_DATE_EPOCH}"
local touch_args
if touch --help | grep -q -- --no-dereference &> /dev/null; then
touch_args="--no-dereference"