diff mbox series

[meta-networking,v2,2/2] drbd-utils: Fix a udev rule reproducibility

Message ID 20240305095750.1667336-2-yoann.congal@smile.fr
State Accepted
Headers show
Series [meta-networking,v2,1/2] drbd-utils: Drop a duplicated line in DESCRIPTION | expand

Commit Message

Yoann Congal March 5, 2024, 9:57 a.m. UTC
drbd-utils configure step check the build host udev version to enable
or disable the target udev rule. This leads to a clear
non-reproducibility.

This patch fixes this by adding a configure option to the configure step
which allows to skip the udev version checks and unconditionally enable
the udev rule.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
v1->v2:
* Rebased on master (which updated to 9.27.0)
* Update patch upstream status as it was merged in the meantime
---
 ...-an-option-to-disable-host-udev-vers.patch | 55 +++++++++++++++++++
 .../recipes-support/drbd/drbd-utils_9.27.0.bb |  2 +
 2 files changed, 57 insertions(+)
 create mode 100644 meta-networking/recipes-support/drbd/drbd-utils/0001-configure.ac-Add-an-option-to-disable-host-udev-vers.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/drbd/drbd-utils/0001-configure.ac-Add-an-option-to-disable-host-udev-vers.patch b/meta-networking/recipes-support/drbd/drbd-utils/0001-configure.ac-Add-an-option-to-disable-host-udev-vers.patch
new file mode 100644
index 000000000..b98e1e70c
--- /dev/null
+++ b/meta-networking/recipes-support/drbd/drbd-utils/0001-configure.ac-Add-an-option-to-disable-host-udev-vers.patch
@@ -0,0 +1,55 @@ 
+From 61991db099f66348dddbc3408e7ee8c05bda85cb Mon Sep 17 00:00:00 2001
+From: Yoann Congal <yoann.congal@smile.fr>
+Date: Sat, 2 Mar 2024 16:23:07 +0100
+Subject: [PATCH] configure.ac: Add an option to disable host udev version
+ checks
+
+In cross-compilation environment, the build host might have an outdated
+udev or no udev at all. But the user may still want to build with the
+enabled udev rule (for its udev-enabled target).
+
+This patch adds a "--disable-udevchecks" option the disable build host
+udev version check at configure-time and unconditionally install the
+enabled udev rule. Without this new option, the behavior stays the same
+(checks enabled).
+
+Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
+Upstream-Status: Backport [https://github.com/LINBIT/drbd-utils/commit/f2b5a7335ae52109dfb95a9d99ae20519c43d59a]
+---
+ configure.ac | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f1d69ea3..4c56d33b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -71,6 +71,11 @@ AC_ARG_WITH([udev],
+ 	[AS_HELP_STRING([--with-udev],
+ 			[Enable udev integration])],
+ 	[WITH_UDEV=$withval])
++AC_ARG_ENABLE([udevchecks],
++	[AS_HELP_STRING([--disable-udevchecks],
++			[Disable host udev version checks])],
++	[],
++	[enable_udevchecks=yes])
+ AC_ARG_WITH([xen],
+ 	[AS_HELP_STRING([--with-xen],
+ 			[Enable Xen integration])],
+@@ -315,7 +320,7 @@ if test -z $GIT; then
+    AC_MSG_WARN(Cannot update buildtag without git. You may safely ignore this warning when building from a tarball.)
+ fi
+ 
+-if test $UDEVADM = false && test $UDEVINFO = false; then
++if test "x$enable_udevchecks" != "xno" && test $UDEVADM = false && test $UDEVINFO = false; then
+    if test "$WITH_UDEV" = "yes"; then
+      AC_MSG_WARN([udev support enabled, but neither udevadm nor udevinfo found on this system.])
+    fi
+@@ -423,7 +428,7 @@ else
+     test -z $INITDIR && INITDIR="$sysconfdir/init.d"
+ 
+     dnl Our udev rules file is known to work only with udev >= 85
+-    if test "$WITH_UDEV" = "yes"; then
++    if test "x$enable_udevchecks" != "xno" && test "$WITH_UDEV" = "yes"; then
+        udev_version=$( set -- $($UDEVADM version); echo $1 )
+        if test -z "$udev_version"; then
+ 	    udev_version=$( set -- $($UDEVINFO -V); echo $3 )
diff --git a/meta-networking/recipes-support/drbd/drbd-utils_9.27.0.bb b/meta-networking/recipes-support/drbd/drbd-utils_9.27.0.bb
index c99717839..63f0fd18c 100644
--- a/meta-networking/recipes-support/drbd/drbd-utils_9.27.0.bb
+++ b/meta-networking/recipes-support/drbd/drbd-utils_9.27.0.bb
@@ -11,6 +11,7 @@  SRC_URI = "git://github.com/LINBIT/drbd-utils;name=drbd-utils;branch=master;prot
            git://github.com/LINBIT/drbd-headers;name=drbd-headers;destsuffix=git/drbd-headers;branch=master;protocol=https \
            file://0001-drbdmon-add-LDFLAGS-when-linking.patch \
            ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','file://0001-drbd-utils-support-usrmerge.patch','',d)} \
+           file://0001-configure.ac-Add-an-option-to-disable-host-udev-vers.patch \
            "
 SRCREV_drbd-utils = "fdd9a4d603a9dc99d110d8bd0e288d7c0b6f586e"
 SRCREV_drbd-headers = "0349f00825b4198d4ec3248f43884114a187676a"
@@ -40,6 +41,7 @@  EXTRA_OECONF = " \
                 --with-initscripttype=both    \
                 --with-systemdunitdir=${systemd_unitdir}/system \
                 --without-manual \
+                --disable-udevchecks \
                "
 
 # If we have inherited reproducible_build, we want to use it.