[Reproducible-builds] [PATCH] DocBook: Fix non-determinstic installation of duplicate man pages

Ben Hutchings ben at decadent.org.uk
Thu Aug 6 22:36:52 UTC 2015


Some kernel-doc sections are included in multiple DocBook files.  This
means the mandocs target will generate the same manual page multiple
times with different metadata (author name/address and manual title,
taken from the including DocBook file).  If it's invoked in a parallel
build, the output is non-determinstic.

Build the manual pages in a separate subdirectory per DocBook file,
then sort and de-duplicate when installing them (which is serialised).

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
Please apply this after reverting my earlier attempt, "DocBook: Fix
duplicate man pages".

Ben.

 Documentation/DocBook/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -60,7 +60,9 @@ mandocs: $(MAN)
 
 installmandocs: mandocs
 	mkdir -p /usr/local/man/man9/
-	install $(obj)/man/*.9.gz /usr/local/man/man9/
+	find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \
+		sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \
+		xargs install -t /usr/local/man/man9/
 
 ###
 #External programs used
@@ -150,12 +152,12 @@ quiet_cmd_db2html = HTML    $@
             cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
 
 quiet_cmd_db2man = MAN     $@
-      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; fi
+      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man/$(*F) $< ; fi
 %.9 : %.xml
 	@(which xmlto > /dev/null 2>&1) || \
 	 (echo "*** You need to install xmlto ***"; \
 	  exit 1)
-	$(Q)mkdir -p $(obj)/man
+	$(Q)mkdir -p $(obj)/man/$(*F)
 	$(call cmd,db2man)
 	@touch $@
 
-- 
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20150806/9b1c90b5/attachment.sig>


More information about the Reproducible-builds mailing list