/[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.5 Revision 1.6
1#!/bin/bash 1#!/bin/bash
2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.5 2009/08/23 16:06:03 flameeyes Exp $ 2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.6 2011/03/29 02:11:48 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
39 populate_xsl $type 39 populate_xsl $type
40 done 40 done
41 41
42 # Clean out old dtds from catalog 42 # Clean out old dtds from catalog
43 verb "Cleaning out old DocBook XML versions from ${CATALOG} and ${ROOTCATALOG}" 43 verb "Cleaning out old DocBook XML versions from ${CATALOG} and ${ROOTCATALOG}"
44 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${CATALOG} 44 clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" ${CATALOG}
45 clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${ROOTCATALOG} 45 clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" ${ROOTCATALOG}
46 46
47 if set_dtds; then 47 if set_dtds; then
48 for d in ${DTDS}; do 48 for d in ${DTDS}; do
49 populate_dtd ${d} 49 populate_dtd ${d}
50 done 50 done
51 for d in ${SIMPLE_DTDS}; do
52 populate_simple_dtd ${d}
53 done
51 populate_entities 54 populate_entities
52 fi 55 fi
53 56
54 exit 0 57 exit 0
55} 58}
64# 67#
65# fill in the DTDS variable based on installed versions 68# fill in the DTDS variable based on installed versions
66# 69#
67set_dtds() { 70set_dtds() {
68 DTDS=$(find ${DOCBOOKDIR} -path '*/xml-dtd-*/docbookx.dtd') 71 DTDS=$(find ${DOCBOOKDIR} -path '*/xml-dtd-*/docbookx.dtd')
72 SIMPLE_DTDS=$(find ${DOCBOOKDIR} -path '*/xml-simple-dtd-*/sdocbook.dtd')
69 if [[ -z ${DTDS} ]]; then 73 if [[ -z ${DTDS} ]]; then
70 echo "No installed DocBook XML DTDs found" 74 echo "No installed DocBook XML DTDs found"
71 return 1 75 return 1
72 else 76 else
73 return 0 77 return 0
173 dtd_date=$(date -d "$dtd_date" +%s) 177 dtd_date=$(date -d "$dtd_date" +%s)
174 if [[ -z $LATEST_DTD || $dtd_date -gt $LATEST_DATE ]]; then 178 if [[ -z $LATEST_DTD || $dtd_date -gt $LATEST_DATE ]]; then
175 LATEST_DATE=${dtd_date} 179 LATEST_DATE=${dtd_date}
176 LATEST_DTD=${dtd} 180 LATEST_DTD=${dtd}
177 fi 181 fi
182}
183
184#
185# populate a specific simple dtd version into the docbook catalog
186# $1 == /path/to/sdocbook.dtd
187#
188populate_simple_dtd() {
189 typeset dtd=$1 docbookdir=${1%/*}
190 typeset v=${docbookdir##*-}
191
192 # sanity check
193 if [[ ${dtd} != */xml-simple-dtd-*/* ]]; then
194 echo "Warning: I don't understand \"${dtd}\"" >&2
195 return
196 fi
197 echo "Found Simplified DocBook XML ${v} in ${docbookdir}"
198
199 # Populate the docbook catalog with this version
200 verb " Populating ${CATALOG} based on ${docbookdir}"
201 xmlcatalog --noout --add "public" "-//OASIS//DTD Simplified DocBook XML V${v}//EN" "file://${docbookdir}/sdocbook.dtd" ${CATALOG}
202 xmlcatalog --noout --add "rewriteSystem" "http://www.oasis-open.org/docbook/xml/simple/${v}" "file://${docbookdir}" ${CATALOG}
203 xmlcatalog --noout --add "rewriteURI" "http://www.oasis-open.org/docbook/xml/simple/${v}" "file://${docbookdir}" ${CATALOG}
178} 204}
179 205
180# 206#
181# populate ISO DocBook entities from the most recent DTD 207# populate ISO DocBook entities from the most recent DTD
182# 208#

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20