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

Bug#175064: DocBook XML conversion is read with this script



Hi!

On Sat, 2017-03-25 at 21:25:14 -0700, Russ Allbery wrote:
> Guillem Jover <guillem@debian.org> writes:
> > Sounds good to me. I can probably check several of those over time
> > once this is merged in.
> 
> > In which case I can rebase, check that everything is fine, and resend
> > the scripts to run the conversion to the bug.
> 
> Thanks, that sounds great!

Ok, here they are. Some comments:

From the list of issues I mentioned previously, the possibly most
visually significant one still remaining is that the chunked HTML
output for the upgrading-checklist contains a TOC, but I've at least
removed it from the single-file HTML output now.

I've updated the Build-Depends, and removed the recently introduced
ghostscript, so the new changelog entry might need to to be removed.

I've included the conversion scripts as an actual commit for
historical purposes, but perhaps you might want to skip committing
that, or commit its removal afterwards. I've also not included the
actual conversion commit, because it might trip over list/BTS limits
(sized ar around 1.1 MiB). And you might perhaps want to squash that
with the one updating the build system? I can provide a branch instead
if you want, with the commits in whatever shape you'd prefer.

I think that to be able to fix some of the other minor issues I've
mentioned before, we'd need to switch to use XSLT toolchain for the
HTML generation. And also because openjade seems a bit stagnant
upstream. I've not done that here because other parts of the build
already use openjade, and went with the existing setup for now.

I've got also another patch on top of the converted files, to make
upgrading-checklist a proper appendix, but it has some issues, so
I'll probably post it later on, after a possible switch to XSLT.

Thanks,
Guillem
From c9e93ef2ecb4e9a65e8f3cb2b867e770180cad1c Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Sun, 26 Mar 2017 20:24:16 +0200
Subject: [PATCH 1/4] Make tidy not convert character entities to their UTF-8
 form

The output documents do not have any encoding specified, so programs
handling them will assume ASCII, and when finding UTF-8 characters will
recode those producing garbage on output.
---
 copyright-format/Makefile | 2 +-
 debconf_spec/Makefile     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/copyright-format/Makefile b/copyright-format/Makefile
index 6d26018..31d6e7a 100644
--- a/copyright-format/Makefile
+++ b/copyright-format/Makefile
@@ -3,7 +3,7 @@ all: copyright-format-1.0.txt.gz copyright-format-1.0.html
 copyright-format-1.0.html: copyright-format-1.0.xml html.dsl
 	openjade -V nochunks -t sgml -d html.dsl \
 		/usr/share/xml/declaration/xml.dcl $< > $@
-	-tidy -q -i -m -f /dev/null $@
+	-tidy -raw -q -i -m -f /dev/null $@
 
 copyright-format-1.0.txt: copyright-format-1.0.html
 	links -dump $< | perl -pe 's/[\r\0]//g' > $@
diff --git a/debconf_spec/Makefile b/debconf_spec/Makefile
index cdfd135..bc6614d 100644
--- a/debconf_spec/Makefile
+++ b/debconf_spec/Makefile
@@ -3,7 +3,7 @@ all: debconf_specification.txt.gz debconf_specification.html
 %.html: %.xml html.dsl
 	openjade -V nochunks -t sgml -d html.dsl \
 		/usr/share/xml/declaration/xml.dcl $< > $@
-	-tidy -q -i -m -f /dev/null $@
+	-tidy -raw -q -i -m -f /dev/null $@
 
 %.txt: %.html
 	links -dump $< | perl -pe 's/[\r\0]//g' > $@
-- 
2.12.1.578.ge9c3154ca4

From 915d3bca2cef3b32d9a5f28ff3402e3d7379d3e1 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Mon, 9 Jan 2017 05:22:59 +0100
Subject: [PATCH 2/4] Do not ship redundant SGML and XML sources

We already ship the sources in the source package, and there's nothing
requiring us to duplicate these files.
---
 debian-menu-policy.desc |  3 ---
 debian-perl-policy.desc |  3 ---
 debian-policy.desc      |  3 ---
 debian/rules            | 24 ++++++------------------
 4 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/debian-menu-policy.desc b/debian-menu-policy.desc
index 9757253..a71e36b 100644
--- a/debian-menu-policy.desc
+++ b/debian-menu-policy.desc
@@ -6,9 +6,6 @@ Abstract: This manual describes the policy requirements for the Menu
  hierarchical structure of the menu sections.
 Section: Debian
 
-Format: debiandoc-sgml
-Files: /usr/share/doc/debian-policy/menu-policy.sgml.gz
-
 Format: text
 Files: /usr/share/doc/debian-policy/menu-policy.txt.gz
 
diff --git a/debian-perl-policy.desc b/debian-perl-policy.desc
index cb6337c..0aa1831 100644
--- a/debian-perl-policy.desc
+++ b/debian-perl-policy.desc
@@ -7,9 +7,6 @@ Abstract: This manual describes the policy requirements for the Perl
  using Perl and Perl modules.
 Section: Debian
 
-Format: debiandoc-sgml
-Files: /usr/share/doc/debian-policy/perl-policy.sgml.gz
-
 Format: text
 Files: /usr/share/doc/debian-policy/perl-policy.txt.gz
 
diff --git a/debian-policy.desc b/debian-policy.desc
index 745538e..fc3d79a 100644
--- a/debian-policy.desc
+++ b/debian-policy.desc
@@ -8,9 +8,6 @@ Abstract: This manual describes the policy requirements for the Debian
  included in the distribution.
 Section: Debian
 
-Format: debiandoc-sgml
-Files: /usr/share/doc/debian-policy/policy.sgml.gz
-
 Format: text
 Files: /usr/share/doc/debian-policy/policy.txt.gz
 
diff --git a/debian/rules b/debian/rules
index 03cea36..88ca46e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,8 +17,7 @@ DOCDIR	:= $(TMPTOP)/usr/share/doc/$(package)
 LIBDIR	:= $(TMPTOP)/usr/share/doc-base
 
 # SGML source files in the top-level directory.  We do some common actions
-# with each of these: validate, build text, HTML, and one-page HTML output,
-# and generate a tarball of the source.
+# with each of these: validate, build text, HTML, and one-page HTML output.
 SGML_FILES  := policy menu-policy perl-policy upgrading-checklist
 
 # Markdown source files in the top-level directory.  We generate text and
@@ -35,10 +34,10 @@ FHS_ARCHIVE := fhs-2.3-source.tar.gz
 FHS_FILES   := fhs-2.3.html fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
 
 # A list of the simple Policy files that we include in the documentation
-# directory of the generated package.  The tarballs of source are handled
-# separately, as are the directories of HTML output.
-POLICY_FILES := $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz)		\
-		$(SGML_FILES:=-1.html) version.ent			\
+# directory of the generated package.  The directories of HTML output are
+# handled separately.
+POLICY_FILES := $(SGML_FILES:=.txt.gz)					\
+		$(SGML_FILES:=-1.html)					\
 		virtual-package-names-list.txt	                        \
 		copyright-format/copyright-format-1.0.html		\
 		copyright-format/copyright-format-1.0.txt.gz		\
@@ -64,8 +63,6 @@ FILES_TO_CLEAN	:= $(SGML_FILES:=.txt) $(SGML_FILES:=.txt.gz)		\
 		   copyright-format/version.xml				\
 		   autopkgtest/version.txt				\
 		   debconf_spec/include/version.xml version.ent		\
-		   copyright-format.xml.tar.gz				\
-		   debconf_specification.xml.tar.gz			\
 		   debian/files
 
 # Install files and directories with the correct ownership and permissions.
@@ -97,10 +94,6 @@ stamp-build: $(MDWN_FILES:=.md)				\
 	$(MAKE) -C copyright-format all
 	$(MAKE) -C autopkgtest all
 	$(MAKE) -C debconf_spec all
-	cd copyright-format && \
-		GZIP=-n9 tar -zcf ../copyright-format.xml.tar.gz *
-	cd debconf_spec && \
-		GZIP=-n9 tar -zcf ../debconf_specification.xml.tar.gz *
 	touch stamp-build
 
 # Create the version files for inclusion in the various documents.  We want
@@ -160,11 +153,6 @@ stamp-binary: stamp-build
 	$(install)	debian/changelog	$(DOCDIR)/
 	$(install)	debian/copyright	$(DOCDIR)/
 #
-# Install DocBook XML source.
-#
-	$(install)	copyright-format.xml.tar.gz		$(DOCDIR)/
-	$(install)	debconf_specification.xml.tar.gz	$(DOCDIR)/
-#
 # Install generated HTML directories.
 #
 	@set -ex; for file in $(SGML_FILES); do			\
@@ -186,7 +174,7 @@ stamp-binary: stamp-build
 #
 # Compress files and build MD5 checksums.
 #
-	gzip -fn9 $(DOCDIR)/*.sgml $(DOCDIR)/changelog
+	gzip -fn9 $(DOCDIR)/changelog
 	gzip -fn9 $(DOCDIR)/*.txt
 	@set -ex; cd debian/tmp; \
 	find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
-- 
2.12.1.578.ge9c3154ca4

From 275b043b8dffd404f3ecb378db150c5cd2ea63f1 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Tue, 10 Jan 2017 09:29:45 +0100
Subject: [PATCH 3/4] Add new DebianDoc-SGML to DocBook conversion script

This is a draft conversion script, that should automate the whole
process so that it can hopefully be repeated at any later point
and can handle modifications to the documents text.
---
 html.dsl           |  42 +++++++++++++++++++
 tools/sgml2docbook | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 161 insertions(+)
 create mode 100644 html.dsl
 create mode 100755 tools/sgml2docbook

diff --git a/html.dsl b/html.dsl
new file mode 100644
index 0000000..fae6763
--- /dev/null
+++ b/html.dsl
@@ -0,0 +1,42 @@
+<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
+<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
+]>
+<style-sheet>
+
+<style-specification id="html" use="docbook">
+<style-specification-body>
+
+(define %section-autolabel% #t)
+(define %chunk-section-depth% 0)
+(define %header-navigation% #t)
+(define %footer-navigation% #t)
+(define %use-id-as-filename% #t)
+(define %html-ext% ".html")
+
+(define (article-titlepage-recto-elements)
+  (list
+        (normalize "title")
+        (normalize "subtitle")
+        (normalize "authorgroup")
+        (normalize "author")
+        (normalize "releaseinfo")
+        (normalize "copyright")
+        (normalize "pubdate")
+        (normalize "revhistory")
+        (normalize "legalnotice")
+        (normalize "abstract")
+))
+(define (chunk-element-list)
+  (list
+        (normalize "book")
+        (normalize "chapter")
+        (normalize "appendix")
+        (normalize "footnotes")
+))
+
+</style-specification-body>
+</style-specification>
+
+<external-specification id="docbook" document="docbook.dsl">
+
+</style-sheet>
diff --git a/tools/sgml2docbook b/tools/sgml2docbook
new file mode 100755
index 0000000..fa2e48c
--- /dev/null
+++ b/tools/sgml2docbook
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+set -e
+set -x
+
+cleanup=yes
+tidyxml=no
+
+files="menu-policy.sgml perl-policy.sgml upgrading-checklist.sgml policy.sgml"
+
+export LC_ALL=C
+
+# Generate fake entity files to be able to process the SGML and XML.
+(
+  echo '<!entity version "@@@VERSION@@@">'
+  echo '<!entity date    "@@@DATE@@@">'
+) >version.ent
+(
+  echo '<?xml version="1.0" encoding="utf-8"?>'
+  echo '<!ENTITY version "@@@VERSION@@@">'
+  echo '<!ENTITY date    "@@@DATE@@@">'
+) >version.xml
+
+for sgml in $files; do
+  base=$(basename $sgml .sgml)
+
+  # Remove invalid entities, encode other entities, and wrap
+  sed -e 's/ *&copy; *//g' \
+      -e 's/, &date;//g' \
+      -e 's/&\([a-z]*\);/@@@\1@@@/g' <$sgml >$base.new.sgml
+
+  # Do the conversion.
+  debiandoc2dbk -1 -l en $base.new.sgml
+
+  # Recode, and fixup markup.
+  iconv -f iso-8859-15 -t utf-8 <$base.new.dbk |
+    sed -e 's/@@@\([a-z]*\)@@@/\&\1;/g' \
+        -e 's/&version;/@@@version@@@/g' \
+        -e 's/<!-- put date -->/@@@date@@@/' \
+        -e '/<!-- Include entity/d' \
+        -e 's/<!-- \(<!ENTITY .*\)"version.ent"\(>.*\) *-->/\1"version.xml"\2/g' \
+        -e 's:<personname>\([^ ]*\) *\([^ ]*\)</personname>:<personname><firstname>\1</firstname><surname>\2</surname></personname>:g' \
+        -e 's:<personname>\(.*The Debian Policy mailing List.*\)</personname>:<othername>\1</othername>:gi' \
+        -e 's/ *$//g' \
+      >$base.xml
+
+  if [ "$base" = "policy" ]; then
+    # Fixup IDs, and insert entity.
+    sed -i \
+        -e '/^]>/i<!-- current Debian changes file format -->\
+<!ENTITY changesversion "1.8">' \
+        -e 's:<literal>"</literal>:&<!-- balance " -->:' \
+        -e 's/\(id\|linkend\)="\(pkg-alternatives\|pkg-binarypkg\|pkg-conffiles\|pkg-controlfields\|pkg-diversions\|pkg-scope\|pkg-sourcepkg\)"/\1="ap-\2"/g' \
+        -e 's/\(id\|linkend\)="\(archive\|binary\|controlfields\|customized-programs\|docs\|files\|maintainerscripts\|opersys\|relationships\|scope\|sharedlibs\|source\)"/\1="ch-\2"/' \
+        -e '/\(id\|linkend\)="\(ap-\|ch-\|s-\|s[0-9]\)[^"]*"/!s/\(id\|linkend\)="\([^"]*\)"/\1="s-\2"/g' \
+      $base.xml
+  elif [ "$base" = "perl-policy" ]; then
+    # Fixup IDs.
+    sed -i \
+        -e 's/\(id\|linkend\)="perl6"/\1="ap-perl6"/' \
+        -e 's/\(id\|linkend\)="module-packages"/\1="ch-module_packages"/' \
+        -e 's/\(id\|linkend\)="\(embed\|perl\|programs\|site\|files\)"/\1="ch-\2"/' \
+        -e '/\(id\|linkend\)="\(ap-\|ch-\|ch[0-9]\|s-\|s[0-9]\)[^"]*"/!s/\(id\|linkend\)="\([^"]*\)"/\1="s-\2"/g' \
+      $base.xml
+  elif [ "$base" = "upgrading-checklist" ]; then
+    # Fixup IDs.
+    sed -i -e 's/id="\([0-9]\)/id="s-\1/g' \
+      $base.xml
+  fi
+
+  case "$tidyxml" in
+  xmllint)
+    xmllint --encode utf-8 --format --nonet --postvalid $base.xml \
+      | sponge $base.xml
+    ;;
+  pandoc)
+    # Converts from book to an article, does not preserve entity declarations,
+    # nice output.
+    pandoc --normalize --chapters -s -f docbook -t docbook $base.xml \
+      | sponge $base.xml
+    ;;
+  tidy)
+    # Messes up spacing, and joins tags and words.
+    tidy -raw -wrap 76 --indent yes --quiet yes \
+         -xml --input-xml yes --output-xml yes \
+         --preserve-entities yes --vertical-space yes --add-xml-space yes \
+         -i -m $base.xml
+    ;;
+  esac
+
+  # Restore entities.
+  sed -i -e 's/@@@\([a-z]*\)@@@/\&\1;/g' $base.xml
+
+  # Test generating single file.
+  openjade -V nochunks \
+    -t sgml -d html.dsl /usr/share/xml/declaration/xml.dcl $base.xml \
+    >"$base-1.html"
+
+  # Test generating chunked files.
+  mkdir -p $base.html
+  openjade \
+    -V use-output-dir -V %output-dir%=$base.html/ \
+    -V %root-filename%=index \
+    -t sgml -d html.dsl /usr/share/xml/declaration/xml.dcl $base.xml
+
+  # Update git tree.
+  git add $base.xml
+  git rm $base.sgml
+
+  # Cleanup temporary files.
+  if [ $cleanup = yes ]; then
+    rm -f $base.new.*
+  fi
+done
+
+# Cleanup temporary files.
+if [ $cleanup = yes ]; then
+  rm -f version.ent version.xml
+fi
-- 
2.12.1.578.ge9c3154ca4

