mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-27 03:21:26 +03:00
enhanced per bug 119876. Further info posted to the mailing list.
* doc/buildDocBookCatalog: enhanced per bug 119876. Further info posted to the mailing list.
This commit is contained in:
parent
a3215c7ae6
commit
6ca9ec82ce
@ -1,3 +1,8 @@
|
||||
Sat Jul 31 11:01:33 PDT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* doc/buildDocBookCatalog: enhanced per bug 119876. Further
|
||||
info posted to the mailing list.
|
||||
|
||||
Sat Jul 31 09:12:44 PDT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* SAX2.c, encoding.c, error.c, parser.c, tree.c, uri.c, xmlIO.c,
|
||||
|
@ -1,22 +1,177 @@
|
||||
#! /bin/bash
|
||||
if [ ! -d /etc/xml -a -w /etc ]
|
||||
then
|
||||
echo Directory /etc/xml missing creating it
|
||||
mkdir /etc/xml
|
||||
chmod 755 /etc/xml
|
||||
fi
|
||||
if [ -w /etc/xml/catalog ] || [ -w /etc/xml -a ! -e /etc/xml/catalog ]
|
||||
then
|
||||
ROOTCATALOG=/etc/xml/catalog
|
||||
CATALOG=/etc/xml/docbook
|
||||
else
|
||||
echo Unable to update root catalog /etc/xml/catalog
|
||||
echo Using $HOME/xmlcatalog as the root catalog
|
||||
echo export XMLCATALOG=$HOME/xmlcatalog
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $pname [OPTION]
|
||||
|
||||
Known values for OPTION are:
|
||||
--prefix=DIR change the output directory for catalog files
|
||||
[default $DIR]
|
||||
--show display the output filenames and paths
|
||||
--version=x.y.z change the DocBook version [default $VERSION]
|
||||
--debug display script action information
|
||||
--help display this help and exit
|
||||
EOF
|
||||
}
|
||||
|
||||
setdefault()
|
||||
{
|
||||
echo Unable to update root catalog $ROOTCATALOG
|
||||
ROOTCATALOG=$HOME/xmlcatalog
|
||||
CATALOG=$HOME/dbkxmlcatalog
|
||||
DIR=$HOME
|
||||
CAT=xmlcatalog
|
||||
echo Using $ROOTCATALOG as the root catalog
|
||||
echo Remember to export XML_CATALOG_FILES=$ROOTCATALOG
|
||||
echo
|
||||
prefix=1
|
||||
}
|
||||
|
||||
fixname()
|
||||
{
|
||||
#
|
||||
# ROOTCATALOG contains the full pathname for the catalog. We will
|
||||
# split that into the directory name and the filename, then we will
|
||||
# see if the directory exists. If it does not, we will attempt to
|
||||
# create it.
|
||||
#
|
||||
if test $verbose = 1
|
||||
then
|
||||
echo Checking path $ROOTCATALOG for permissions
|
||||
fi
|
||||
# First we split the filename and directory name
|
||||
CAT=`basename $ROOTCATALOG`
|
||||
DIR=`dirname $ROOTCATALOG`
|
||||
if test "$DIR" = ""
|
||||
then
|
||||
echo Unable to isolate directory name from '$ROOTCATALOG' - exiting
|
||||
exit 1
|
||||
fi
|
||||
CATALOG=${DIR}/docbook
|
||||
parent=`dirname $DIR`
|
||||
if test "$parent" == ""
|
||||
then
|
||||
parent=/
|
||||
fi
|
||||
if [ ! -d $DIR ]
|
||||
then
|
||||
if test $verbose = 1
|
||||
then
|
||||
echo Directory $DIR missing - I will try to create it
|
||||
fi
|
||||
if [ ! -w $parent ]
|
||||
then
|
||||
if test $verbose = 1
|
||||
then
|
||||
echo No write permission for directory $parent
|
||||
fi
|
||||
setdefault
|
||||
else
|
||||
newdir=1
|
||||
fi
|
||||
else
|
||||
if [ -f $ROOTCATALOG -a ! -w $ROOTCATALOG ] ||
|
||||
[ -e $ROOTCATALOG -a ! -f $ROOTCATALOG ] ||
|
||||
[ ! -e $ROOTCATALOG -a ! -w $DIR ]
|
||||
then
|
||||
setdefault
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
finddbx()
|
||||
{
|
||||
dtd421=""
|
||||
s="//OASIS//DTD DocBook XML V${VERSION}//EN"
|
||||
found=`find $1 -name docbookx.dtd -exec grep -l "$s" {} \;`
|
||||
for dtd in $found; do
|
||||
docbookdir=`dirname $dtd`
|
||||
echo Found DocBook XML $VERSION DTD in $docbookdir
|
||||
#
|
||||
# The original script had a check for write permission on the file
|
||||
# but I can't see why it should be necessary
|
||||
#
|
||||
dtd421=$dtd
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Preset script control params
|
||||
show=0
|
||||
prefix=0
|
||||
newdir=0
|
||||
verbose=0
|
||||
#
|
||||
# Isolate the script name for messages
|
||||
pname=`basename $0`
|
||||
VERSION=4.1.2
|
||||
|
||||
if test "$XML_CATALOG_FILES" != ""
|
||||
then
|
||||
ROOTCATALOG=$XML_CATALOG_FILES
|
||||
else
|
||||
ROOTCATALOG=/etc/xml/catalog
|
||||
fi
|
||||
|
||||
#
|
||||
# Interpret script parameters
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
-p=* | --prefix=*)
|
||||
ROOTCATALOG=$optarg/catalog
|
||||
prefix=1
|
||||
;;
|
||||
|
||||
-s | --show)
|
||||
show=1
|
||||
;;
|
||||
|
||||
-v=* | --version=*)
|
||||
VERSION=$optarg
|
||||
;;
|
||||
|
||||
-d | --debug)
|
||||
verbose=1
|
||||
;;
|
||||
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
* )
|
||||
echo Invalid argument "$1"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
fixname
|
||||
if test $prefix != 0
|
||||
then
|
||||
export XML_CATALOG_FILES=$ROOTCATALOG
|
||||
fi
|
||||
if test $show != 0
|
||||
then
|
||||
echo XML Catalog is $ROOTCATALOG
|
||||
echo Docbook Catalog is $CATALOG
|
||||
exit 0
|
||||
fi
|
||||
if test $newdir!=0
|
||||
then
|
||||
mkdir -p $DIR
|
||||
chmod 755 $DIR
|
||||
fi
|
||||
|
||||
echo Starting run
|
||||
#
|
||||
# create the catalogs root and docbook specific
|
||||
#
|
||||
@ -40,71 +195,51 @@ fi
|
||||
#
|
||||
# find the prefix for DocBook DTD
|
||||
#
|
||||
found=`find /usr/share/xml -name docbookx.dtd`
|
||||
if [ "$found" = "" ] ; then
|
||||
found=`find $HOME -name docbookx.dtd`
|
||||
finddbx /usr/share/xml
|
||||
if [ "$dtd421" = "" ] ; then
|
||||
finddbx $HOME
|
||||
fi
|
||||
if [ "$found" = "" ] ; then
|
||||
found=`find /usr/local -name docbookx.dtd`
|
||||
if [ "$dtd421" = "" ] ; then
|
||||
finddbx /usr/local
|
||||
fi
|
||||
if [ "$found" = "" ] ; then
|
||||
found=`find /usr/share/sgml -name docbookx.dtd`
|
||||
if [ "$dtd421" = "" ] ; then
|
||||
finddbx /usr/share/sgml
|
||||
fi
|
||||
if [ "$found" = "" ] ; then
|
||||
echo could not locate docbookx.dtd for DocBook XML
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dtd421=""
|
||||
for dtd in $found; do
|
||||
check=`grep '//OASIS//DTD DocBook XML V4.1.2//EN' $dtd`
|
||||
if [ "$check" != "" ] ; then
|
||||
dtd421=$dtd
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$dtd421" = "" ] ; then
|
||||
echo could not locate version 4.1.2 of DocBook XML
|
||||
echo could not locate version $VERSION of DocBook XML
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docbookdir=`dirname $dtd421`
|
||||
echo Found DocBook XML 4.1.2 DTD in $docbookdir
|
||||
if [ ! -w $docbookdir ] ; then
|
||||
echo Cannot write to $docbookdir
|
||||
exit 2
|
||||
fi
|
||||
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//ELEMENTS DocBook XML Information Pool V4.1.2//EN" \
|
||||
"-//OASIS//ELEMENTS DocBook XML Information Pool V${VERSION}//EN" \
|
||||
"file://$docbookdir/dbpoolx.mod" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//DTD DocBook XML V4.1.2//EN" \
|
||||
"-//OASIS//DTD DocBook XML V${VERSION}//EN" \
|
||||
"file://$docbookdir/docbookx.dtd" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN" \
|
||||
"-//OASIS//ENTITIES DocBook XML Character Entities V${VERSION}//EN" \
|
||||
"file://$docbookdir/dbcentx.mod" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//ENTITIES DocBook XML Notations V4.1.2//EN" \
|
||||
"-//OASIS//ENTITIES DocBook XML Notations V${VERSION}//EN" \
|
||||
"file://$docbookdir/dbnotnx.mod" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//ENTITIES DocBook XML Additional General Entities V4.1.2//EN" \
|
||||
"-//OASIS//ENTITIES DocBook XML Additional General Entities V${VERSION}//EN" \
|
||||
"file://$docbookdir/dbgenent.mod" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.1.2//EN" \
|
||||
"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V${VERSION}//EN" \
|
||||
"file://$docbookdir/dbhierx.mod" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
|
||||
"file://$docbookdir/soextblx.dtd" $CATALOG
|
||||
xmlcatalog --noout --add "public" \
|
||||
"-//OASIS//DTD DocBook XML CALS Table Model V4.1.2//EN" \
|
||||
"-//OASIS//DTD DocBook XML CALS Table Model V${VERSION}//EN" \
|
||||
"file://$docbookdir/calstblx.dtd" $CATALOG
|
||||
xmlcatalog --noout --add "rewriteSystem" \
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2" \
|
||||
"http://www.oasis-open.org/docbook/xml/${VERSION}" \
|
||||
"file://$docbookdir" $CATALOG
|
||||
xmlcatalog --noout --add "rewriteURI" \
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2" \
|
||||
"http://www.oasis-open.org/docbook/xml/${VERSION}" \
|
||||
"file://$docbookdir" $CATALOG
|
||||
|
||||
xmlcatalog --noout --add "delegatePublic" \
|
||||
|
Loading…
Reference in New Issue
Block a user