/[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.9 Revision 1.10
1#!/bin/bash 1#!/bin/bash
2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.9 2012/03/27 21:28:18 vapier Exp $ 2# $Header: /var/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.10 2012/03/27 22:39:03 vapier 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-2012 Gentoo Foundation 7# Copyright 2004-2012 Gentoo Foundation
35 35
36# 36#
37# main (called from bottom) 37# main (called from bottom)
38# 38#
39main() { 39main() {
40 typeset d v opts 40 local d v opts
41 41
42 opts=$(getopt -o hv --long help,verbose -n "$ZERO" -- "$@") || exit 1 42 opts=$(getopt -o hv --long help,verbose -n "$ZERO" -- "$@") || exit 1
43 eval set -- "$opts" 43 eval set -- "$opts"
44 while true; do 44 while true; do
45 case "$1" in 45 case "$1" in
147# clean_catalog 147# clean_catalog
148# $1 == regex to clean 148# $1 == regex to clean
149# $2 == catalog 149# $2 == catalog
150# 150#
151clean_catalog() { 151clean_catalog() {
152 typeset list f regex=$1 catalog=$2 152 local list f regex=$1 catalog=$2
153 153
154 list=$(egrep --only-matching "${regex}" "${catalog}" | sort -u) 154 list=$(egrep --only-matching "${regex}" "${catalog}" | sort -u)
155 for f in ${list}; do 155 for f in ${list}; do
156 xmlcatalog --noout --del "${f}" ${catalog} 156 xmlcatalog --noout --del "${f}" ${catalog}
157 done 157 done
160# 160#
161# populate a specific dtd version into the docbook catalog 161# populate a specific dtd version into the docbook catalog
162# $1 == /path/to/docbookx.dtd 162# $1 == /path/to/docbookx.dtd
163# 163#
164populate_dtd() { 164populate_dtd() {
165 typeset dtd=$1 docbookdir=${1%/*} dtd_date 165 local dtd=$1 docbookdir=${1%/*} dtd_date
166 typeset v=${docbookdir##*-} 166 local v=${docbookdir##*-}
167 167
168 # sanity check 168 # sanity check
169 if [[ ${dtd} != */xml-dtd-*/* ]]; then 169 if [[ ${dtd} != */xml-dtd-*/* ]]; then
170 echo "Warning: I don't understand \"${dtd}\"" >&2 170 echo "Warning: I don't understand \"${dtd}\"" >&2
171 return 171 return
207# 207#
208# populate a specific simple dtd version into the docbook catalog 208# populate a specific simple dtd version into the docbook catalog
209# $1 == /path/to/sdocbook.dtd 209# $1 == /path/to/sdocbook.dtd
210# 210#
211populate_simple_dtd() { 211populate_simple_dtd() {
212 typeset dtd=$1 docbookdir=${1%/*} 212 local dtd=$1 docbookdir=${1%/*}
213 typeset v=${docbookdir##*-} 213 local v=${docbookdir##*-}
214 214
215 # sanity check 215 # sanity check
216 if [[ ${dtd} != */xml-simple-dtd-*/* ]]; then 216 if [[ ${dtd} != */xml-simple-dtd-*/* ]]; then
217 echo "Warning: I don't understand \"${dtd}\"" >&2 217 echo "Warning: I don't understand \"${dtd}\"" >&2
218 return 218 return
228 228
229# 229#
230# populate ISO DocBook entities from the most recent DTD 230# populate ISO DocBook entities from the most recent DTD
231# 231#
232populate_entities() { 232populate_entities() {
233 typeset isodir=${LATEST_DTD%/*}/ent i j 233 local isodir=${LATEST_DTD%/*}/ent i j
234 typeset -a entities avail 234 local entities=() avail=()
235 235
236 # sanity check 236 # sanity check
237 if [[ -z ${LATEST_DTD} || ! -d ${isodir} ]]; then 237 if [[ -z ${LATEST_DTD} || ! -d ${isodir} ]]; then
238 echo "No ISO DocBook entities available for catalog" 238 echo "No ISO DocBook entities available for catalog"
239 return 0 239 return 0
296 296
297# 297#
298# populate XSL stylesheets 298# populate XSL stylesheets
299# 299#
300populate_xsl() { 300populate_xsl() {
301 typeset listed avail f 301 local f
302 302
303 # This is either xsl, xsl-ns, xsl-saxon or xsl-xalan 303 # This is either xsl, xsl-ns, xsl-saxon or xsl-xalan
304 local type=$1 304 local type=$1
305 305
306 # Delete current entries from the catalog (delete legacy versioned entries too) 306 # Delete current entries from the catalog (delete legacy versioned entries too)
307 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $CATALOG 307 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $CATALOG
308 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $ROOTCATALOG 308 clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" $ROOTCATALOG
309 309
310 xsldir=/usr/share/sgml/docbook/${type}-stylesheets 310 local xsldir=/usr/share/sgml/docbook/${type}-stylesheets
311 311
312 if [[ ! -d ${xsldir} ]]; then 312 if [[ ! -d ${xsldir} ]]; then
313 echo "DocBook XSL stylesheets (${type}) not found" >&2 313 echo "DocBook XSL stylesheets (${type}) not found" >&2
314 return 1 314 return 1
315 fi 315 fi

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20