From bcb0674f7a0acf8c76d93109deb82cbb62ba8cd9 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Mon, 9 Jan 2017 05:22:59 +0100
Subject: [PATCH 4/4] Update build system for DocBook conversion

---
 .gitignore     |  2 +-
 Makefile       | 44 ++++++++++++++++++++++++++------------------
 README.md      | 10 +++++-----
 debian/control |  8 +-------
 debian/rules   | 40 ++++++++++++++++++++--------------------
 5 files changed, 53 insertions(+), 51 deletions(-)

diff --git a/.gitignore b/.gitignore
index 66b5940..66c32a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,7 @@
 /stamp-build
 /stamp-binary
 /upgrading-checklist.html/
-/version.ent
+/version.xml
 *-1.html
 *.html.tar.gz
 *.pdf
diff --git a/Makefile b/Makefile
index 288c4ae..ad69dca 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
 include debian/rules
 
-policy.sgml: version.ent
-menu-policy.sgml: version.ent
-perl-policy.sgml: version.ent
+policy.xml: version.xml
+menu-policy.xml: version.xml
+perl-policy.xml: version.xml
+upgrading-checklist.xml: version.xml
 
 $(MDWN_FILES:=.txt): %.txt: %.md
 	cat $^ > $@
@@ -11,34 +12,41 @@ $(MDWN_FILES:=.txt): %.txt: %.md
 $(MDWN_FILES:=.html): %.html: %.md
 	$(MDWN) $< > $@
 
-%.validate: %
-	onsgmls -wall -gues $<
+OPENJADE_OPTS = -b utf-8 -t sgml -d html.dsl
+OPENJADE_OPT_NOTOC = -V "(define %generate-book-toc% \#f)"
 
-%.html/index.html: %.sgml
-	LANG=C debiandoc2html $<
+upgrading-checklist-1.html \
+upgrading-checklist.html/index.html: OPENJADE_OPTS += $(OPENJADE_OPT_NOTOC)
 
-%-1.html: %.sgml
-	LANG=C debiandoc2html -1 -b $*-1d $< && \
-        mv $*-1d.html/index.html $*-1.html && \
-        rmdir $*-1d.html
+%.html/index.html: %.xml html.dsl
+	mkdir -p $(@D)
+	openjade $(OPENJADE_OPTS) \
+	  -V use-output-dir -V %output-dir%=$(@D)/ -V %root-filename%=index \
+	  /usr/share/xml/declaration/xml.dcl $<
+
+%-1.html: %.xml html.dsl
+	openjade $(OPENJADE_OPTS) \
+	  -V nochunks \
+	  /usr/share/xml/declaration/xml.dcl $< > $@
+	-tidy -raw -q -f /dev/null -i -m $@
 
 %.html.tar.gz: %.html/index.html
 	GZIP=-n9 tar -czf $(<:/index.html=.tar.gz) $(<:/index.html=)
 
-$(SGML_FILES:=.txt): %.txt: %.sgml
-	LANG=C debiandoc2text $<
+$(XML_FILES:=.txt): %.txt: %-1.html
+	links -dump $< | perl -pe 's/[\r\0]//g' > $@
 
 %.txt.gz: %.txt
 	gzip -ncf9 $< > $@
 
-%.ps: %.sgml
-	LANG=C debiandoc2latexps $<
+%.ps: %.xml
+	dblatex --ps $<
 
 %.ps.gz: %.ps
 	gzip -ncf9 $< > $@
 
-%.pdf: %.sgml
-	LANG=C debiandoc2latexpdf $<
+%.pdf: %.xml
+	dblatex --pdf $<
 
 %.pdf.gz: %.pdf
 	gzip -ncf9 $< > $@
@@ -70,7 +78,7 @@ distclean:
 	rm -f $(filter-out $(leavealone),$(wildcard *.txt *.txt.gz *.html.tar.gz *.pdf *.ps))
 	rm -f *.lout* lout.li *.sasp* *.tex *.aux *.toc *.idx *.log *.out *.dvi *.tpt
 	rm -f `find . -name "*~" -o -name "*.bak" -o -name ".#*" -o -name core`
-	rm -f version.ent
+	rm -f version.xml
 	rm -f *.rej *.orig
 
 # if a rule bombs out, delete the target
diff --git a/README.md b/README.md
index 76a236b..68085e7 100644
--- a/README.md
+++ b/README.md
@@ -192,14 +192,14 @@ proposed wording, is:
   &lt;number&gt; is the bug number in the BTS and &lt;user&gt;is a
   designator of the Policy team member who is shepherding the bug.
 + Commit wording changes in that branch until consensus is
-  achieved. Do not modify debian/changelog or upgrading-checklist.html
+  achieved. Do not modify debian/changelog or upgrading-checklist.xml
   during this phase. Use the BTS to track who proposed the wording and
   who seconded it.
 + git pull master to make sure you have the latest version.
 + Once the change has been approved by enough people, git merge the
   branch into master immediately after making the final commit adding
   the changelog entry to minimize conflicts.
-+ add the debian/changelog and upgrading-checklist.html changes, and
++ add the debian/changelog and upgrading-checklist.xml changes, and
   commit to master.
 + Push master out so other people may merge in their own bug branches
   without conflicts.
@@ -233,8 +233,8 @@ The Git commands used for this workflow are:
 
     git checkout master
     git merge bug12345-rra
-    # edit debian/changelog and upgrading-checklist.html
-    git add debian/changelog upgrading-checklist.html
+    # edit debian/changelog and upgrading-checklist.xml
+    git add debian/changelog upgrading-checklist.xml
     git commit
     git push origin master
     git branch -d bug12345-rra
@@ -278,7 +278,7 @@ assuming that you haven't packed the refs in your repository.
 For a final Policy release, change UNRELEASED to unstable in
 debian/changelog and update the timestamp to match the final release
 time (dch -r may be helpful for this), update the release date in
-upgrading-checklist.html, update Standards-Version in debian/control,
+upgrading-checklist.xml, update Standards-Version in debian/control,
 and commit that change. Then do the final release build and make sure
 that it builds and installs.
 
diff --git a/debian/control b/debian/control
index 49a8aa4..a3f45c2 100644
--- a/debian/control
+++ b/debian/control
@@ -9,19 +9,13 @@ Section: doc
 Priority: optional
 Build-Depends:
  bsdmainutils,
- debiandoc-sgml (>= 1.1.47),
+ dblatex,
  docbook-dsssl,
  docbook-xml,
- ghostscript,
- groff,
  libtext-multimarkdown-perl,
  links | elinks,
  openjade,
- opensp,
- pstoedit,
  sgml-data,
- texlive,
- texlive-latex-extra,
  tidy,
 Standards-Version: 3.9.9
 Vcs-Browser: https://anonscm.debian.org/git/dbnpolicy/policy.git
diff --git a/debian/rules b/debian/rules
index 88ca46e..c338f11 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,9 +16,9 @@ TMPTOP	:= $(SRCTOP)/debian/tmp
 DOCDIR	:= $(TMPTOP)/usr/share/doc/$(package)
 LIBDIR	:= $(TMPTOP)/usr/share/doc-base
 
-# SGML source files in the top-level directory.  We do some common actions
-# with each of these: validate, build text, HTML, and one-page HTML output.
-SGML_FILES  := policy menu-policy perl-policy upgrading-checklist
+# DocBook source files in the top-level directory.  We do some common actions
+# with each of these: build text, HTML, and one-page HTML output.
+XML_FILES   := policy menu-policy perl-policy upgrading-checklist
 
 # Markdown source files in the top-level directory.  We generate text and
 # HTML versions from these.
@@ -36,8 +36,8 @@ FHS_FILES   := fhs-2.3.html fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
 # A list of the simple Policy files that we include in the documentation
 # directory of the generated package.  The directories of HTML output are
 # handled separately.
-POLICY_FILES := $(SGML_FILES:=.txt.gz)					\
-		$(SGML_FILES:=-1.html)					\
+POLICY_FILES := $(XML_FILES:=.txt.gz)					\
+		$(XML_FILES:=-1.html)					\
 		virtual-package-names-list.txt	                        \
 		copyright-format/copyright-format-1.0.html		\
 		copyright-format/copyright-format-1.0.txt.gz		\
