opkg: Fix build reproducibility issue
PATCH 1/1 opkg: Fix build reproducibility issue
A build date was leaking into the generated docs and makefile used for ptests leading to reproducibility issues each time the month changed.
Add a patch to use SOURCE_DATE_EPOCH to derive it if available.
--- .../opkg/opkg/sourcedateepoch.patch | 25 +++++++++++++++++++ meta/recipes-devtools/opkg/opkg_0.4.4.bb | 1 + 2 files changed, 26 insertions(+) create mode 100644 meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch
meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch new file +25 -0
@@ -0,0 +1,25 @@ +Having CLEAN_DATE come from the current date doesn't allow for build +reproducibility. Add the option of using SOURCE_DATE_EPOCH if set +which for OE, it will be. + +Upstream-Status: Pending +RP 2021/2/2 + +Index: opkg-0.4.4/configure.ac +=================================================================== +--- opkg-0.4.4.orig/configure.ac ++++ opkg-0.4.4/configure.ac +@@ -281,7 +281,12 @@ AC_FUNC_UTIME_NULL + AC_FUNC_VPRINTF + AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime]) + +-CLEAN_DATE=`date +"%B %Y" | tr -d '\n'` ++1607446883 ++if [ ! -z "$SOURCE_DATE_EPOCH" ]; then ++ CLEAN_DATE=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH +"%B %Y" | tr -d '\n'` ++else ++ CLEAN_DATE=`date +"%B %Y" | tr -d '\n'` ++fi + + AC_SUBST([CLEAN_DATE]) +
meta/recipes-devtools/opkg/opkg_0.4.4.bb +1 -0
@@ -15,6 +15,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ file://0001-tests-let-the-OS-negotiate-relative-package-dirs.patch \ + file://sourcedateepoch.patch \ file://run-ptest \ "
Signature · 1 line
2.27.0
Quoted 4 lines · Richard Purdie
A build date was leaking into the generated docs and makefile used for ptests leading to reproducibility issues each time the month changed.
Add a patch to use
SOURCE_DATE_EPOCHto derive it if available.
ACK the objective, but I have a couple concerns about the patch below.
Quoted 8 lines
+--- opkg-0.4.4.orig/configure.ac
++++ opkg-0.4.4/configure.ac
+@@ -281,7 +281,12 @@AC_FUNC_UTIME_NULL
+AC_FUNC_VPRINTF
+ AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime]) +
+-CLEAN_DATE=date +"%B %Y" | tr -d '\n'
++1607446883
Is this 1607... timestamp just some leftover pollution in the configure.ac file or does it serve some purpose?
Quoted 1 line
++if [ ! -z "$SOURCE_DATE_EPOCH" ]; then
AutoConf doesn't have the shell interpretation of [; right? At least on my system, AutoConf drops the brackets in this statement and writes the ./configure file as:
if ! -z "$SOURCE_DATE_EPOCH" ; then
which obviously fails when executed. Can you use if test ! -z ... instead?
Quoted 19 lines
++ CLEAN_DATE=
LC_ALL=C date -d @$SOURCE_DATE_EPOCH +"%B %Y" | tr -d '\n'
++else
++ CLEAN_DATE=date +"%B %Y" | tr -d '\n'
++fimeta/recipes-devtools/opkg/opkg/sourcedateepoch.patch new file +3
-0+ + AC_SUBST([CLEAN_DATE]) +meta/recipes-devtools/opkg/opkg_0.4.4.bb +1
-0@@ -15,6 +15,7 @@ SRC_URI = "https://urldefense.com/v3/__http://downloads.yoctoproject.org/releases/$*7BBPN*7D/$*7BBPN*7D-$*7BPV*7D.tar.gz__;JSUlJSUl!!FbZ0ZwI3Qg!-TBdy64CfATG4aDXNwLs-F_1Ucyiha1TiiAh_Q51F5iWdo4LWw-X9cnExOGco7s$ file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ file://0001-tests-let-the-OS-negotiate-relative-package-dirs.patch \ + file://sourcedateepoch.patch \ file://run-ptest \ "
Signature · 5 lines
Alex Stewart Software Engineer - NI Real-Time OS NI (National Instruments) [email protected]
Quoted 17 lines · Alex Stewart
Quoted 4 lines · Richard Purdie
A build date was leaking into the generated docs and makefile used for ptests leading to reproducibility issues each time the month changed.
Add a patch to use
SOURCE_DATE_EPOCHto derive it if available.ACK the objective, but I have a couple concerns about the patch below.
Quoted 8 lines
+--- opkg-0.4.4.orig/configure.ac
++++ opkg-0.4.4/configure.ac
+@@ -281,7 +281,12 @@AC_FUNC_UTIME_NULL
+AC_FUNC_VPRINTF
+ AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime]) +
+-CLEAN_DATE=date +"%B %Y" | tr -d '\n'
++1607446883
Quoted 2 lines
Is this
1607...timestamp just some leftover pollution in the configure.ac file or does it serve some purpose?
Sorry, its just junk that crept in from testing. I'm surprised that doesn't error!
Quoted 9 lines
Quoted 1 line
++if [ ! -z "$SOURCE_DATE_EPOCH" ]; then
AutoConf doesn't have the shell interpretation of
[; right? At least on my system, AutoConf drops the brackets in this statement and writes the ./configure file as:if ! -z "$SOURCE_DATE_EPOCH" ; then
which obviously fails when executed. Can you use
if test ! -z ...instead?
I should know better than using [] in configure :) The other format should be fine. It probably works as OE always sets this now.
Cheers,
Richard