multipath-tool: Fix reproducibility issue on libdmmp docs/man pages

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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Kéléfa Sané
2025-04-14 13:58:36 +02:00
committed by Khem Raj
parent d6c334c526
commit ac086f2f51
3 changed files with 73 additions and 0 deletions
@@ -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 \
@@ -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)
@@ -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() {