@@ -54,15 +54,15 @@ POLICY_FILES := $(SGML_FILES:=.txt.gz)					\
 # are individual generated files to remove.  DIRS_TO_CLEAN are entire
 # directories to remove.
 STAMPS_TO_CLEAN := stamp-binary stamp-build
-DIRS_TO_CLEAN   := $(SGML_FILES:=.html) debian/tmp fhs
-FILES_TO_CLEAN	:= $(SGML_FILES:=.txt) $(SGML_FILES:=.txt.gz)		\
-		   $(SGML_FILES:=.html.tar.gz) $(SGML_FILES:=-1.html)	\
+DIRS_TO_CLEAN   := $(XML_FILES:=.html) debian/tmp fhs
+FILES_TO_CLEAN  := $(XML_FILES:=.txt) $(XML_FILES:=.txt.gz)		\
+		   $(XML_FILES:=.html.tar.gz) $(XML_FILES:=-1.html)	\
 		   $(MDWN_FILES:=.html) $(MDWN_FILES:=.txt)		\
 		   policy.pdf.gz policy.ps.gz				\
 		   policy.pdf policy.ps policy.tpt policy.txt		\
 		   copyright-format/version.xml				\
 		   autopkgtest/version.txt				\
-		   debconf_spec/include/version.xml version.ent		\
+		   debconf_spec/include/version.xml version.xml		\
 		   debian/files
 
 # Install files and directories with the correct ownership and permissions.
@@ -73,8 +73,8 @@ mkdir   := install -d -o root -g root -m 755
 all build build-indep: stamp-build
 build-arch:
 stamp-build: $(MDWN_FILES:=.md)				\
-	     $(SGML_FILES:=.sgml)			\
-	     version.ent				\
+	     $(XML_FILES:=.xml)				\
+	     version.xml				\
 	     copyright-format/copyright-format-1.0.xml	\
 	     copyright-format/version.xml		\
 	     autopkgtest/autopkgtest.md			\
@@ -84,10 +84,9 @@ stamp-build: $(MDWN_FILES:=.md)				\
 	     debconf_spec/include/statuscodes.xml	\
 	     debconf_spec/include/types.xml		\
 	     debconf_spec/include/version.xml
-	$(MAKE) $(SGML_FILES:=.sgml.validate) \
-		$(SGML_FILES:=.html.tar.gz) \
-                $(SGML_FILES:=-1.html) \
-		$(SGML_FILES:=.txt.gz) \
+	$(MAKE)	$(XML_FILES:=.html.tar.gz) \
+		$(XML_FILES:=-1.html) \
+		$(XML_FILES:=.txt.gz) \
 		policy.ps.gz policy.pdf.gz
 	$(MAKE) $(MDWN_FILES:=.html) \
 		$(MDWN_FILES:=.txt)
@@ -99,13 +98,14 @@ stamp-build: $(MDWN_FILES:=.md)				\
 # Create the version files for inclusion in the various documents.  We want
 # to put the Policy version and date in each document, even if they
 # separately have their own versions.
-configure: version.ent copyright-format/version.xml \
+configure: version.xml copyright-format/version.xml \
 	   autopkgtest/version.txt \
 	   debconf_spec/include/version.xml
-version.ent: debian/changelog
+version.xml: debian/changelog
 	rm -f $@
-	echo "<!entity version \"$(version)\">" >> $@
-	echo "<!entity date    \"$(date)\">"	>> $@
+	echo '<?xml version="1.0" encoding="utf-8"?>' > $@
+	echo '<!ENTITY version "$(version)">'        >> $@
+	echo '<!ENTITY date    "$(date)">'           >> $@
 copyright-format/version.xml: debian/changelog
 	rm -f $@
 	echo '<?xml version="1.0" standalone="no"?>' >  $@
@@ -155,7 +155,7 @@ stamp-binary: stamp-build
 #
 # Install generated HTML directories.
 #
-	@set -ex; for file in $(SGML_FILES); do			\
+	@set -ex; for file in $(XML_FILES); do			\
 		tar -C $(DOCDIR) -zxf $$file.html.tar.gz;	\
 	done
 #
-- 
2.12.1.578.ge9c3154ca4


Reply to: