46.7. docbook-xsl-1.79.2
XML stylesheets for Docbook-xml transformations
| Version | 1.79.2, release 5 |
| Shelf | doctools — Documentation toolchains, man pages, markup converters and TeX typesetting |
| Phase | 30_foundation (Build Foundation), 120 of 127 in build order |
| Licence | DocBook-XML |
| Homepage | https://github.com/docbook/xslt10-stylesheets |
| Build time | 0.3 SBU |
| Installed size | 32.7 MiB in 3086 files |
| Recipe | ports/core/doctools/docbook-xsl/kpkgbuild |
About
The DocBook XSL stylesheets turn DocBook XML into manual pages, HTML and other formats when xsltproc runs them. In KDOS they serve the builds, and the desktop reads them too: kdoctools renders every KDE handbook through them at run time, so the base image carries them. A port that renders its manual pages from DocBook, such as dbus, polkit, gtk3, bubblewrap and postgresql, runs xsltproc over this tree, and so do the generators xmlto and asciidoc’s a2x. The package installs no program and compiles nothing.
Two things set it apart from a plain copy of the stylesheets. It ships both of upstream’s releases, the nons stylesheets written for DocBook 4 input and the namespaced ones written for DocBook 5, because ports ask for both. And it owns the system’s root XML catalogue, /etc/xml/catalog, which maps every web address a project names a stylesheet by onto the copy installed here. The build has no network (see A build that reaches the network), so a stylesheet address the catalogue does not map is a failed build, not a slow one.
Sources
docbook-xsl-1.79.2.tar.bz2(22.3 MiB)
sha256ee8b9eca0b7a8f89075832a2da7534bce8c5478fc8fc2676f512d5d87d832102
upstream: https://github.com/docbook/xslt10-stylesheets/releases/download/release/1.79.2/docbook-xsl-nons-1.79.2.tar.bz2
archive copy: sources-1/doctools--docbook-xsl-1.79.2.tar.bz2docbook-xsl-ns-1.79.2.tar.bz2(22.3 MiB)
sha256316524ea444e53208a2fb90eeb676af755da96e1417835ba5f5eb719c81fa371
upstream: https://github.com/docbook/xslt10-stylesheets/releases/download/release/1.79.2/docbook-xsl-1.79.2.tar.bz2
archive copy: sources-1/doctools--docbook-xsl-ns-1.79.2.tar.bz2
Dependencies
Depends on: libxml2, docbook-xml.
Required by (46): alsa-utils, appstream, asciidoc, bubblewrap, calcurse, cppcheck, dbus, dconf, deutex, elogind, freedoom, gimp-help, gnome-disk-utility, gnuradio, gtk-doc, gtk3, gvfs, imv, kdoctools, libnotify, libsecret, linuxcnc, mkvtoolnix, mosquitto, ocl-icd, opensc, p11-kit, partclone, phodav, polkit, postgresql, procs, samba, system-config-printer, talloc, tdb, udisks2, upower, viking, wsjtx, xdg-dbus-proxy, xdg-user-dirs, xdg-utils, xfburn, xmlto, zbar.
Patches
build.sh applies these; kpkg applies nothing by itself.
string-subst.patch— Applied to both trees: it declares the EXSLT strings namespace inlib/lib.xsland gives thestring.substtemplate a first branch that callsstr:replacewhen the processor provides it (libxslt’s libexslt does). The stock template recurses once per match, so a long page, such as git’sgit-config.1, passesxsltproc’s default limit on nested template calls and the build fails; see Data with no other source form.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install docbook-xsl'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/docbook-xsl.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/doctools/docbook-xsl
echo 'ee8b9eca0b7a8f89075832a2da7534bce8c5478fc8fc2676f512d5d87d832102 docbook-xsl-1.79.2.tar.bz2' | sha256sum -c -
echo '316524ea444e53208a2fb90eeb676af755da96e1417835ba5f5eb719c81fa371 docbook-xsl-ns-1.79.2.tar.bz2' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/docbook-xsl
SRC=$SRC_ROOT/docbook-xsl-1.79.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf docbook-xsl-1.79.2.tar.bz2 -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf docbook-xsl-ns-1.79.2.tar.bz2 -C "$SRC_ROOT"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
mkdir nons ns
tar xf "$PORT_SRC/$name-$version.tar.bz2" --strip-components=1 -C nons
tar xf "$PORT_SRC/$name-ns-$version.tar.bz2" --strip-components=1 -C ns
patch -d nons -p1 -i "$PORT_SRC/string-subst.patch"
patch -d ns -p1 -i "$PORT_SRC/string-subst.patch"
dest=$PKG/usr/share/xml/docbook/xsl-stylesheets-nons-$version
install -v -m755 -d $dest $dest/webhelp
( cd nons && cp -v -R VERSION assembly common eclipse epub epub3 fo \
highlighting html htmlhelp images javahelp lib manpages params \
profiling roundtrip slides template tests website xhtml xhtml-1_1 \
xhtml5 $dest
cp -v -R webhelp/xsl $dest/webhelp/ )
ln -s VERSION $dest/VERSION.xsl
nsdest=$PKG/usr/share/xml/docbook/xsl-stylesheets-$version
install -v -m755 -d $nsdest $nsdest/webhelp
cp -v -R ns/VERSION ns/VERSION.xsl ns/assembly ns/common ns/eclipse ns/epub \
ns/epub3 ns/fo ns/highlighting ns/html ns/htmlhelp ns/images \
ns/javahelp ns/lib ns/manpages ns/params ns/profiling ns/roundtrip \
ns/slides ns/template ns/tests ns/website ns/xhtml ns/xhtml-1_1 \
ns/xhtml5 \
$nsdest
cp -v -R ns/webhelp/xsl $nsdest/webhelp/
rm -rf $dest/epub/bin $nsdest/epub/bin
install -v -m755 -d $PKG/etc/xml
xmlcatalog --noout --create $PKG/etc/xml/catalog
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//ENTITIES DocBook XML" \
"file:///etc/xml/docbook" \
$PKG/etc/xml/catalog
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//DTD DocBook XML" \
"file:///etc/xml/docbook" \
$PKG/etc/xml/catalog
xmlcatalog --noout --add "delegateSystem" \
"http://www.oasis-open.org/docbook/" \
"file:///etc/xml/docbook" \
$PKG/etc/xml/catalog
xmlcatalog --noout --add "delegateURI" \
"http://www.oasis-open.org/docbook/" \
"file:///etc/xml/docbook" \
$PKG/etc/xml/catalog
for ver in $version current; do
for base in http://docbook.sourceforge.net/release/xsl \
http://cdn.docbook.org/release/xsl-nons \
https://cdn.docbook.org/release/xsl-nons; do
for kind in rewriteSystem rewriteURI; do
xmlcatalog --noout --add "$kind" \
"$base/$ver" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$version" \
$PKG/etc/xml/catalog
done
done
done
for ver in $version current; do
for base in http://docbook.sourceforge.net/release/xsl-ns \
http://cdn.docbook.org/release/xsl \
https://cdn.docbook.org/release/xsl; do
for kind in rewriteSystem rewriteURI; do
xmlcatalog --noout --add "$kind" \
"$base/$ver" \
"/usr/share/xml/docbook/xsl-stylesheets-$version" \
$PKG/etc/xml/catalog
done
done
done
The switches, and why each is set:
--strip-components=1— Each release is unpacked again bybuild.sh, intononsandns, with its top directory stripped. The namespaced tarball’s top directory isdocbook-xsl-$version, which is the name of$SRCitself, so kpkg’s own unpacking of the second source lays it over the first, file by file, and the working directory holds neither release whole (see Sources, and what each one becomes).--create—xmlcatalog --createwrites an empty catalogue at$PKG/etc/xml/catalog. Every--addafter it adds one entry to that file.delegatePublic— Two entries hand every lookup of a DocBook XML public identifier, the-//OASIS//DTD DocBook XMLand-//OASIS//ENTITIES DocBook XMLfamilies, to the catalogue/etc/xml/docbook, which docbook-xml writes: it maps the public identifiers and theoasis-open.orgaddresses of each DocBook XML version onto that version’s installed DTD files.delegateSystem— Hands every system identifier underhttp://www.oasis-open.org/docbook/to the same catalogue; thedelegateURIentry does the same for URI lookups.rewriteSystem— The two loops add arewriteSystemand arewriteURIentry for every address each release is known by. For the nons tree these arehttp://docbook.sourceforge.net/release/xsland the cdn’srelease/xsl-nons, over http and https; for the namespaced tree,http://docbook.sourceforge.net/release/xsl-nsand the cdn’srelease/xsl, over http and https. Each base is entered twice, under the release’s own version and undercurrent. A stylesheet named by any of these resolves to a file under/usr/share/xml/docbook/; one named by an address that matches no entry is fetched, andxsltproc --nonetfails.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/docbook-xsl, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf docbook-xsl-1.79.2-5.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/docbook-xsl, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/docbook-xsl, /usr/share/xml/docbook/xsl-stylesheets-1.79.2, /usr/share/xml/docbook/xsl-stylesheets-nons-1.79.2.
Notes
build.sh copies a named list of directories from each tree rather than the whole release. It leaves out extensions/ and tools/, which hold prebuilt Java jars for Saxon, Xalan and the webhelp indexer; docsrc/, the sources of the stylesheets’ reference documentation; and everything under webhelp/ but webhelp/xsl. It then deletes epub/bin/, whose dbtoepub is a Ruby script: the base image carries no Ruby, and the image build’s checks (script/phases/70_image/087_gates.sh) refuse a package on the image that carries a program whose interpreter the image does not have. xsltproc reads none of what is left out. A stylesheet directory a new release adds is not installed until it is added to the list.
/etc/xml/catalog belongs to this package alone. A port that needs its own entries in the root catalogue cannot add them to this file without the two packages claiming one path, which kpkg refuses (see Who owns a file); such a port writes a catalogue of its own, as docbook-xml does, and this one delegates to it.
libxml2 reads /etc/xml/catalog by default (see libxml2), and many recipes also export XML_CATALOG_FILES=/etc/xml/catalog before running xsltproc.