DocBook: Use a fixed encoding for output

This was the last blocker for reproduciblity, so close that bug.
This commit is contained in:
Ben Hutchings 2015-08-27 02:06:30 +01:00
parent ef829fca16
commit 32fff0de75
3 changed files with 81 additions and 0 deletions

2
debian/changelog vendored
View File

@ -12,6 +12,8 @@ linux (4.2~rc8-1~exp2) UNRELEASED; urgency=medium
- [x86] COMEDI_8255_SA replaced COMEDI_8255
* [sparc] Remove linux-image, linux-header and udeb packages, as they
are redundant with sparc64 and neither is an official port
* Fix last issue that prevents a reproducible build (Closes: #769844):
- DocBook: Use a fixed encoding for output
-- Ben Hutchings <ben@decadent.org.uk> Tue, 25 Aug 2015 18:50:57 +0100

View File

@ -0,0 +1,78 @@
From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 27 Aug 2015 01:56:46 +0100
Subject: DocBook: Use a fixed encoding for output
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_CTYPE can normally be overridden by LC_ALL, but the top-level
Makefile unsets that.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -68,6 +68,12 @@ installmandocs: mandocs
#External programs used
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
--- a/Makefile
+++ b/Makefile
@@ -1361,7 +1361,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
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -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
@@ -23,14 +24,16 @@ HOSTCFLAGS_asn1_compiler.o = -I$(srctree
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
--- /dev/null
+++ b/scripts/check-lc_ctype.c
@@ -0,0 +1,6 @@
+#include <locale.h>
+
+int main(void)
+{
+ return !setlocale(LC_CTYPE, "");
+}

View File

@ -75,6 +75,7 @@ bugfix/all/docbook-generate-consistent-ids.patch
bugfix/all/docbook-fix-non-determinstic-installation-of-duplica.patch
bugfix/all/scripts-kernel-doc-use-kbuild_build_timestamp-as-man.patch
bugfix/all/documentation-avoid-creating-man-pages-in-source-tree.patch
bugfix/all/docbook-use-a-fixed-encoding-for-output.patch
# Miscellaneous features
features/all/efi-autoload-efi-pstore.patch