Skip to contentSkip to conversation

net-snmp: Reproducibility

PATCH Superseded Douglas Royds 1 participant 13 messages Nov 20, 2018 – Nov 21, 2018

lore
Share & tools
lore
#0 lore raw

cover net-snmp: Reproducibility

With this patch-set, I have achieved a reproducible build of net-snmp over two different hosts, Ubuntu releases, usernames, paths, etc.
I have come up with a patch for the NETSNMP_CONFIGURE_OPTIONS problem that might be acceptable to the upstream net-snmp project, see
https://sourceforge.net/p/net-snmp/patches/1384/
Consequently, I have reverted Hongxu Jia's earlier commit 57d8e2c6.

Note that I have turned off printcap support, hard-coded.
If this proves to be a problem, we can easily add a new variable, HAS_PRINTCAP.

Douglas Royds (5):
Revert "net-snmp: improve reproducibility"
net-snmp: Reproducibility: Fixed path to /bin/uname
net-snmp: Reproducibility: Remove PKG_CONFIG paths from net-snmp-config
net-snmp: Reproducibility: Don't check build host for /etc/printcap
net-snmp: Reproducibility: Set NETSNMP_CONFIGURE_OPTIONS null

 ...e-configure-options-from-versioninfo.patch | 42 -------------------
 ...ty-accept-configure-options-from-env.patch | 15 +++++++
 .../reproducibility-have-printcap.patch       | 19 +++++++++
 .../net-snmp/net-snmp_5.8.bb                  | 14 +++----
 4 files changed, 41 insertions(+), 49 deletions(-)
 delete mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 Revert "net-snmp: improve reproducibility"

This reverts commit 57d8e2c673d5f5686bbf411333f1d39c3e29690e.

---
 ...e-configure-options-from-versioninfo.patch | 42 -------------------
 .../net-snmp/net-snmp_5.8.bb                  |  7 ----
 2 files changed, 49 deletions(-)
 delete mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch deleted +0 -42
deleted file mode 100644
index 2d540967e..000000000
@@ -1,42 +0,0 @@
-From f592398b1c659f84168f5c84f63af3b71454b8f5 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <[email protected]>
-Date: Fri, 28 Sep 2018 22:59:23 +0800
-Subject: [PATCH] remove configure options from versioninfo
-
-Configure options contains host build paths which breaks
-binary reproducibility.
-
-It is no harm to remove it from version info.
-
-Upstream-Status: Inappropriate [cross compile specific]
-
-Signed-off-by: Hongxu Jia <[email protected]>
----
- agent/mibgroup/ucd-snmp/versioninfo.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/agent/mibgroup/ucd-snmp/versioninfo.c b/agent/mibgroup/ucd-snmp/versioninfo.c
-index a5151c1..1160382 100644
---- a/agent/mibgroup/ucd-snmp/versioninfo.c
-+++ b/agent/mibgroup/ucd-snmp/versioninfo.c
-@@ -92,7 +92,7 @@ var_extensible_version(struct variable *vp,
-     static char     errmsg[300];
-     char           *cptr;
-     time_t          curtime;
--#ifdef NETSNMP_CONFIGURE_OPTIONS
-+#if 0
-     static char     config_opts[] = NETSNMP_CONFIGURE_OPTIONS;
- #endif
- 
-@@ -126,7 +126,7 @@ var_extensible_version(struct variable *vp,
-         *var_len = strlen(errmsg);
-         return ((u_char *) errmsg);
-     case VERCONFIG:
--#ifdef NETSNMP_CONFIGURE_OPTIONS
-+#if 0
-         *var_len = strlen(config_opts);
-         if (*var_len > 1024)
-             *var_len = 1024;    /* mib imposed restriction */
--- 
-2.7.4
-
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +0 -7
index d47f9e4a3..a32d09d77 100644
@@ -24,7 +24,6 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://0004-configure-fix-incorrect-variable.patch \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
-           file://0001-remove-configure-options-from-versioninfo.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -169,12 +168,6 @@ net_snmp_sysroot_preprocess () {
     fi
 }
 
-PACKAGE_PREPROCESS_FUNCS += "net_snmp_package_preprocess"
-net_snmp_package_preprocess () {
-    sed -e 's@${RECIPE_SYSROOT}@@g' \
-       -i ${PKGD}${bindir}/net-snmp-config
-}
-
 PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \
              ${PN}-server-snmpd ${PN}-server-snmptrapd \
              ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 net-snmp: Reproducibility: Fixed path to /bin/uname

In reply to Douglas Royds
---
 meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb | 1 +
 1 file changed, 1 insertion(+)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +1 -0
index a32d09d77..089946032 100644
@@ -67,6 +67,7 @@ CACHED_CONFIGUREVARS = " \
     ac_cv_header_valgrind_memcheck_h=no \
     ac_cv_ETC_MNTTAB=/etc/mtab \
     lt_cv_shlibpath_overrides_runpath=yes \
+    ac_cv_path_UNAMEPROG=${base_bindir}/uname \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 net-snmp: Reproducibility: Remove PKG_CONFIG paths from net-snmp-config

In reply to Douglas Royds

PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR point into the net-snmp recipe-sysroot.

---
 meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +2 -0
index 089946032..4b1267b3c 100644
@@ -119,6 +119,8 @@ do_install_append() {
            -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
            -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \
            -e "s@\([^ ]*--with-install-prefix=[^ ]*\)\1*@@g" \
+           -e "s@\([^ ]*PKG_CONFIG_PATH=[^ ]*\)\1*@@g" \
+           -e "s@\([^ ]*PKG_CONFIG_LIBDIR=[^ ]*\)\1*@@g" \
         -i ${D}${bindir}/net-snmp-config
 
     if [ "${HAS_PERL}" = "1" ]; then
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 net-snmp: Reproducibility: Don't check build host for /etc/printcap

In reply to Douglas Royds

Don't check for /etc/printcap on the build machine when cross-compiling. Use AC_CHECK_FILE to set the cached variable ac_cv_file__etc_printcap instead. When cross-compiling, this variable should be set in the environment to "yes" or "no" as appropriate for the target platform.

I have taken the simple expedient of setting ac_cv_file__etc_printcap=no. If this proves to be a problem, we can easily add a new variable, HAS_PRINTCAP.

Upstream-Status: Submitted https://sourceforge.net/p/net-snmp/patches/1385/

---
 .../reproducibility-have-printcap.patch       | 19 +++++++++++++++++++
 .../net-snmp/net-snmp_5.8.bb                  |  2 ++
 2 files changed, 21 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch new file +19 -0
new file mode 100644
index 000000000..4316c7a71
@@ -0,0 +1,19 @@
+Reproducible build: Don't check for /etc/printcap on the build machine when
+cross-compiling. Use AC_CHECK_FILE to set the cached variable
+ac_cv_file__etc_printcap instead. When cross-compiling, this variable should be
+set in the environment to "yes" or "no" as appropriate for the target platform.
+
+--- net-snmp-5.8.original/configure.d/config_os_misc4	2018-11-20 17:05:03.986274522 +1300
++++ net-snmp-5.8/configure.d/config_os_misc4	2018-11-20 17:08:32.250700448 +1300
+@@ -116,9 +116,9 @@
+ 	[Path to the lpstat command])
+     AC_DEFINE(HAVE_LPSTAT, 1, [Set if the lpstat command is available])
+ fi
+-if test -r /etc/printcap; then
++AC_CHECK_FILE([/etc/printcap],
+     AC_DEFINE(HAVE_PRINTCAP, 1, [Set if /etc/printcap exists])
+-fi
++)
+ 
+ 
+ #       Check ps args
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +2 -0
index 4b1267b3c..08015c67b 100644
@@ -24,6 +24,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://0004-configure-fix-incorrect-variable.patch \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
+           file://reproducibility-have-printcap.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -68,6 +69,7 @@ CACHED_CONFIGUREVARS = " \
     ac_cv_ETC_MNTTAB=/etc/mtab \
     lt_cv_shlibpath_overrides_runpath=yes \
     ac_cv_path_UNAMEPROG=${base_bindir}/uname \
+    ac_cv_file__etc_printcap=no \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 net-snmp: Reproducibility: Set NETSNMP_CONFIGURE_OPTIONS null

In reply to Douglas Royds

To avoid build host paths being written into binaries, accept a null NETSNMP_CONFIGURE_OPTIONS from the environment.

Upstream-Status: Submitted https://sourceforge.net/p/net-snmp/patches/1384/

---
 ...bility-accept-configure-options-from-env.patch | 15 +++++++++++++++
 .../recipes-protocols/net-snmp/net-snmp_5.8.bb    |  2 ++
 2 files changed, 17 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch new file +15 -0
new file mode 100644
index 000000000..b0dbf5ad3
@@ -0,0 +1,15 @@
+Reproducible build: To avoid build host paths being written into binaries,
+accept NETSNMP_CONFIGURE_OPTIONS from the environment.
+NETSNMP_CONFIGURE_OPTIONS can be set either null or to a fixed value.
+
+--- net-snmp-5.8.original/configure.ac	2018-11-20 17:41:39.926529072 +1300
++++ net-snmp-5.8/configure.ac	2018-11-20 17:54:44.488180224 +1300
+@@ -28,7 +28,7 @@
+ #
+ # save the configure arguments
+ #
+-AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"$ac_configure_args",
++AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"${NETSNMP_CONFIGURE_OPTIONS-$ac_configure_args}",
+   [configure options specified])
+ CONFIGURE_OPTIONS="\"$ac_configure_args\""
+ AC_SUBST(CONFIGURE_OPTIONS)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +2 -0
index 08015c67b..e91d80af5 100644
@@ -25,6 +25,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
            file://reproducibility-have-printcap.patch \
+           file://reproducibility-accept-configure-options-from-env.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -70,6 +71,7 @@ CACHED_CONFIGUREVARS = " \
     lt_cv_shlibpath_overrides_runpath=yes \
     ac_cv_path_UNAMEPROG=${base_bindir}/uname \
     ac_cv_file__etc_printcap=no \
+    NETSNMP_CONFIGURE_OPTIONS= \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#6 lore raw

v2 cover net-snmp: Reproducibility

In reply to Douglas Royds

There was a breakage in the "Remove PKG_CONFIG paths" patch, in which I was unwittingly trimming the trailing close double quotes from the CFLAGS in net-snmp-config.

I have also added a readability improvement for the sed expressions in do_install().

Douglas Royds (6):
Revert "net-snmp: improve reproducibility"
net-snmp: Reproducibility: Fixed path to /bin/uname
net-snmp: Reproducibility: Remove PKG_CONFIG paths from net-snmp-config
net-snmp: Reproducibility: Don't check build host for /etc/printcap
net-snmp: Reproducibility: Set NETSNMP_CONFIGURE_OPTIONS null
net-snmp: Simplify sed expressions

 ...e-configure-options-from-versioninfo.patch | 42 -------------------
 ...ty-accept-configure-options-from-env.patch | 15 +++++++
 .../reproducibility-have-printcap.patch       | 19 +++++++++
 .../net-snmp/net-snmp_5.8.bb                  | 24 +++++------
 4 files changed, 46 insertions(+), 54 deletions(-)
 delete mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch
Signature · 1 line
2.17.1
#7 lore raw

PATCH v2 1/6 Revert "net-snmp: improve reproducibility"

This reverts commit 57d8e2c673d5f5686bbf411333f1d39c3e29690e.

