asciidoc: pass SOURCE_DATE_EPOCH to xsltproc

Because we override ENV, we reset the environment when invoking xsltproc.

This is a good thing, since it also makes it much faster and less dependent
on the environment - but in case of `SOURCE_DATE_EPOCH` we actually want
this environment variable to be passed on, to make sure `a2x` does not leak
the build date into the generated manpages when this is not desired.

Fixes #192726
This commit is contained in:
Arnout Engelen 2022-09-24 11:24:59 +02:00
parent ae1dc133ea
commit 1e589865f7
No known key found for this signature in database
GPG key ID: 061107B0F74A6DAA

View file

@ -218,7 +218,7 @@ in python3.pkgs.buildPythonApplication rec {
# cannot find their neighbours (e.g. pdflatex doesn't find mktextfm).
# We can remove PATH= when those impurities are fixed.
# TODO: Is this still necessary when using texlive?
sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml', PATH='${lib.makeBinPath [ texlive coreutils gnused ]}')|" \
sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml', PATH='${lib.makeBinPath [ texlive coreutils gnused ]}', **(dict(filter(lambda v: v[0] == 'SOURCE_DATE_EPOCH', os.environ.items()))))|" \
-e "s|^ASCIIDOC =.*|ASCIIDOC = '$out/bin/asciidoc'|" \
-e "s|^XSLTPROC =.*|XSLTPROC = '${libxslt.bin}/bin/xsltproc'|" \
-e "s|^DBLATEX =.*|DBLATEX = '${dblatexFull}/bin/dblatex'|" \
@ -229,7 +229,7 @@ in python3.pkgs.buildPythonApplication rec {
-e "s|^EPUBCHECK =.*|EPUBCHECK = '${epubcheck}/bin/epubcheck'|" \
-i asciidoc/a2x.py
'' else ''
sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml')|" \
sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml', **(dict(filter(lambda v: v[0] == 'SOURCE_DATE_EPOCH', os.environ.items()))))|" \
-e "s|^XSLTPROC =.*|XSLTPROC = '${libxslt.bin}/bin/xsltproc'|" \
-e "s|^XMLLINT =.*|XMLLINT = '${libxml2.bin}/bin/xmllint'|" \
-i asciidoc/a2x.py