summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch')
-rw-r--r--meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch
new file mode 100644
index 0000000000..a181169d47
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch
@@ -0,0 +1,44 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 59da5577bf8df441c6ca958e50fcb83228702764 Mon Sep 17 00:00:00 2001
+From: Alejandro del Castillo <alejandro.delcastillo@ni.com>
+Date: Thu, 12 Sep 2019 10:24:58 -0500
+Subject: [PATCH] opkg-build: clamp mtimes to SOURCE_DATE_EPOCH
+
+For reproducible builds, clamp mtimes bigger than SOURCE_DATE_EPOCH to
+SOURCE_DATE_EPOCH (build generated files, usually).
+
+Fixes bugzilla 13450
+
+Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ opkg-build | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/opkg-build b/opkg-build
+index dcd2d68..2517a2b 100755
+--- a/opkg-build
++++ b/opkg-build
+@@ -297,9 +297,16 @@ mkdir $tmp_dir
+
+ build_date="${SOURCE_DATE_EPOCH:-$(date +%s)}"
+
++mtime_args=""
++# --clamp-mtime requires tar > 1.28. Only use it if SOURCE_DATE_EPOCH is set, to avoid having a generic case dependency on tar > 1.28.
++# this setting will make sure files generated at build time have consistent mtimes, for reproducible builds.
++if [ ! -z "$SOURCE_DATE_EPOCH" ]; then
++ mtime_args="--mtime=@$build_date --clamp-mtime"
++fi
++
+ ( cd $pkg_dir/$CONTROL && find . -type f > $tmp_dir/control_list )
+ ( cd $pkg_dir && find . -path ./$CONTROL -prune -o -print > $tmp_dir/file_list )
+-( cd $pkg_dir && tar $ogargs $tsortargs --no-recursion -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
++( cd $pkg_dir && tar $ogargs $tsortargs --no-recursion $mtime_args -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
+ ( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --no-recursion --mtime=@$build_date -c $tarformat -T $tmp_dir/control_list | gzip $zipargs > $tmp_dir/control.tar.gz )
+ rm $tmp_dir/file_list
+ rm $tmp_dir/control_list
+--
+2.20.1
+