[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#919887: debian-edu-doc: should include release date (=SOURCE_DATE_EPOCH)



package: debian-edu-doc
version: 2.10.12

Hi,

with the changes in 2.10.11 and 2.10.12, debian-edu-doc finally builds
reproducibly, yay.

However, the Buster manual now doesnt indicate from which time it is,
which is a bit annoying. The package of course has it, but that's
non-intuitive. Adding it as a string into
https://wiki.debian.org/DebianEdu/Documentation/Buster would work, but
also cause extra manual work constantly.

As such, I think we should teach dblatex to include the date coming from
$SOURCE_DATE_EPOCH, which is set by dpkg-dev during the build process.

With these change the date was still on the frontpage, but it was the
current date... (not SOURCE_DATE_EPOCH)

$ git diff 2.10.10..2.10.11 documentation/common debian/changelog
diff --git a/debian/changelog b/debian/changelog
index 8e8ff4e0..668d2216 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,31 @@
+debian-edu-doc (2.10.11) unstable; urgency=medium
+
[...]
+  [ Wolfgang Schweer ]
+  * documentation/common/Makefile.common:
+    - use SOURCE_DATE_EPOCH by setting SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 for
+      the dblatex call to generate the PDF and EPUB manuals. Also, in case of
+      EPUB files the generated article ID is unique and needs to be tweaked
+      and (being a zip file) strip-nondeterminism is used to get rid of the
+      remaining difference.
+      With these changes the manuals can be built reproducibly.
+  * debian/control:
+    - Add strip-nondeterminism to Build-Depends-Indep.
+
+  [ Holger Levsen ]
+  * documentation/common/Makefile.common: use SOURCE_DATE_EPOCH correctly.
[...]
+ -- Holger Levsen <holger@debian.org>  Fri, 18 Jan 2019 23:16:48 +0100
+
 debian-edu-doc (2.10.10) unstable; urgency=medium
 
   [ Translation updates ]
diff --git a/documentation/common/Makefile.common b/documentation/common/Makefile.common
index e440aa67..09fd86ed 100644
--- a/documentation/common/Makefile.common
+++ b/documentation/common/Makefile.common
@@ -10,7 +10,7 @@ LANGUAGES = $(subst $(name).,,$(subst .po,,$(wildcard *.po)))
 # Program name and option
 DBTOEPUB = dbtoepub
 XP = xsltproc --nonet --novalid --xinclude ../common/html.xsl
-DBLATEX = dblatex -T db2latex -b xetex -p ../common/dblatex.xsl
+DBLATEX = SOURCE_DATE_EPOCH=$$SOURCE_DATE_EPOCH SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 dblatex -T db2latex -b xetex -p ../common/dblatex.xsl
 SED_JA_REGEX = 's/dbtimestamp/dbtimestamp\ format=\"Y\ 年\ m\ 月\ d\ 日\"/'
 
 # Use Make internal function 'subst': substitute -manual with nothing to get
@@ -63,6 +63,14 @@ build-epub:
        # build the English EPUB version
        echo "Creating epub for en"
        $(DBTOEPUB) $(name).xml
+       unzip -q $(name).epub -d epub
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
+       find epub -exec touch -d @0 {} \;
+       rm $(name).epub
+       zip -q -r -o $(name).epub epub/
+       rm -rf epub/
+       strip-nondeterminism -t zip $(name).epub
        # build all other EPUB versions
        -for LINGUA in $(LANGUAGES) ; do \
                echo "Creating epub for $$LINGUA"; \
@@ -105,10 +113,26 @@ endif
 ifndef LINGUA
 epub:
        $(DBTOEPUB) $(name).xml
+       unzip -q $(name).epub -d epub
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
+       find epub -exec touch -d @0 {} \;
+       rm $(name).epub
+       zip -q -r -o $(name).epub epub/
+       rm -rf epub/
+       strip-nondeterminism -t zip $(name).epub
 else
 epub:
        po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
        $(DBTOEPUB) $(name).$(LINGUA).xml
+       unzip -q $(name).$(LINGUA).epub -d epub
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
+       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
+       find epub -exec touch -d @0 {} \;
+       rm $(name).$(LINGUA).epub
+       zip -q -r -o $(name).$(LINGUA).epub epub/
+       rm -rf epub/
+       strip-nondeterminism -t zip $(name).$(LINGUA).epub
 endif
 
 install: build
@@ -154,6 +178,16 @@ install: build
                fi ; \
                if [ -e $(name).$$f.epub ] ; then \
                        cp $(name).$$f.epub $$LANGPATH/$(name).epub ; \
+                       cd $$LANGPATH ; \
+                       unzip -q $(name).epub -d epub ; \
+                       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf ; \
+                       sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx ; \
+                       find epub -exec touch -d @0 {} \; ; \
+                       rm $(name).epub ; \
+                       zip -q -r -o $(name).epub epub/ ; \
+                       rm -rf epub/ ; \
+                       strip-nondeterminism -t zip $(name).epub ; \
+                       cd - ; \
                fi ; \
        done            
        rm $(DESTDIR)/debian-edu-doc-en/$(DESTPATH)/debian-edu-doc-en/$(name)-images/*.pdf ; \

these changes removed the date from the frontpage:

$ git diff 2.10.11..2.10.12 documentation/common debian/changelog
diff --git a/debian/changelog b/debian/changelog
index 668d2216..1da69fcf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+debian-edu-doc (2.10.12) unstable; urgency=medium
+
+  [ Wolfgang Schweer ]
+  * Don't show the date (actually revision date) on the title page of PDF
+    manuals; these changes are needed:
+    - Makefile.common: Use native instead of db2latex type.
+    - dblatex.xsl: Drop collaborator and revision history information.
+
+ -- Holger Levsen <holger@debian.org>  Sun, 20 Jan 2019 14:47:44 +0100
+
 debian-edu-doc (2.10.11) unstable; urgency=medium
 
   [ Translation updates ]
diff --git a/documentation/common/Makefile.common b/documentation/common/Makefile.common
index 09fd86ed..22e77c1f 100644
--- a/documentation/common/Makefile.common
+++ b/documentation/common/Makefile.common
@@ -10,7 +10,7 @@ LANGUAGES = $(subst $(name).,,$(subst .po,,$(wildcard *.po)))
 # Program name and option
 DBTOEPUB = dbtoepub
 XP = xsltproc --nonet --novalid --xinclude ../common/html.xsl
-DBLATEX = SOURCE_DATE_EPOCH=$$SOURCE_DATE_EPOCH SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 dblatex -T db2latex -b xetex -p ../common/dblatex.xsl
+DBLATEX = SOURCE_DATE_EPOCH=$$SOURCE_DATE_EPOCH SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 dblatex -T native -b xetex -p ../common/dblatex.xsl
 SED_JA_REGEX = 's/dbtimestamp/dbtimestamp\ format=\"Y\ 年\ m\ 月\ d\ 日\"/'
 
 # Use Make internal function 'subst': substitute -manual with nothing to get
diff --git a/documentation/common/dblatex.xsl b/documentation/common/dblatex.xsl
index 79dca983..0818838c 100644
--- a/documentation/common/dblatex.xsl
+++ b/documentation/common/dblatex.xsl
@@ -27,4 +27,6 @@
    </xsl:choose>
   </xsl:param>
   <xsl:param name="toc.section.depth">3</xsl:param>
+  <xsl:param name="doc.collab.show">0</xsl:param>
+  <xsl:param name="latex.output.revhistory">0</xsl:param>
 </xsl:stylesheet>


-- 
tschüß,
	Holger

-------------------------------------------------------------------------------
               holger@(debian|reproducible-builds|layer-acht).org
       PGP fingerprint: B8BF 5413 7B09 D35C F026 FE9D 091A B856 069A AA1C

Attachment: signature.asc
Description: PGP signature


Reply to: