diff mbox series

[meta-oe] multipath-tool: Fix reproducibility issue on libdmmp docs/man pages

Message ID 20250414115836.13712-1-kelefa.sane@smile.fr
State Accepted
Headers show
Series [meta-oe] multipath-tool: Fix reproducibility issue on libdmmp docs/man pages | expand

Commit Message

kelefa.sane@smile.fr April 14, 2025, 11:58 a.m. UTC
From: Kéléfa Sané <kelefa.sane@smile.fr>

Reproducibility test reveal different timestamp values in docs/man
pages. The root cause is due to the makefile target rule which update
the timestamp not always beeing executed, depending on the order, the
target (dmmp_strerror.3) and prerequisite (libdmmp.h) are written on the
disk during the clone of the repo.

Update recipe to set the KBUILD_BUILD_TIMESTAMP to reproducible
timestamp (SOURCE_DATE_EPOCH).

Signed-off-by: Kéléfa Sané <kelefa.sane@smile.fr>
---
 ...ile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch | 29 +++++++++++++
 ...-Add-target-docs-man-dmmp_strerror.3.patch | 41 +++++++++++++++++++
 .../multipath-tools/multipath-tools_0.11.1.bb |  3 ++
 3 files changed, 73 insertions(+)
 create mode 100644 meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
 create mode 100644 meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch

Comments

Yoann Congal April 14, 2025, 12:11 p.m. UTC | #1
Le lun. 14 avr. 2025 à 13:58, kelefa.sane via lists.openembedded.org
<kelefa.sane=smile.fr@lists.openembedded.org> a écrit :
>
> From: Kéléfa Sané <kelefa.sane@smile.fr>
>
> Reproducibility test reveal different timestamp values in docs/man
> pages. The root cause is due to the makefile target rule which update
> the timestamp not always beeing executed, depending on the order, the
> target (dmmp_strerror.3) and prerequisite (libdmmp.h) are written on the
> disk during the clone of the repo.
>
> Update recipe to set the KBUILD_BUILD_TIMESTAMP to reproducible
> timestamp (SOURCE_DATE_EPOCH).
>
> Signed-off-by: Kéléfa Sané <kelefa.sane@smile.fr>

Reviewed-by: Yoann Congal <yoann.congal@smile.fr>

> ---
>  ...ile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch | 29 +++++++++++++
>  ...-Add-target-docs-man-dmmp_strerror.3.patch | 41 +++++++++++++++++++
>  .../multipath-tools/multipath-tools_0.11.1.bb |  3 ++
>  3 files changed, 73 insertions(+)
>  create mode 100644 meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
>  create mode 100644 meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch
>
> diff --git a/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch b/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
> new file mode 100644
> index 000000000..4cca7decb
> --- /dev/null
> +++ b/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
> @@ -0,0 +1,29 @@
> +From bcb052a8dadbd0a837986b1e15924b469fc59edc Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
> +Date: Thu, 3 Apr 2025 10:08:49 +0200
> +Subject: [PATCH] libdmmp/Makefile: Fix KBUILD_BUILD_TIMESTAMP usage
> +
> +Add missing $ (Makefile need to escape '$' as '$$')
> +
> +Upstream-Status: Submitted [https://lore.kernel.org/dm-devel/20250404122902.2750036-1-sofiane.hamam@smile.fr/]
> +
> +Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> +Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
> +Signed-off-by: Kelefa Sane <kelefa.sane@smile.fr>
> +---
> + libdmmp/Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/libdmmp/Makefile b/libdmmp/Makefile
> +index 172ba045..7e0e2509 100644
> +--- a/libdmmp/Makefile
> ++++ b/libdmmp/Makefile
> +@@ -74,7 +74,7 @@ doc: docs/man/dmmp_strerror.3
> + docs/man/dmmp_strerror.3:     $(HEADERS)
> +       $(Q)TEMPFILE=$(shell mktemp); \
> +       cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
> +-      [ "$KBUILD_BUILD_TIMESTAMP" ] || \
> ++      [ "$$KBUILD_BUILD_TIMESTAMP" ] || \
> +           KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^`; \
> +       export KBUILD_BUILD_TIMESTAMP; \
> +       LC_ALL=C \
> diff --git a/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch b/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch
> new file mode 100644
> index 000000000..aad46c229
> --- /dev/null
> +++ b/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch
> @@ -0,0 +1,41 @@
> +From 6e231d887c20b2139db75e6dc6c20107273aaacd Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
> +Date: Thu, 3 Apr 2025 10:25:30 +0200
> +Subject: [PATCH] libdmmp/Makefile: Add target docs/man/dmmp_strerror.3 to
> + .PHONY list
> +
> +When cloning git repos, depending on the order of written to the disk, target
> +docs/man/dmmp_strerror.3 is more recent that the prerequisite
> +libdmmp/libdmmp.h this leads to a non reproducible behavior:
> +Sometimes, the timestamps are updated in the man pages, sometimes not.
> +
> +Upstream-Status: Denied
> +
> +https://lore.kernel.org/dm-devel/72355f1d0984647e91f8c50f1c2295071af49e33.camel@suse.com/
> +The patch has been rejected by upstream, who will update the timestamps of the
> +manpages with a new commit.
> +In order to be reproducible without having a random result, forcing the target
> +rebuild by adding it to .PHONY is the more acceptable solution, the alternative
> +would have been to use the make -B option which consider all target has
> +obsolete and rebuild them all, which is less efficient.
> +
> +Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> +Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
> +Signed-off-by: Kelefa Sane <kelefa.sane@smile.fr>
> +---
> + libdmmp/Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/libdmmp/Makefile b/libdmmp/Makefile
> +index 7e0e2509..187bcb8c 100644
> +--- a/libdmmp/Makefile
> ++++ b/libdmmp/Makefile
> +@@ -20,7 +20,7 @@ CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden
> + LIBDEPS += $(shell $(PKG_CONFIG) --libs json-c) -L$(mpathcmddir) -lmpathcmd -lpthread
> +
> + all: $(LIBS) doc
> +-.PHONY:       doc clean install uninstall check speed_test dep_clean
> ++.PHONY:       doc clean install uninstall check speed_test dep_clean docs/man/dmmp_strerror.3
> +
> + $(LIBS): $(OBJS)
> +       $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
> diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
> index 3037d0da8..3443175d2 100644
> --- a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
> +++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
> @@ -45,6 +45,8 @@ SRC_URI = "git://github.com/opensvc/multipath-tools.git;protocol=https;branch=st
>             file://0011-fix-bug-of-do_compile-and-do_install.patch \
>             file://0012-add-explicit-dependency-on-libraries.patch \
>             file://0001-libmpathutils-uxsock.c-Include-string.h-for-memcpy.patch \
> +           file://0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch \
> +           file://0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch \
>             "
>
>  LIC_FILES_CHKSUM = "file://COPYING;md5=9ec28527f3d544b51ceb0e1907d0bf3f"
> @@ -83,6 +85,7 @@ EXTRA_OEMAKE = 'MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} \
>                  modulesloaddir=${sysconfdir}/modules-load.d \
>                  tmpfilesdir=${sysconfdir}/tmpfiles.d \
>                  ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "SYSTEMD=216", "", d)} \
> +                KBUILD_BUILD_TIMESTAMP="$(date -u -d "@$SOURCE_DATE_EPOCH" +"%Y-%m-%d %H:%M:%S +0000")" \
>                 '
>
>  do_install() {
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#116851): https://lists.openembedded.org/g/openembedded-devel/message/116851
> Mute This Topic: https://lists.openembedded.org/mt/112255387/4316185
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch b/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
new file mode 100644
index 000000000..4cca7decb
--- /dev/null
+++ b/meta-oe/recipes-support/multipath-tools/files/0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch
@@ -0,0 +1,29 @@ 
+From bcb052a8dadbd0a837986b1e15924b469fc59edc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
+Date: Thu, 3 Apr 2025 10:08:49 +0200
+Subject: [PATCH] libdmmp/Makefile: Fix KBUILD_BUILD_TIMESTAMP usage
+
+Add missing $ (Makefile need to escape '$' as '$$')
+
+Upstream-Status: Submitted [https://lore.kernel.org/dm-devel/20250404122902.2750036-1-sofiane.hamam@smile.fr/]
+
+Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
+Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
+Signed-off-by: Kelefa Sane <kelefa.sane@smile.fr>
+---
+ libdmmp/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libdmmp/Makefile b/libdmmp/Makefile
+index 172ba045..7e0e2509 100644
+--- a/libdmmp/Makefile
++++ b/libdmmp/Makefile
+@@ -74,7 +74,7 @@ doc: docs/man/dmmp_strerror.3
+ docs/man/dmmp_strerror.3:	$(HEADERS)
+ 	$(Q)TEMPFILE=$(shell mktemp); \
+ 	cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
+-	[ "$KBUILD_BUILD_TIMESTAMP" ] || \
++	[ "$$KBUILD_BUILD_TIMESTAMP" ] || \
+ 	    KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^`; \
+ 	export KBUILD_BUILD_TIMESTAMP; \
+ 	LC_ALL=C \
diff --git a/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch b/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch
new file mode 100644
index 000000000..aad46c229
--- /dev/null
+++ b/meta-oe/recipes-support/multipath-tools/files/0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch
@@ -0,0 +1,41 @@ 
+From 6e231d887c20b2139db75e6dc6c20107273aaacd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
+Date: Thu, 3 Apr 2025 10:25:30 +0200
+Subject: [PATCH] libdmmp/Makefile: Add target docs/man/dmmp_strerror.3 to
+ .PHONY list
+
+When cloning git repos, depending on the order of written to the disk, target
+docs/man/dmmp_strerror.3 is more recent that the prerequisite
+libdmmp/libdmmp.h this leads to a non reproducible behavior:
+Sometimes, the timestamps are updated in the man pages, sometimes not.
+
+Upstream-Status: Denied
+
+https://lore.kernel.org/dm-devel/72355f1d0984647e91f8c50f1c2295071af49e33.camel@suse.com/
+The patch has been rejected by upstream, who will update the timestamps of the 
+manpages with a new commit.
+In order to be reproducible without having a random result, forcing the target
+rebuild by adding it to .PHONY is the more acceptable solution, the alternative
+would have been to use the make -B option which consider all target has
+obsolete and rebuild them all, which is less efficient.
+
+Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
+Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
+Signed-off-by: Kelefa Sane <kelefa.sane@smile.fr>
+---
+ libdmmp/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libdmmp/Makefile b/libdmmp/Makefile
+index 7e0e2509..187bcb8c 100644
+--- a/libdmmp/Makefile
++++ b/libdmmp/Makefile
+@@ -20,7 +20,7 @@ CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden
+ LIBDEPS += $(shell $(PKG_CONFIG) --libs json-c) -L$(mpathcmddir) -lmpathcmd -lpthread
+ 
+ all: $(LIBS) doc
+-.PHONY:	doc clean install uninstall check speed_test dep_clean
++.PHONY:	doc clean install uninstall check speed_test dep_clean docs/man/dmmp_strerror.3
+ 
+ $(LIBS): $(OBJS)
+ 	$(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
index 3037d0da8..3443175d2 100644
--- a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
+++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.11.1.bb
@@ -45,6 +45,8 @@  SRC_URI = "git://github.com/opensvc/multipath-tools.git;protocol=https;branch=st
            file://0011-fix-bug-of-do_compile-and-do_install.patch \
            file://0012-add-explicit-dependency-on-libraries.patch \
            file://0001-libmpathutils-uxsock.c-Include-string.h-for-memcpy.patch \
+           file://0013-libdmmp-Makefile-Fix-KBUILD_BUILD_TIMESTAMP-usage.patch \
+           file://0014-libdmmp-Makefile-Add-target-docs-man-dmmp_strerror.3.patch \
            "
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=9ec28527f3d544b51ceb0e1907d0bf3f"
@@ -83,6 +85,7 @@  EXTRA_OEMAKE = 'MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} \
                 modulesloaddir=${sysconfdir}/modules-load.d \
                 tmpfilesdir=${sysconfdir}/tmpfiles.d \
                 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "SYSTEMD=216", "", d)} \
+                KBUILD_BUILD_TIMESTAMP="$(date -u -d "@$SOURCE_DATE_EPOCH" +"%Y-%m-%d %H:%M:%S +0000")" \
                '
 
 do_install() {