---
 ...e-configure-options-from-versioninfo.patch | 42 -------------------
 .../net-snmp/net-snmp_5.8.bb                  |  7 ----
 2 files changed, 49 deletions(-)
 delete mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-remove-configure-options-from-versioninfo.patch deleted +0 -42
deleted file mode 100644
index 2d540967e..000000000
@@ -1,42 +0,0 @@
-From f592398b1c659f84168f5c84f63af3b71454b8f5 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <[email protected]>
-Date: Fri, 28 Sep 2018 22:59:23 +0800
-Subject: [PATCH] remove configure options from versioninfo
-
-Configure options contains host build paths which breaks
-binary reproducibility.
-
-It is no harm to remove it from version info.
-
-Upstream-Status: Inappropriate [cross compile specific]
-
-Signed-off-by: Hongxu Jia <[email protected]>
----
- agent/mibgroup/ucd-snmp/versioninfo.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/agent/mibgroup/ucd-snmp/versioninfo.c b/agent/mibgroup/ucd-snmp/versioninfo.c
-index a5151c1..1160382 100644
---- a/agent/mibgroup/ucd-snmp/versioninfo.c
-+++ b/agent/mibgroup/ucd-snmp/versioninfo.c
-@@ -92,7 +92,7 @@ var_extensible_version(struct variable *vp,
-     static char     errmsg[300];
-     char           *cptr;
-     time_t          curtime;
--#ifdef NETSNMP_CONFIGURE_OPTIONS
-+#if 0
-     static char     config_opts[] = NETSNMP_CONFIGURE_OPTIONS;
- #endif
- 
-@@ -126,7 +126,7 @@ var_extensible_version(struct variable *vp,
-         *var_len = strlen(errmsg);
-         return ((u_char *) errmsg);
-     case VERCONFIG:
--#ifdef NETSNMP_CONFIGURE_OPTIONS
-+#if 0
-         *var_len = strlen(config_opts);
-         if (*var_len > 1024)
-             *var_len = 1024;    /* mib imposed restriction */
--- 
-2.7.4
-
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +0 -7
index d47f9e4a3..a32d09d77 100644
@@ -24,7 +24,6 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://0004-configure-fix-incorrect-variable.patch \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
-           file://0001-remove-configure-options-from-versioninfo.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -169,12 +168,6 @@ net_snmp_sysroot_preprocess () {
     fi
 }
 
-PACKAGE_PREPROCESS_FUNCS += "net_snmp_package_preprocess"
-net_snmp_package_preprocess () {
-    sed -e 's@${RECIPE_SYSROOT}@@g' \
-       -i ${PKGD}${bindir}/net-snmp-config
-}
-
 PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \
              ${PN}-server-snmpd ${PN}-server-snmptrapd \
              ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 2/6 net-snmp: Reproducibility: Fixed path to /bin/uname

In reply to Douglas Royds
---
 meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb | 1 +
 1 file changed, 1 insertion(+)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +1 -0
index a32d09d77..089946032 100644
@@ -67,6 +67,7 @@ CACHED_CONFIGUREVARS = " \
     ac_cv_header_valgrind_memcheck_h=no \
     ac_cv_ETC_MNTTAB=/etc/mtab \
     lt_cv_shlibpath_overrides_runpath=yes \
+    ac_cv_path_UNAMEPROG=${base_bindir}/uname \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 3/6 net-snmp: Reproducibility: Remove PKG_CONFIG paths from net-snmp-config

In reply to Douglas Royds

PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR point into the net-snmp recipe-sysroot. Careful not to trim trailing quotes from the CFLAGS

---
 .../recipes-protocols/net-snmp/net-snmp_5.8.bb       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +7 -5
index 089946032..03fe24bdd 100644
@@ -114,11 +114,13 @@ do_install_append() {
     install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
     sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
         -i ${D}${bindir}/net-snmp-create-v3-user
-    sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
-           -e "s@\([^ ]*-fdebug-prefix-map=[^ ]*\)\1*@@g" \
-           -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
-           -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \
-           -e "s@\([^ ]*--with-install-prefix=[^ ]*\)\1*@@g" \
+    sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \
+        -e 's@\([^ ]*-fdebug-prefix-map=[^ "]*\)\1*@@g' \
+        -e 's@\([^ ]*--sysroot=[^ "]*\)\1*@@g' \
+        -e 's@\([^ ]*--with-libtool-sysroot=[^ "]*\)\1*@@g' \
+        -e 's@\([^ ]*--with-install-prefix=[^ "]*\)\1*@@g' \
+        -e 's@\([^ ]*PKG_CONFIG_PATH=[^ "]*\)\1*@@g' \
+        -e 's@\([^ ]*PKG_CONFIG_LIBDIR=[^ "]*\)\1*@@g' \
         -i ${D}${bindir}/net-snmp-config
 
     if [ "${HAS_PERL}" = "1" ]; then
Signature · 1 line
2.17.1
#10 lore raw

PATCH v2 4/6 net-snmp: Reproducibility: Don't check build host for /etc/printcap

In reply to Douglas Royds

Don't check for /etc/printcap on the build machine when cross-compiling. Use AC_CHECK_FILE to set the cached variable ac_cv_file__etc_printcap instead. When cross-compiling, this variable should be set in the environment to "yes" or "no" as appropriate for the target platform.

I have taken the simple expedient of setting ac_cv_file__etc_printcap=no. If this proves to be a problem, we can easily add a new variable, HAS_PRINTCAP.

Upstream-Status: Submitted https://sourceforge.net/p/net-snmp/patches/1385/

---
 .../reproducibility-have-printcap.patch       | 19 +++++++++++++++++++
 .../net-snmp/net-snmp_5.8.bb                  |  2 ++
 2 files changed, 21 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-have-printcap.patch new file +19 -0
new file mode 100644
index 000000000..4316c7a71
@@ -0,0 +1,19 @@
+Reproducible build: Don't check for /etc/printcap on the build machine when
+cross-compiling. Use AC_CHECK_FILE to set the cached variable
+ac_cv_file__etc_printcap instead. When cross-compiling, this variable should be
+set in the environment to "yes" or "no" as appropriate for the target platform.
+
+--- net-snmp-5.8.original/configure.d/config_os_misc4	2018-11-20 17:05:03.986274522 +1300
++++ net-snmp-5.8/configure.d/config_os_misc4	2018-11-20 17:08:32.250700448 +1300
+@@ -116,9 +116,9 @@
+ 	[Path to the lpstat command])
+     AC_DEFINE(HAVE_LPSTAT, 1, [Set if the lpstat command is available])
+ fi
+-if test -r /etc/printcap; then
++AC_CHECK_FILE([/etc/printcap],
+     AC_DEFINE(HAVE_PRINTCAP, 1, [Set if /etc/printcap exists])
+-fi
++)
+ 
+ 
+ #       Check ps args
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +2 -0
index 03fe24bdd..f556c5898 100644
@@ -24,6 +24,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://0004-configure-fix-incorrect-variable.patch \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
+           file://reproducibility-have-printcap.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -68,6 +69,7 @@ CACHED_CONFIGUREVARS = " \
     ac_cv_ETC_MNTTAB=/etc/mtab \
     lt_cv_shlibpath_overrides_runpath=yes \
     ac_cv_path_UNAMEPROG=${base_bindir}/uname \
+    ac_cv_file__etc_printcap=no \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#11 lore raw

PATCH v2 5/6 net-snmp: Reproducibility: Set NETSNMP_CONFIGURE_OPTIONS null

In reply to Douglas Royds

To avoid build host paths being written into binaries, accept a null NETSNMP_CONFIGURE_OPTIONS from the environment.

Upstream-Status: Submitted https://sourceforge.net/p/net-snmp/patches/1384/

---
 ...bility-accept-configure-options-from-env.patch | 15 +++++++++++++++
 .../recipes-protocols/net-snmp/net-snmp_5.8.bb    |  2 ++
 2 files changed, 17 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch
meta-networking/recipes-protocols/net-snmp/net-snmp/reproducibility-accept-configure-options-from-env.patch new file +15 -0
new file mode 100644
index 000000000..b0dbf5ad3
@@ -0,0 +1,15 @@
+Reproducible build: To avoid build host paths being written into binaries,
+accept NETSNMP_CONFIGURE_OPTIONS from the environment.
+NETSNMP_CONFIGURE_OPTIONS can be set either null or to a fixed value.
+
+--- net-snmp-5.8.original/configure.ac	2018-11-20 17:41:39.926529072 +1300
++++ net-snmp-5.8/configure.ac	2018-11-20 17:54:44.488180224 +1300
+@@ -28,7 +28,7 @@
+ #
+ # save the configure arguments
+ #
+-AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"$ac_configure_args",
++AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"${NETSNMP_CONFIGURE_OPTIONS-$ac_configure_args}",
+   [configure options specified])
+ CONFIGURE_OPTIONS="\"$ac_configure_args\""
+ AC_SUBST(CONFIGURE_OPTIONS)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +2 -0
index f556c5898..2a0d88ab2 100644
@@ -25,6 +25,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
            file://net-snmp-fix-for-disable-des.patch \
            file://reproducibility-have-printcap.patch \
