More reproducible document builds
Subsystems (2)
v2 cover More reproducible document builds
This series fixes a couple more reproducibility bugs:
1. The 'mandocs' target always creates dummy man pages in the source tree. Aside from their very existence being a nasty hack, and the wrong-ness of writing to the source tree, they contain a build timestamp and if we build a package of the source later it won't be reproducible. This moves them to the same place as all the other man pages are built.
(Moving the dummy man pages shouldn't cause a problem for reproducibility of the man page packages, because the dummies are in section 1 and not section 9. However the dummies still don't get cleaned properly.)
2. The current locale affects the encoding of HTML pages.
With these patches (and the previous set) applied, Debian's package of Linux 4.2 became fully reproducible.
v2: Rebase on 4.3-rc3.
Add an explanatory comment to check-lc_type.c.
Ben.
Ben Hutchings (2):
Documentation: Avoid creating man pages in source tree
DocBook: Use a fixed encoding for output
Documentation/DocBook/Makefile | 6 ++++++ Makefile | 2 +- scripts/Makefile | 7 +++++-- scripts/check-lc_ctype.c | 11 +++++++++++ scripts/kernel-doc | 9 +++++---- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 scripts/check-lc_ctype.c
Signature · 2 lines
Ben Hutchings All extremists should be taken out and shot.
PATCH v2 1/2 Documentation: Avoid creating man pages in source tree
Currently kernel-doc generates a dummy DocBook file when asked to convert a C source file with no structured comments. For an out-of-tree build (objtree != srctree), the title of the output file is the absolute path name of the C source file, which later results in a manual page being created alongside the C source file.
Change the title to be a relative path.
--- scripts/kernel-doc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/kernel-doc +5 -4
@@ -2391,12 +2391,13 @@ sub process_file($) { my $descr; my $in_purpose = 0; my $initial_section_counter = $section_counter; + my ($orig_file) = @_; if (defined($ENV{'SRCTREE'})) { - $file = "$ENV{'SRCTREE'}" . "/" . "@_"; + $file = "$ENV{'SRCTREE'}" . "/" . $orig_file; } else { - $file = "@_"; + $file = $orig_file; } if (defined($source_map{$file})) { $file = $source_map{$file};
@@ -2640,7 +2641,7 @@ sub process_file($) { print "<refentry>\n"; print " <refnamediv>\n"; print " <refname>\n"; - print " ${file}\n"; + print " ${orig_file}\n"; print " </refname>\n"; print " <refpurpose>\n"; print " Document generation inconsistency\n";
@@ -2654,7 +2655,7 @@ sub process_file($) { print " <para>\n"; print " The template for this document tried to insert\n"; print " the structured comment from the file\n"; - print " <filename>${file}</filename> at this point,\n"; + print " <filename>${orig_file}</filename> at this point,\n"; print " but none was found.\n"; print " This dummy section is inserted to allow\n"; print " generation to continue.\n";
Signature · 2 lines
Ben Hutchings All extremists should be taken out and shot.
PATCH v2 2/2 DocBook: Use a fixed encoding for output
In reply to Ben HutchingsCurrently the encoding of documents generated by DocBook depends on the current locale. Make the output reproducible independently of the locale, by setting the encoding to UTF-8 (LC_CTYPE=C.UTF-8) by preference, or ASCII (LC_CTYPE=C) as a fallback.
LC_CTYPE can normally be overridden by LC_ALL, but the top-level Makefile unsets that.
---
v2: Rebase on 4.3-rc3.
Add an explanatory comment to check-lc_type.c.
Documentation/DocBook/Makefile | 6 ++++++ Makefile | 2 +- scripts/Makefile | 7 +++++-- scripts/check-lc_ctype.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 scripts/check-lc_ctype.c
Documentation/DocBook/Makefile +6 -0
@@ -69,6 +69,12 @@ installmandocs: mandocs KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref KERNELDOC = $(srctree)/scripts/kernel-doc DOCPROC = $(objtree)/scripts/docproc +CHECK_LC_CTYPE = $(objtree)/scripts/check-lc_ctype + +# Use a fixed encoding - UTF-8 if the C library has support built-in +# or ASCII if not +LC_CTYPE := $(call try-run, LC_CTYPE=C.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8,C) +export LC_CTYPE XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl XMLTOFLAGS += --skip-validation
Makefile +1 -1
@@ -1336,7 +1336,7 @@ $(help-board-dirs): help-%: # Documentation targets # --------------------------------------------------------------------------- %docs: scripts_basic FORCE - $(Q)$(MAKE) $(build)=scripts build_docproc + $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype $(Q)$(MAKE) $(build)=Documentation/DocBook $@ else # KBUILD_EXTMOD
scripts/Makefile +5 -2
@@ -7,6 +7,7 @@ # conmakehash: Create chartable # conmakehash: Create arrays for initializing the kernel console tables # docproc: Used in Documentation/DocBook +# check-lc_ctype: Used in Documentation/DocBook HOST_EXTRACFLAGS += -I$(srctree)/tools/include
@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto always := $(hostprogs-y) $(hostprogs-m) # The following hostprogs-y programs are only build on demand -hostprogs-y += unifdef docproc +hostprogs-y += unifdef docproc check-lc_ctype # These targets are used internally to avoid "is up to date" messages -PHONY += build_unifdef build_docproc +PHONY += build_unifdef build_docproc build_check-lc_ctype build_unifdef: $(obj)/unifdef @: build_docproc: $(obj)/docproc @: +build_check-lc_ctype: $(obj)/check-lc_ctype + @: subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-y += mod
scripts/check-lc_ctype.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* Check that a specified locale works as LC_CTYPE. Used by the +* DocBook build system to probe for C.UTF-8 support. +*/ + +#include <locale.h> + +int main (void ) +{ +return !setlocale (LC_CTYPE ,"" ); +}
Signature · 2 lines
Ben Hutchings All extremists should be taken out and shot.
Re: [PATCH v2 2/2] DocBook: Use a fixed encoding for output
Quoted 7 lines · On Mon, 28 Sep 2015 01:09:52 +0100 Ben Hutchings <[email protected]> wrote:
Currently the encoding of documents generated by DocBook depends on the current locale. Make the output reproducible independently of the locale, by setting the encoding to UTF-8 (LC_CTYPE=C.UTF-8) by preference, or ASCII (LC_CTYPE=C) as a fallback.
LC_CTYPEcan normally be overridden byLC_ALL, but the top-levelMakefileunsets that.
Applied to the docs tree (part 1 went in a few weeks ago). Added check-lc_ctype to scripts/.gitignore while I was at it.
Thanks,
jon