[Frugalware-git] kdetesting: docbook-xml-4.5-4-i686

Michel Hermier hermier at frugalware.org
Wed Jan 13 19:34:02 CET 2010


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=721693b88d0dcb9e6dba1995c4fe506e999c5649

commit 721693b88d0dcb9e6dba1995c4fe506e999c5649
Author: Michel Hermier <hermier at frugalware.org>
Date:   Wed Jan 13 19:20:15 2010 +0100

docbook-xml-4.5-4-i686

* pkgrel++
* Rewrite near all (follow the blfs way)

diff --git a/source/apps/docbook-xml/FrugalBuild b/source/apps/docbook-xml/FrugalBuild
index 8b2bc4a..80cadbe 100644
--- a/source/apps/docbook-xml/FrugalBuild
+++ b/source/apps/docbook-xml/FrugalBuild
@@ -3,41 +3,26 @@

pkgname=docbook-xml
pkgver=4.5
-pkgrel=3
+pkgrel=4
pkgdesc="A widely used XML scheme for writing documentation and help"
url="http://www.oasis-open.org/docbook/xml/"
depends=('libxml2')
rodepends=('sed')
groups=('apps')
archs=('i686' 'x86_64' 'ppc')
-up2date="lynx -dump ${url}index.1.shtml|grep current|sed 's/.*V\([0-9\.]\+\) .*/\1/'"
-source=(${url}$pkgver/$pkgname-$pkgver.zip \
-    ${url}4.4/$pkgname-4.4.zip \
-    ${url}4.3/$pkgname-4.3.zip \
-    ${url}4.2/$pkgname-4.2.zip \
-    ${url}4.1.2/docbkx412.zip)
-sha1sums=('b9124233b50668fb508773aa2b3ebc631d7c1620' \
-          '7c4d91c82ad3747e1b5600c91782758e5d91c22b' \
-          'e79a59e9164c1013b8cc9f64f96f909a184ca016' \
-          '5e3a35663cd028c5c5fbb959c3858fec2d7f8b9e' \
-          'b9ae7a41056bfaf885581812d60651b7b5531519')
+up2date="lynx -dump "${url}index.1.shtml"|grep current|sed 's/.*V\([0-9\.]\+\) .*/\1/'"
+source=("${url}$pkgver/$pkgname-$pkgver.zip")
+sha1sums=('b9124233b50668fb508773aa2b3ebc631d7c1620')
+
+install="$pkgname.install"
+options=('scriptlet')

build() {
-    subver=('412' '4.2' '4.3' '4.4' '4.5')
-    for version in "${subver[@]}"
-    do
-	if [ "$version" != "412" ]; then
-        	Fextract $pkgname-$version.zip
-	else
-		Fextract docbkx412.zip
-		version=4.1.2
-	fi
-	Fmkdir /usr/share/sgml/docbook/dtd/xml-dtd-$version
-	Ffilerel *.cat /usr/share/sgml/docbook/dtd/xml-dtd-$version/
-	Ffilerel *.dtd /usr/share/sgml/docbook/dtd/xml-dtd-$version/
-        Ffilerel *.xml /usr/share/sgml/docbook/dtd/xml-dtd-$version/
-        Ffilerel *.mod /usr/share/sgml/docbook/dtd/xml-dtd-$version/
-        Fcprel ent /usr/share/sgml/docbook/dtd/xml-dtd-$version/
-    done
+	Fmkdir /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver
+	Ffilerel *.cat /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver/
+	Ffilerel *.dtd /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver/
+	Ffilerel *.xml /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver/
+	Ffilerel *.mod /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver/
+	Fcprel ent /usr/share/sgml/docbook/dtd/xml-dtd-$pkgver/
}

diff --git a/source/apps/docbook-xml/docbook-xml.install b/source/apps/docbook-xml/docbook-xml.install
index 9f6dbda..29a761f 100644
--- a/source/apps/docbook-xml/docbook-xml.install
+++ b/source/apps/docbook-xml/docbook-xml.install
@@ -1,368 +1,226 @@
-subver=('4.1.2' '4.2' '4.3' '4.4' '4.5')
+subver=('4.1.2' '4.2' '4.3' '4.4') # '4.5'
ROOTCATALOG=/etc/xml/catalog
CATALOG=/etc/xml/docbook
-DOCBOOKDIR=/usr/share/sgml/docbook
-DTDS=
-LATEST_DTD=
-LATEST_DATE=
+DOCBOOKDIR=/usr/share/xml/docbook

+catalog_create_empty() {
+	local catalog="$1"

-#
-# create the catalogs root and docbook specific
-#
-create_catalogs() {
-#create dir if neccessary
-mkdir -p /etc/xml/
+	if [ ! -e "${catalog}" ]; then
+		# create dir if necessary
+		mkdir -p "`dirname "$catalog"`"

-if [[ ! -r ${ROOTCATALOG} ]] ; then
-		echo "Creating XML Catalog root ${ROOTCATALOG}"
-		/usr/bin/xmlcatalog --noout --create ${ROOTCATALOG}
-		if [[ ! -r ${ROOTCATALOG} ]] ; then
-			echo "Failed creating ${ROOTCATALOG}, aborting" >&2
+		echo "Creating XML Catalog ${catalog}" >&2
+		xmlcatalog --noout --create "${catalog}"
+		if [ ! -e "${catalog}" ]; then
+			echo "Failed creating ${catalog}, aborting" >&2
return 1
fi
-	else
-		# clean out existing entries
-		clean_catalog "file://${CATALOG}" ${ROOTCATALOG}
fi
+	return 0
+}

-	if [[ ! -r ${CATALOG} ]] ; then
-		echo "Creating DocBook XML Catalog ${CATALOG}"
-		/usr/bin/xmlcatalog --noout --create ${CATALOG}
-		if [[ ! -r ${CATALOG} ]] ; then
-			echo "Failed creating ${CATALOG}, aborting" >&2
-			return 1
-		fi
+catalog_create() {
+	if ! catalog_create_empty "${ROOTCATALOG}"; then
+		return 1
fi

-	# dtd pointers
-	xmlcatalog --noout --add "delegatePublic" "-//OASIS//ENTITIES DocBook XML" "file://${CATALOG}" ${ROOTCATALOG} &>/dev/null
-	xmlcatalog --noout --add "delegatePublic" "-//OASIS//DTD DocBook XML" "file://${CATALOG}" ${ROOTCATALOG} &>/dev/null
-	xmlcatalog --noout --add "delegateSystem" "http://www.oasis-open.org/docbook/" "file://${CATALOG}" ${ROOTCATALOG} &>/dev/null
-	xmlcatalog --noout --add "delegateURI" "http://www.oasis-open.org/docbook/" "file://${CATALOG}" ${ROOTCATALOG} &>/dev/null
+	if ! catalog_create_empty "${CATALOG}"; then
+		return 1
+	fi
+	return 0
+}

-	# entities pointer
-	xmlcatalog --noout --add "delegatePublic" "ISO 8879:1986" "file://${CATALOG}" ${ROOTCATALOG} &>/dev/null
-	for version in "${subver[@]}"
-	do
-	if [ ! -e /etc/xml/catalog ]; then mkdir -p /etc/xml; xmlcatalog --noout \
-		--create /etc/xml/catalog; fi &&
-		if [ ! -e /etc/xml/docbook ]; then xmlcatalog --noout --create \
-		/etc/xml/docbook; fi &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//ELEMENTS DocBook XML Information Pool V${version}//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/dbpoolx.mod" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//DTD DocBook XML V${version}//EN" \
-		"http://oasis-open.org/docbook/xml/${version}/docbookx.dtd" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//ENTITIES DocBook XML Character Entities V${version}//EN" \
-		"file:///usr/share/xml/docbook/xml-dtd-${version}/dbcentx.mod" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//ENTITIES DocBook XML Notations V${version}//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/dbnotnx.mod" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//ENTITIES DocBook XML Additional General Entities V${version}//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/dbgenent.mod" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
-		"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V${version}//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/dbhierx.mod" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "public" \
+catalog_add() {
+	local _NEW=`echo $1 | sed 's|\(.*\)\-.*|\1|'`
+
+	if ! catalog_create; then
+		return 1
+	fi
+
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//DTD DocBook XML V$_NEW//EN" \
+		"http://www.oasis-open.org/docbook/xml/$_NEW/docbookx.dtd" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//DTD DocBook XML CALS Table Model V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/calstblx.dtd" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/soextblx.dtd" \
-		/etc/xml/docbook &&
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/soextblx.dtd" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ELEMENTS DocBook XML Information Pool V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/dbpoolx.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/dbhierx.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ELEMENTS DocBook XML HTML Tables V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/htmltblx.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ENTITIES DocBook XML Notations V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/dbnotnx.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ENTITIES DocBook XML Character Entities V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/dbcentx.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "public" \
+		"-//OASIS//ENTITIES DocBook XML Additional General Entities V$_NEW//EN" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW/dbgenent.mod" \
+		"$CATALOG"
+	xmlcatalog --noout --add "rewriteSystem" \
+		"http://www.oasis-open.org/docbook/xml/$_NEW" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW" \
+		"$CATALOG"
+	xmlcatalog --noout --add "rewriteURI" \
+		"http://www.oasis-open.org/docbook/xml/$_NEW" \
+		"file://${DOCBOOKDIR}/xml-dtd-$_NEW" \
+		"$CATALOG"
+
+	xmlcatalog --noout --add "delegatePublic" \
+		"-//OASIS//ENTITIES DocBook XML" \
+		"file://$CATALOG" \
+		"$ROOTCATALOG"
+	xmlcatalog --noout --add "delegatePublic" \
+		"-//OASIS//DTD DocBook XML" \
+		"file://$CATALOG" \
+		"$ROOTCATALOG"
+	xmlcatalog --noout --add "delegateSystem" \
+		"http://www.oasis-open.org/docbook/" \
+		"file://$CATALOG" \
+		"$ROOTCATALOG"
+	xmlcatalog --noout --add "delegateURI" \
+		"http://www.oasis-open.org/docbook/" \
+		"file://$CATALOG" \
+		"$ROOTCATALOG"
+
+	local DTDVERSION
+	for DTDVERSION in "${subver[@]}"
+	do
xmlcatalog --noout --add "public" \
-		"-//OASIS//DTD DocBook XML CALS Table Model V${version}//EN" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}/calstblx.dtd" \
-		/etc/xml/docbook &&
+			"-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION/docbookx.dtd" \
+			"$CATALOG"
xmlcatalog --noout --add "rewriteSystem" \
-		"http://www.oasis-open.org/docbook/xml/${version}" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}" \
-		/etc/xml/docbook &&
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+			"file://${DOCBOOKDIR}/xml-dtd-$_NEW" \
+			"$CATALOG"
xmlcatalog --noout --add "rewriteURI" \
-		"http://www.oasis-open.org/docbook/xml/${version}" \
-		"file:///usr/share/sgml/docbook/dtd/xml-dtd-${version}" \
-		/etc/xml/docbook &&
-		xmlcatalog --noout --add "delegatePublic" \
-		"-//OASIS//ENTITIES DocBook XML" \
-		"file:///etc/xml/docbook" /etc/xml/catalog &&
-		xmlcatalog --noout --add "delegatePublic" \
-		"-//OASIS//DTD DocBook XML" \
-		"file:///etc/xml/docbook" /etc/xml/catalog &&
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+			"file://${DOCBOOKDIR}/xml-dtd-$_NEW" \
+			"$CATALOG"
xmlcatalog --noout --add "delegateSystem" \
-		"http://www.oasis-open.org/docbook/" \
-		"file:///etc/xml/docbook" /etc/xml/catalog &&
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+			"file://$CATALOG" \
+			"$ROOTCATALOG"
xmlcatalog --noout --add "delegateURI" \
-		"http://www.oasis-open.org/docbook/" \
-		"file:///etc/xml/docbook" /etc/xml/catalog
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+			"file://$CATALOG" \
+			"$ROOTCATALOG"
done
+	return 0
}

-#
-# delete the catalogs root and docbook specific
-#
-delete_catalogs() {
-for version in "${subver[@]}"
-	do
-	xmlcatalog --noout --del \
-	    "-//OASIS//ENTITIES DocBook XML" \
-	    /etc/xml/catalog &&
-	xmlcatalog --noout --del \
-		"-//OASIS//DTD DocBook XML" \
-	    /etc/xml/catalog &&
-	xmlcatalog --noout --del \
-	    "http://www.oasis-open.org/docbook/" \
-	    /etc/xml/catalog &&
-	xmlcatalog --noout --del \
-	    "http://www.oasis-open.org/docbook/" \
-	    /etc/xml/catalog &&
+catalog_remove() {
+	local _OLD=`echo $2 | sed 's|\(.*\)\-.*|\1|'`
+
+	# Recreate the catalogs to avoid creation of a stale/broken catalog
+	# while deleting entries on a non existing catalog
+	if ! catalog_create; then
+		return 1
+	fi

xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-pub.ent" /etc/xml/docbook &&
-	xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-grk1.ent" /etc/xml/docbook &&
-	xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-box.ent" /etc/xml/docbook &&
-	xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-grk3.ent" /etc/xml/docbook &&
-	xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amsn.ent" /etc/xml/docbook &&
-	xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-num.ent" /etc/xml/docbook &&
+		"-//OASIS//DTD DocBook XML V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-grk4.ent" /etc/xml/docbook &&
+		"-//OASIS//DTD DocBook XML CALS Table Model V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-dia.ent" /etc/xml/docbook &&
+		"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-grk2.ent" /etc/xml/docbook &&
+		"-//OASIS//ELEMENTS DocBook XML Information Pool V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amsa.ent" /etc/xml/docbook &&
+		"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amso.ent" /etc/xml/docbook &&
+		"-//OASIS//ELEMENTS DocBook XML HTML Tables V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-cyr1.ent" /etc/xml/docbook &&
+		"-//OASIS//ENTITIES DocBook XML Notations V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-tech.ent" /etc/xml/docbook &&
+		"-//OASIS//ENTITIES DocBook XML Character Entities V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amsc.ent" /etc/xml/docbook &&
+		"-//OASIS//ENTITIES DocBook XML Additional General Entities V$_OLD//EN" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-lat1.ent" /etc/xml/docbook &&
+		"http://www.oasis-open.org/docbook/xml/$_OLD" \
+		"$CATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amsb.ent" /etc/xml/docbook &&
+		"http://www.oasis-open.org/docbook/xml/$_OLD" \
+		"$CATALOG"
+
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-lat2.ent" /etc/xml/docbook &&
+		"-//OASIS//ENTITIES DocBook XML" \
+		"$ROOTCATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-amsr.ent" /etc/xml/docbook &&
+		"-//OASIS//DTD DocBook XML" \
+		"$ROOTCATALOG"
xmlcatalog --noout --del \
-	    "file:///usr/share/sgml/docbook/dtd/xml-dtd-$version/ent/iso-cyr2.ent" /etc/xml/docbook &&
-
+		"http://www.oasis-open.org/docbook/" \
+		"$ROOTCATALOG"
xmlcatalog --noout --del \
-	    "ISO 8879:1986" /etc/xml/catalog
-done
-}
-
-#
-# fill in the DTDS variable based on installed versions
-#
-set_dtds() {
-	DTDS=$(find ${DOCBOOKDIR} -path '*/xml-dtd-*/docbookx.dtd')
-	if [[ -z ${DTDS} ]]; then
-		echo "No installed DocBook XML DTDs found"
-		return 1
-	else
-		return 0
-	fi
-}
-
-#
-# clean_catalog
-# $1 == regex to clean
-# $2 == catalog
-#
-clean_catalog() {
-	typeset list f regex=$1 catalog=$2
-
-	list=$(egrep --only-matching "${regex}" "${catalog}" | sort -u)
-	for f in ${list}; do
-		xmlcatalog --noout --del "${f}" ${catalog}
-	done
-}
-
-#
-# populate a specific dtd version into the docbook catalog
-# $1 == /path/to/docbookx.dtd
-#
-populate_dtd() {
-	typeset dtd=$1 docbookdir=${1%/*} dtd_date
-	typeset v=${docbookdir##*-}
-
-	# sanity check
-	if [[ ${dtd} != */xml-dtd-*/* ]]; then
-		echo "Warning: I don't understand \"${dtd}\"" >&2
-		return
-	fi
-
-	# Populate the docbook catalog with this version
-	xmlcatalog --noout --add "public" "-//OASIS//ELEMENTS DocBook XML Information Pool V${v}//EN" "file://${docbookdir}/dbpoolx.mod" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//DTD DocBook XML V${v}//EN" "file://${docbookdir}/docbookx.dtd" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//ENTITIES DocBook XML Character Entities V${v}//EN" "file://${docbookdir}/dbcentx.mod" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//ENTITIES DocBook XML Notations V${v}//EN" "file://${docbookdir}/dbnotnx.mod" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//ENTITIES DocBook XML Additional General Entities V${v}//EN" "file://${docbookdir}/dbgenent.mod" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V${v}//EN" "file://${docbookdir}/dbhierx.mod" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//DTD XML Exchange Table Model 19990315//EN" "file://${docbookdir}/soextblx.dtd" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "public" "-//OASIS//DTD DocBook XML CALS Table Model V${v}//EN" "file://${docbookdir}/calstblx.dtd" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "rewriteSystem" "http://www.oasis-open.org/docbook/xml/${v}" "file://${docbookdir}" ${CATALOG} &>/dev/null
-	xmlcatalog --noout --add "rewriteURI" "http://www.oasis-open.org/docbook/xml/${v}" "file://${docbookdir}" ${CATALOG} &>/dev/null
-
-	# grab the RCS date from docbookx.dtd for comparison purposes
-	if [[ ! -f ${docbookdir}/ent/iso-lat1.ent ]]; then
-		return 0
-	fi
-	dtd_date=$(egrep --only-matching --max-count=1 \
-		'[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}' "${dtd}")
-	if [[ -z ${dtd_date} ]]; then
-		return 0
-	fi
-	dtd_date=$(date -d "$dtd_date" +%s)
-	if [[ -z $LATEST_DTD || $dtd_date -gt $LATEST_DATE ]]; then
-		LATEST_DATE=${dtd_date}
-		LATEST_DTD=${dtd}
-	fi
-}
-
-#
-# populate ISO DocBook entities from the most recent DTD
-#
-populate_entities() {
-	typeset isodir=${LATEST_DTD%/*}/ent i j
-	typeset -a entities avail
-
-	# sanity check
-	if [[ -z ${LATEST_DTD} || ! -d ${isodir} ]]; then
-		echo "No ISO DocBook entities available for catalog"
-		return 0
-	fi
-
-	# here are the entities we know about;
-	# note these must remain sorted!
-	entities=(
-		"iso-amsa.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN"
-		"iso-amsb.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN"
-		"iso-amsc.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN"
-		"iso-amsn.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN"
-		"iso-amso.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN"
-		"iso-amsr.ent" "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN"
-		"iso-box.ent" "ISO 8879:1986//ENTITIES Box and Line Drawing//EN"
-		"iso-cyr1.ent" "ISO 8879:1986//ENTITIES Russian Cyrillic//EN"
-		"iso-cyr2.ent" "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN"
-		"iso-dia.ent" "ISO 8879:1986//ENTITIES Diacritical Marks//EN"
-		"iso-grk1.ent" "ISO 8879:1986//ENTITIES Greek Letters//EN"
-		"iso-grk2.ent" "ISO 8879:1986//ENTITIES Monotoniko Greek//EN"
-		"iso-grk3.ent" "ISO 8879:1986//ENTITIES Greek Symbols//EN"
-		"iso-grk4.ent" "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN"
-		"iso-lat1.ent" "ISO 8879:1986//ENTITIES Added Latin 1//EN"
-		"iso-lat2.ent" "ISO 8879:1986//ENTITIES Added Latin 2//EN"
-		"iso-num.ent" "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN"
-		"iso-pub.ent" "ISO 8879:1986//ENTITIES Publishing//EN"
-		"iso-tech.ent" "ISO 8879:1986//ENTITIES General Technical//EN"
-	)
-
-	# here are the entities available; assume no spaces in filenames...
-	avail=($(ls ${isodir} | sort))
-
-	# double-check the lists
-	i=0 ; j=0
-	while [[ ${i} -lt ${#entities[@]} || ${j} -lt ${#avail[@]} ]]; do
-		if [[ ${i} -ge ${#entities[@]} ]]; then
-			let j=j+1
-		elif [[ ${j} -ge ${#avail[@]} ]]; then
-			let i=i+2
-		elif [[ ${avail[j]} < ${entities[i]} ]]; then
-			let j=j+1
-		elif [[ ${entities[i]} < ${avail[j]} ]]; then
-			let i=i+2
-		elif [[ ${entities[i]} == ${avail[j]} ]]; then
-			xmlcatalog --noout --add "public" "${entities[i+1]}" \
-				"file://${isodir}/${entities[i]}" ${CATALOG}
-			let j=j+1
-			let i=i+2
-		else
-			return 1
-		fi
-	done
-}
-
-
-#
-# update catalog
-#
-update_catalog() {
-
-	# Clean out old dtds from catalog
-	clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${CATALOG}
-	clean_catalog "${DOCBOOKDIR}/xml-dtd-[^/\"']*/[^/\"']*" ${ROOTCATALOG}
-	if set_dtds; then
-		for d in ${DTDS}; do
-			populate_dtd ${d}
-		done
-		populate_entities
-	fi
-}
-
-#
-# Install catalog
-#
-catalog_postinst() {
-
-for version in "${subver[@]}"
-do
-	install-catalog --add /etc/sgml/xml-docbook-$version.cat \
-		/usr/share/sgml/docbook/dtd/xml-dtd-$version/docbook.cat &>/dev/null
-	install-catalog --add /etc/sgml/sgml-docbook.cat \
-		/etc/sgml/xml-docbook-$version.cat &>/dev/null
-done
+		"http://www.oasis-open.org/docbook/" \
+		"$ROOTCATALOG"

-
-}
-#
-# Uninstall catalog
-#
-catalog_postrm() {
-
-    	for version in "${subver[@]}"
+	local DTDVERSION
+	for DTDVERSION in "${subver[@]}"
do
-		install-catalog --remove /etc/sgml/xml-docbook-$version.cat \
-			/usr/share/sgml/docbook/dtd/xml-dtd-$version/docbook.cat &>/dev/null
-		install-catalog --remove /etc/sgml/sgml-docbook.cat \
-			/etc/sgml/xml-docbook-$version.cat &>/dev/null
+		xmlcatalog --noout --del \
+			"-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
+			"$CATALOG"
+		xmlcatalog --noout --del \
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+			"$CATALOG"
+		xmlcatalog --noout --del \
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+			"$CATALOG"
+
+		xmlcatalog --noout --del \
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+			"$ROOTCATALOG"
+		xmlcatalog --noout --del \
+			"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+			"$ROOTCATALOG"
done
}

-
post_install() {
-	echo "updating docbook catalogue... "
-	create_catalogs
-	update_catalog
-	catalog_postinst
+	echo "Adding docbook catalog..."
+	catalog_add "$@"
}

post_upgrade() {
-	post_install $1
-
+	echo "Upgrading docbook catalog..."
+	catalog_remove "$@"
+	catalog_add "$@"
}

pre_remove() {
-	echo "updating docbook catalogue... "
-	catalog_postrm
+	echo "Removing docbook catalog..."
+	rm -rf "$CATALOG" "$ROOTCATALOG"
}

-
op=$1
shift


More information about the Frugalware-git mailing list