/[gentoo-src]/build-docbook-catalog/build-docbook-catalog
Gentoo

Diff of /build-docbook-catalog/build-docbook-catalog

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.3
1#!/bin/bash 1#!/bin/bash
2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.2 2004/07/22 22:35:18 agriffis Exp $ 2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.3 2008/09/22 13:43:02 flameeyes Exp $
3# 3#
4# build-docbook-catalog: populate /etc/xml/docbook based in 4# build-docbook-catalog: populate /etc/xml/docbook based in
5# installed docbook-xml-dtd versions. 5# installed docbook-xml-dtd versions.
6# 6#
7# Copyright 2004 Gentoo Foundation 7# Copyright 2004 Gentoo Foundation
33 *) echo "Options parsing failed on $1!" >&2 ; exit 1 ;; 33 *) echo "Options parsing failed on $1!" >&2 ; exit 1 ;;
34 esac 34 esac
35 done 35 done
36 36
37 create_catalogs # will exit on error 37 create_catalogs # will exit on error
38 populate_xsl 38 for type in xsl xsl-ns xsl-saxon xsl-xalan; do
39 populate_xsl $type
40 done
39 41
40 # Clean out old dtds from catalog 42 # Clean out old dtds from catalog
41 verb "Cleaning out old DocBook XML versions from ${CATALOG} and ${ROOTCATALOG}" 43 verb "Cleaning out old DocBook XML versions from ${CATALOG} and ${ROOTCATALOG}"
42 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${CATALOG} 44 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${CATALOG}
43 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${ROOTCATALOG} 45 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${ROOTCATALOG}
249# populate XSL stylesheets 251# populate XSL stylesheets
250# 252#
251populate_xsl() { 253populate_xsl() {
252 typeset listed avail f 254 typeset listed avail f
253 255
254 # Delete current entries from the catalog 256 # This is either xsl, xsl-ns, xsl-saxon or xsl-xalan
257 local type=$1
258
259 # Delete current entries from the catalog (delete legacy versioned entries too)
255 clean_catalog "${DOCBOOKDIR}/xsl-stylesheets-[0-9\.]+" $CATALOG 260 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $CATALOG
256 clean_catalog "${DOCBOOKDIR}/xsl-stylesheets-[0-9\.]+" $ROOTCATALOG 261 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $ROOTCATALOG
257 262
258 # Find the available XSL stylesheets. In theory there should only 263 xsldir=/usr/share/sgml/docbook/${type}-stylesheets
259 # be one match since these aren't slotted, but restrict to the 264
260 # first match anyway...
261 avail=$(find ${DOCBOOKDIR%/*} -name chunk.xsl | head -n 1)
262 if [[ -z ${avail} ]]; then 265 if [[ ! -d ${xsldir} ]]; then
263 echo "Could not locate chunk.xsl of DocBook XSL stylesheets" >&2 266 echo "DocBook XSL stylesheets (${type}) not found" >&2
264 return 1 267 return 1
265 fi 268 fi
266 xsldir=${avail%/*/*} 269
267 if [[ ! -e ${xsldir}/html/docbook.xsl || ! -e ${xsldir}/common/l10n.xml ]]; then 270 if [[ ! -e ${xsldir}/html/docbook.xsl || ! -e ${xsldir}/common/l10n.xml ]]; then
268 echo "DocBook XSLT stylesheets are missing files from ${xsldir}" >&2 271 echo "DocBook XSL stylesheets are missing files from ${xsldir}" >&2
269 return 1 272 return 1
270 fi 273 fi
271 274
272 # Populate catalog with XSL entries 275 # Populate catalog with XSL entries
273 echo "Found DocBook XSL stylesheets in ${xsldir}" 276 echo "Found DocBook XSL stylesheets (${type}) in ${xsldir}"
274 verb " Populating ${CATALOG} with XSL stylesheets" 277 verb " Populating ${CATALOG} with XSL stylesheets"
278
279 # HACK: This is a totally arbitrary subset, either it should
280 # be reduced to just current or it should be expanded.
275 for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \ 281 for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \
276 1.48 1.49 1.50 ${xsldir##*-} 282 1.48 1.49 1.50
277 do 283 do
278 xmlcatalog --noout --add "rewriteSystem" "http://docbook.sourceforge.net/release/xsl/${version}" "file://${xsldir}" ${CATALOG} 284 xmlcatalog --noout --add "rewriteSystem" "http://docbook.sourceforge.net/release/${type}/${version}" "file://${xsldir}" ${CATALOG}
279 xmlcatalog --noout --add "rewriteURI" "http://docbook.sourceforge.net/release/xsl/${version}" "file://${xsldir}" ${CATALOG} 285 xmlcatalog --noout --add "rewriteURI" "http://docbook.sourceforge.net/release/${type}/${version}" "file://${xsldir}" ${CATALOG}
280 done 286 done
281} 287}
282 288
283# Call the main routine 289# Call the main routine
284main "$@" 290main "$@"

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20