summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-09-17 10:18:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-19 10:54:32 +0100
commit038b0120816f24fc7a6ee61991a27b437a29f169 (patch)
treedb838eca963336765164213ca0943d34f0a7b58a
parenteba5dcddfa8de36c33b9eb258f187edbe0afe7a2 (diff)
downloadpoky-038b0120816f24fc7a6ee61991a27b437a29f169.tar.gz
opkg-utils: respect SOURCE_DATE_EPOCH when building ipkgs
Backport a patch from upstream to respect SOURCE_DATE_EPOCH when building ipkgs, to ensure reproducible archives. (From OE-Core rev: d50d52188cee7ccc0f40f0bba6da1084410b81cf) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/opkg-utils/opkg-utils/0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch44
-rw-r--r--meta/recipes-devtools/opkg-utils/opkg-utils_0.4.1.bb1
2 files changed, 45 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 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 59da5577bf8df441c6ca958e50fcb83228702764 Mon Sep 17 00:00:00 2001
5From: Alejandro del Castillo <alejandro.delcastillo@ni.com>
6Date: Thu, 12 Sep 2019 10:24:58 -0500
7Subject: [PATCH] opkg-build: clamp mtimes to SOURCE_DATE_EPOCH
8
9For reproducible builds, clamp mtimes bigger than SOURCE_DATE_EPOCH to
10SOURCE_DATE_EPOCH (build generated files, usually).
11
12Fixes bugzilla 13450
13
14Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
15Signed-off-by: Ross Burton <ross.burton@intel.com>
16---
17 opkg-build | 9 ++++++++-
18 1 file changed, 8 insertions(+), 1 deletion(-)
19
20diff --git a/opkg-build b/opkg-build
21index dcd2d68..2517a2b 100755
22--- a/opkg-build
23+++ b/opkg-build
24@@ -297,9 +297,16 @@ mkdir $tmp_dir
25
26 build_date="${SOURCE_DATE_EPOCH:-$(date +%s)}"
27
28+mtime_args=""
29+# --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.
30+# this setting will make sure files generated at build time have consistent mtimes, for reproducible builds.
31+if [ ! -z "$SOURCE_DATE_EPOCH" ]; then
32+ mtime_args="--mtime=@$build_date --clamp-mtime"
33+fi
34+
35 ( cd $pkg_dir/$CONTROL && find . -type f > $tmp_dir/control_list )
36 ( cd $pkg_dir && find . -path ./$CONTROL -prune -o -print > $tmp_dir/file_list )
37-( cd $pkg_dir && tar $ogargs $tsortargs --no-recursion -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
38+( cd $pkg_dir && tar $ogargs $tsortargs --no-recursion $mtime_args -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
39 ( 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 )
40 rm $tmp_dir/file_list
41 rm $tmp_dir/control_list
42--
432.20.1
44
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_0.4.1.bb b/meta/recipes-devtools/opkg-utils/opkg-utils_0.4.1.bb
index 4be7b16d8a..cf1e4670c6 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_0.4.1.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_0.4.1.bb
@@ -9,6 +9,7 @@ PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', 'virtu
9 9
10SRC_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/${BPN}/snapshot/${BPN}-${PV}.tar.gz \ 10SRC_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/${BPN}/snapshot/${BPN}-${PV}.tar.gz \
11 file://0001-Switch-all-scripts-to-use-Python-3.x.patch \ 11 file://0001-Switch-all-scripts-to-use-Python-3.x.patch \
12 file://0001-opkg-build-clamp-mtimes-to-SOURCE_DATE_EPOCH.patch \
12" 13"
13UPSTREAM_CHECK_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/opkg-utils/refs/" 14UPSTREAM_CHECK_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/opkg-utils/refs/"
14 15