+           file://reproducibility-accept-configure-options-from-env.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
@@ -70,6 +71,7 @@ CACHED_CONFIGUREVARS = " \
     lt_cv_shlibpath_overrides_runpath=yes \
     ac_cv_path_UNAMEPROG=${base_bindir}/uname \
     ac_cv_file__etc_printcap=no \
+    NETSNMP_CONFIGURE_OPTIONS= \
 "
 export PERLPROG="${bindir}/env perl"
 PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Signature · 1 line
2.17.1
#12 lore raw

PATCH v2 6/6 net-snmp: Simplify sed expressions

In reply to Douglas Royds

Readability.
The existing patterns allowed each pattern to be matched multiple times (with no intevening spaces), but the "g" modifier achieves this anyway.

---
 .../recipes-protocols/net-snmp/net-snmp_5.8.bb       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb +6 -6
index 2a0d88ab2..7794f3880 100644
@@ -119,12 +119,12 @@ do_install_append() {
     sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
         -i ${D}${bindir}/net-snmp-create-v3-user
     sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \
-        -e 's@\([^ ]*-fdebug-prefix-map=[^ "]*\)\1*@@g' \
-        -e 's@\([^ ]*--sysroot=[^ "]*\)\1*@@g' \
-        -e 's@\([^ ]*--with-libtool-sysroot=[^ "]*\)\1*@@g' \
-        -e 's@\([^ ]*--with-install-prefix=[^ "]*\)\1*@@g' \
-        -e 's@\([^ ]*PKG_CONFIG_PATH=[^ "]*\)\1*@@g' \
-        -e 's@\([^ ]*PKG_CONFIG_LIBDIR=[^ "]*\)\1*@@g' \
+        -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \
+        -e 's@[^ ]*--sysroot=[^ "]*@@g' \
+        -e 's@[^ ]*--with-libtool-sysroot=[^ "]*@@g' \
+        -e 's@[^ ]*--with-install-prefix=[^ "]*@@g' \
+        -e 's@[^ ]*PKG_CONFIG_PATH=[^ "]*@@g' \
+        -e 's@[^ ]*PKG_CONFIG_LIBDIR=[^ "]*@@g' \
         -i ${D}${bindir}/net-snmp-config
 
     if [ "${HAS_PERL}" = "1" ]; then
Signature · 1 line
2.17.1