Skip to contentSkip to conversation

multipath-tools build: accept KBUILD_BUILD_TIMESTAMP from env

PATCH In review Chris Hofstaedtler 3 participants 3 messages Jun 6, 2023 – Jul 10, 2023 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath-tools build: accept KBUILD_BUILD_TIMESTAMP from env

From: Chris Lamb <[email protected]>

It would appear KBUILD_BUILD_TIMESTAMP is meant to be used the same way as in the linux kernel build. For linux, builders are supposed to set KBUILD_BUILD_TIMESTAMP in the environment if they want a stable timestamp.

The libddmmp makefile however tries to directly call git to get a timestamp, which fails in a typical Debian build environment, which is not a full git source tree.

Have libdmmp/Makefile use KBUILD_BUILD_TIMESTAMP from the environment if available, otherwise use git as before.

---
 libdmmp/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/Makefile +1 -1
index 9ece9528..601933aa 100644
@@ -75,7 +75,7 @@ docs/man/dmmp_strerror.3:	$(HEADERS)
 	$(Q)TEMPFILE=$(shell mktemp); \
 	cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
 	LC_ALL=C \
-	KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^` \
+	KBUILD_BUILD_TIMESTAMP=`echo $$KBUILD_BUILD_TIMESTAMP | grep . || git log -n1 --pretty=%cd --date=iso -- $^` \
 	perl docs/kernel-doc -man $$TEMPFILE | \
 	    perl docs/split-man.pl docs/man; \
 	$(RM) -f $$TEMPFILE
Signature · 6 lines
2.39.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
#1 lore raw
Quoted 36 lines · Chris Hofstaedtler

From: Chris Lamb <[email protected]>

It would appear KBUILD_BUILD_TIMESTAMP is meant to be used the same way as in
the linux kernel build. For linux, builders are supposed to set KBUILD_BUILD_TIMESTAMP in the environment if they want a stable timestamp.

The libddmmp makefile however tries to directly call git to get a timestamp,
which fails in a typical Debian build environment, which is not a full git
source tree.

Have libdmmp/Makefile use KBUILD_BUILD_TIMESTAMP from the environment if
available, otherwise use git as before.

---
 libdmmp/Makefile | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/Makefile +1 -2
index 9ece9528..601933aa 100644
@@ -75,7 +75,7 @@ docs/man/dmmp_strerror.3:     $(HEADERS)
         $(Q)TEMPFILE=$(shell mktemp); \
         cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
         LC_ALL=C \
-       KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -
- $^` \
+       KBUILD_BUILD_TIMESTAMP=`echo $$KBUILD_BUILD_TIMESTAMP | grep
 . || git log -n1 --pretty=%cd --date=iso -- $^` \
         perl docs/kernel-doc -man $$TEMPFILE | \
Quoted 2 lines

            perl docs/split-man.pl docs/man; \
        $(RM) -f $$TEMPFILE

Thanks.

Can we do this instead? It looks slightly more readable to me.

libdmmp/Makefile +3 -1
index 6d28caf..3912031 100644
@@ -74,8 +74,10 @@ 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=`git log -n1 --pretty=%cd --date=iso -- $^`; \
+       export KBUILD_BUILD_TIMESTAMP; \
        LC_ALL=C \
-       KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^` \
        perl docs/kernel-doc -man $$TEMPFILE | \
            perl docs/split-man.pl docs/man; \
        $(RM) -f $$TEMPFILE

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#2 lore raw
Quoted 1 line · Martin Wilck

Can we do this instead? It looks slightly more readable to me.

LGTM.

Regards,

Signature · 9 lines
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] 🍥 chris-lamb.co.uk
       `-

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel