[xml/sgml-commit] [xml-core] 01/07: Import Debian version 0.09

Mattia Rizzolo mattia at debian.org
Fri Sep 30 16:12:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository xml-core.

commit c6bb9935e06c64ba5e35c6021e74d1216b0b5155
Author: Ardo van Rangelrooij <ardo at debian.org>
Date:   Sun Apr 25 11:09:19 2004 -0500

    Import Debian version 0.09
---
 COPYING                         | 340 +++++++++++++++++++++
 MAKE/include                    |  42 +++
 Makefile                        |  53 ++++
 README                          |   7 +
 debhelper/Makefile              |  59 ++++
 debhelper/dh_installxmlcatalogs | 295 +++++++++++++++++++
 debhelper/postinst-xmlcatalog   |   4 +
 debhelper/postrm-xmlcatalog     |   3 +
 debhelper/prerm-xmlcatalog      |   4 +
 debian/README.Debian            |  47 +++
 debian/TODO                     |  30 ++
 debian/changelog                | 135 +++++++++
 debian/compat                   |   1 +
 debian/control                  |  33 +++
 debian/copyright                |  26 ++
 debian/rules                    |  62 ++++
 debian/xml-core.examples        |   1 +
 debian/xml-core.install         |   1 +
 debian/xml-core.links           |   1 +
 debian/xml-core.postinst        |  15 +
 debian/xml-core.postrm          |  48 +++
 debian/xml-core.preinst         |  50 ++++
 debian/xml-core.prerm           |  15 +
 debian/xml-core.sgmlcatalogs    |   1 +
 debian/xml-core.xmlcatalogs     |   3 +
 examples/foo.postinst           |  39 +++
 examples/foo.postrm             |  26 ++
 examples/foo.prerm              |  35 +++
 examples/foo.xmlcatalogs        |   3 +
 schemas/Makefile                |  37 +++
 schemas/catalog                 |  17 ++
 schemas/catalog.dtd             | 147 +++++++++
 schemas/catalog.xml             |  16 +
 schemas/tr9401.dtd              | 123 ++++++++
 tools/Makefile                  |  59 ++++
 tools/catalog.footer            |   1 +
 tools/catalog.header            |   4 +
 tools/lib/Debian/XML/Catalog.pm |   7 +
 tools/update-xmlcatalog         | 639 ++++++++++++++++++++++++++++++++++++++++
 39 files changed, 2429 insertions(+)

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+

+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+

+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+

+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+

+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+

+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/MAKE/include b/MAKE/include
new file mode 100644
index 0000000..7095d7c
--- /dev/null
+++ b/MAKE/include
@@ -0,0 +1,42 @@
+## ----------------------------------------------------------------------
+## MAKE/include : include makefile for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+## System directory definitions
+prefix		= /usr
+bin_dir		= $(prefix)/bin
+sbin_dir	= $(prefix)/sbin
+share_dir	= $(prefix)/share
+
+## ----------------------------------------------------------------------
+## Local directory definitions
+local_dir	= $(prefix)/local
+local_share_dir	= $(local_dir)/share
+
+## ----------------------------------------------------------------------
+## Manual pages directory definitions
+man_dir		= $(share_dir)/man
+man1_ext	= 1
+man1_dir	= $(man_dir)/man$(man1_ext)
+man8_ext	= 8
+man8_dir	= $(man_dir)/man$(man8_ext)
+
+## ----------------------------------------------------------------------
+## XML directory definitions
+xml_dir		= $(share_dir)/xml
+local_xml_dir	= $(local_share_dir)/xml
+schema_dir	= $(xml_dir)/schema
+
+## ----------------------------------------------------------------------
+## Build definitions
+POD2MAN		= pod2man
+
+## ----------------------------------------------------------------------
+## Install definitions
+INSTALL		= install
+INSTALL_DIR	= $(INSTALL) -m 755 -d
+INSTALL_BIN	= $(INSTALL) -m 755
+INSTALL_FILE	= $(INSTALL) -m 644
+
+## ----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ca27fcd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+## ----------------------------------------------------------------------
+## Makefile : makefile for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+include MAKE/include
+
+## ----------------------------------------------------------------------
+## source package subdirectory definitions
+subdirs		= \
+		debhelper \
+		schemas \
+		tools
+
+## ----------------------------------------------------------------------
+## XML infrastructure directory definitions
+xml_dirs	= \
+		declaration \
+		entities \
+		misc \
+		schema
+
+## ----------------------------------------------------------------------
+## targets
+
+all:
+
+		set -e; \
+		for d in $(subdirs); \
+		do \
+			$(MAKE) -C $${d} ${@}; \
+		done
+
+install:
+
+		set -e; \
+		for d in $(xml_dirs); \
+		do \
+			$(INSTALL_DIR) $(xml_dir)/$$d; \
+			$(INSTALL_DIR) $(local_xml_dir)/$$d; \
+		done
+
+		set -e; \
+		for d in $(subdirs); \
+		do \
+			$(MAKE) -C $${d} ${@}; \
+		done
+
+.PHONY:		\
+		all \
+		install
+
+## ----------------------------------------------------------------------
diff --git a/README b/README
new file mode 100644
index 0000000..389d918
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+This is the Debian xml-core package.  To install it on a non-Debian
+system edit the Makefile and then run `make`, `make install`.
+
+The changelog is in the 'debian' directory.
+
+--
+Ardo van Rangelrooij <ardo at debian.org>
diff --git a/debhelper/Makefile b/debhelper/Makefile
new file mode 100644
index 0000000..bc58186
--- /dev/null
+++ b/debhelper/Makefile
@@ -0,0 +1,59 @@
+## ----------------------------------------------------------------------
+## Makefile : makefile for xml-core/debhelper
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+include ../MAKE/include
+
+## ----------------------------------------------------------------------
+## Debhelper directory definitions
+debhelper_dir	= $(share_dir)/debhelper
+autoscripts_dir	= $(debhelper_dir)/autoscripts
+
+## ----------------------------------------------------------------------
+## Debhelper file definitions
+autoscripts	= \
+		postinst-xmlcatalog \
+		postrm-xmlcatalog \
+		prerm-xmlcatalog
+dh_scripts	= \
+		dh_installxmlcatalogs
+man1s		= \
+		$(addsuffix .$(man1_ext),$(dh_scripts))
+
+## ----------------------------------------------------------------------
+## Targets
+all:		$(man1s)
+
+%.$(man1_ext):	%
+
+		$(POD2MAN) --section $(man1_ext) --center Debhelper ${<} ${@}
+
+install:
+
+		set -e; \
+		$(INSTALL_DIR) $(autoscripts_dir); \
+		for f in $(autoscripts); \
+		do \
+			$(INSTALL_FILE) $${f} $(autoscripts_dir); \
+		done
+
+		set -e; \
+		$(INSTALL_DIR) $(bin_dir); \
+		for f in $(dh_scripts); \
+		do \
+			$(INSTALL_BIN) $${f} $(bin_dir); \
+		done
+
+		set -e; \
+		$(INSTALL_DIR) $(man1_dir); \
+		for f in $(man1s); \
+		do \
+			$(INSTALL_FILE) $${f} $(man1_dir); \
+		done
+
+.PHONY:		\
+		all \
+		install
+
+## ----------------------------------------------------------------------
diff --git a/debhelper/dh_installxmlcatalogs b/debhelper/dh_installxmlcatalogs
new file mode 100755
index 0000000..ca28d97
--- /dev/null
+++ b/debhelper/dh_installxmlcatalogs
@@ -0,0 +1,295 @@
+#!/usr/bin/perl -w
+## ----------------------------------------------------------------------
+## Debian dh_installxmlcatalogs
+## ----------------------------------------------------------------------
+## Copyright (c) 2004 Ardo van Rangelrooij, Adam Di Carlo
+##
+## This is free software; see the GNU General Public Licence version 2
+## or later for copying conditions.  There is NO warranty.
+## ----------------------------------------------------------------------
+
+=head1 NAME
+
+dh_installxmlcatalogs - install and register XML catalog files
+
+=head1 SYNOPSIS
+
+B<dh_installxmlcatalogs> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+B<dh_installxmlcatalogs> is a debhelper program that installs and
+registers XML catalog files.  It complies with the Debian XML/SGML
+policy.
+
+The file F<debian/I<package>.xmlcatalogs> lists the local XML catalog
+files to be installed per package as well as the XML entities in those
+local XML catalog files that are to be registered in the XML catalog
+system.
+
+The local XML catalog file entries in that file should be of the form
+C<local;source;dest>, where the verbatim C<local> indicates this is an
+entry for a local XML catalog file, C<source> indicates where the
+local XML catalog resides in the source tree, and C<dest> indicates
+the destination location for the local XML catalog under the package
+build area.  C<dest> should start with F</usr/share/xml/>.
+
+The entries for the XML entities to be registered in the package XML
+catalog file should be of the form C<package;type;id;catalog>, where
+the verbatim C<package> indicates this is an entry for an XML entity
+to be registered in the package XML catalog file, C<type> indicates
+the XML entity type (public, system, uri), C<id> indicates the XML
+entity id, and C<catalog> indicates the local XML catalog file.
+
+The entries for the XML entities to be registered in the root XML
+catalog file should be of the form C<root;type;id>, where the verbatim
+C<root> indicates this is an entry for an XML entity to be registered
+in the root XML catalog file, C<type> indicates the XML entity type
+(public, system, uri), and C<id> indicates the XML entity id.
+
+If an entry for is to be registered identically in the root catalog
+and the package catalog file, you can use the form
+C<root-and-package;type;id;catalog>, where the verbatim
+C<root-and-package> indicates this is an entry for an XML entity to be
+registered in both the root and package XML catalog files, C<type>
+indicates the XML entity type (public, system, uri), C<id> indicates
+the XML entity id, and C<catalog> indicates the local XML catalog
+file.
+
+XML entity types are described in L<update-xmlcatalog(8)>.  Using the
+C<root> or C<package> commands, a type of C<public> will general
+C<delegatePublic> statements in the applicable catalog file. Generally
+you will want to use the types C<public> for any formal public
+identifiers, and C<system> for any files on the local filesystem or
+URLs.  C<uri> is only used for non-local files which are not part of
+the external document subset, e.g., they are not used for entities or
+DTDs.
+
+B<dh_installxmlcatalogs> automatically adds maintainer script snippets
+for the registration and unregistration of the listed XML entities in
+the XML catalog system (unless B<-n> is used).	A dependency on the
+B<xml-core> package will be added to C<${misc:Depends}>, so be sure to
+use that variable in the file F<debian/control>.  See
+L<dh_installdeb(1)> for an explantion of Debhelper maintainer script
+snippets.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify F<postinst>/F<postrm>/F<prerm> scripts.
+
+=back
+
+=head1 NOTES
+
+Note that this command is not idempotent. "dh_clean -k" should be
+called between invocations of this command. Otherwise, it may cause
+multiple instances of the same text to be added to maintainer scripts.
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=over 0
+
+=item
+F</usr/share/doc/xml-core/>
+
+=back
+
+=head1 AUTHOR
+
+=over 0
+
+=item
+Ardo van Rangelrooij <ardo at debian.org>
+
+=item
+Adam Di Carlo <aph at debian.org>
+
+=back
+
+=cut
+
+## ----------------------------------------------------------------------
+use strict;
+
+## ----------------------------------------------------------------------
+use Debian::Debhelper::Dh_Lib;
+
+## ----------------------------------------------------------------------
+my $xmlcorever	= "0.05";
+
+## ----------------------------------------------------------------------
+my $debug_update_xmlcatalog = 0;
+
+## ----------------------------------------------------------------------
+init();
+
+## ----------------------------------------------------------------------
+sub add_xmlcat_cmd ($$$;$) {
+    my ($pkg, $type, $id, $local) = @_;
+    my $cmd = 'update-xmlcatalog';
+    $cmd .= ' --add';
+    $cmd .= " --type $type";
+    $cmd .= " --id \\\"$id\\\"";
+    $cmd .= " --package $pkg";
+    if ( $local ) {
+	$cmd .= " --local $local";
+    } else {
+	$cmd .= " --root";
+    }
+    $debug_update_xmlcatalog and $cmd .= ' --verbose';
+    return $cmd;
+}
+
+## ----------------------------------------------------------------------
+sub del_xmlcat_cmd ($$$;$) {
+    my ($pkg, $type, $id, $root) = @_;
+    my $cmd = 'update-xmlcatalog';
+    $cmd .= ' --del';
+    $cmd .= " --type $type";
+    $cmd .= " --id \\\"$id\\\"";
+    if ( $root ) {
+	$cmd .= " --root";
+    } else {
+        $cmd .= " --package $pkg";
+    }
+    $debug_update_xmlcatalog and $cmd .= ' --verbose';
+    $cmd .= ' || true';
+    return $cmd;
+}
+
+## ----------------------------------------------------------------------
+foreach my $package (@{$dh{DOPACKAGES}}) {
+
+	if ($#ARGV >= 0) {
+		error("extra command-line arguments");
+	}
+
+	my $tmpdir = tmpdir($package);
+
+	my $xmlcatlistfile = pkgfile( $package, "xmlcatalogs" );
+
+	if ( $xmlcatlistfile ) {
+
+		my @xml_data = ();
+
+		open ( DH_FARRAY_IN, $xmlcatlistfile )
+			|| error( "cannot read $xmlcatlistfile: $1" );
+		while ( <DH_FARRAY_IN> ) {
+			chomp;
+			s/#.*//;
+			s/^\s+//;
+			s/\s+$//;
+			next unless length;
+			my @line = split( /;/ );
+			push( @xml_data, [@line] );
+		}
+		close( DH_FARRAY_IN );
+
+		my $packagecat	= "/etc/xml/$package.xml";
+		my $ADD_PACKAGE = '';
+		my $ADD_ROOT	= '';
+		my $DEL_PACKAGE = '';
+		my $DEL_ROOT	= '';
+
+		foreach my $line ( @xml_data ) {
+
+			if ( $line->[0] eq 'local' ) {
+
+				my $source = $line->[1];
+				my $dest = $line->[2];
+
+				my $fulldest = "$tmpdir/$dest"; 
+				$fulldest =~ s|//|/|g; # beautification
+	
+				if ( ! -d dirname( $fulldest ) ) {
+					doit( "install", "-d", "-m755",
+					$tmpdir . "/" . dirname( $dest ) );
+				}
+
+				doit( "install", "-p", "-m644", $source, $fulldest );
+
+			} elsif ( $line->[0] eq 'package' ) {
+				if ( ! $dh{ NOSCRIPTS } ) {
+
+					my $type  = $line->[1];
+					my $id	  = $line->[2];
+					my $local = $line->[3];
+
+					if ( ! $local ) {
+						die("error: package command with ID '$id' incorrect, must specify local catalog\n");
+					} elsif ( ! -f "$tmpdir/$local" ) {
+						die("error: package command with ID '$id' uses non-existent catalog '$local'\n");
+					}
+					
+					$ADD_PACKAGE .= "\t" . add_xmlcat_cmd($package, $type, $id, $local) . "\\n";
+					$DEL_PACKAGE .= "\t" . del_xmlcat_cmd($package, $type, $id) . "\\n";
+
+				}
+			} elsif ( $line->[0] eq 'root' ) {
+				if ( ! $dh{ NOSCRIPTS } ) {
+
+					my $type = $line->[1];
+					my $id	 = $line->[2];
+					$ADD_ROOT .= "\t" . add_xmlcat_cmd($package, $type, $id) . "\\n";
+					$DEL_ROOT .= "\t" . del_xmlcat_cmd($package, $type, $id, 1) . "\\n";
+
+				}
+			} elsif ( $line->[0] eq 'root-and-package' ) {
+				if ( ! $dh{ NOSCRIPTS } ) {
+
+					my $type = $line->[1];
+					my $id	 = $line->[2];
+					my $local = $line->[3];
+
+					if ( ! $local ) {
+						die("error: root-and-package command with ID '$id' incorrect, must specify local catalog\n");
+					} elsif ( ! -f "$tmpdir/$local" ) {
+						die("error: root-and-package command with ID '$id' uses non-existent catalog '$local'\n");
+					}
+
+					$ADD_PACKAGE .= "\t" . add_xmlcat_cmd($package, $type, $id, $local) . "\\n";
+					$DEL_PACKAGE .= "\t" . del_xmlcat_cmd($package, $type, $id) . "\\n";
+					$ADD_ROOT    .= "\t" . add_xmlcat_cmd($package, $type, $id) . "\\n";
+					$DEL_ROOT    .= "\t" . del_xmlcat_cmd($package, $type, $id, 1) . "\\n";
+
+				}
+			} else {
+				die("cannot understand command '" . $line->[0] . 
+				    "' in file $xmlcatlistfile\n");
+			}
+		}
+
+		# sanity checking
+		if ( $ADD_PACKAGE and not $ADD_ROOT ) {
+			warn("warning: elements added to package XML catalog, but not entry for root catalog\n");
+		}
+
+		if ( not $ADD_PACKAGE and not $ADD_ROOT ) {
+			warning("warning: no catalogs registered\n");
+		} else {
+
+			$ADD_PACKAGE or $ADD_PACKAGE = "\t:";
+			$ADD_ROOT    or $ADD_ROOT    = "\t:";
+			$DEL_PACKAGE or $DEL_PACKAGE = "\t:";
+			$DEL_ROOT    or $DEL_ROOT    = "\t:";
+			autoscript( $package, "postinst", "postinst-xmlcatalog",
+				    "s%#ADD_PACKAGE#%$ADD_PACKAGE%g; s%#ADD_ROOT#%$ADD_ROOT%g;" );
+			autoscript( $package, "prerm", "prerm-xmlcatalog",
+				    "s%#DEL_PACKAGE#%$DEL_PACKAGE%g; s%#DEL_ROOT#%$DEL_ROOT%g;" );
+			autoscript( $package, "postrm", "postrm-xmlcatalog",
+				    "s%#PACKAGECAT#%$packagecat%g;" );
+
+			addsubstvar( $package,
+				     "misc:Depends", "xml-core", ">= $xmlcorever" );
+
+		}
+	}
+}
+
+## ----------------------------------------------------------------------
diff --git a/debhelper/postinst-xmlcatalog b/debhelper/postinst-xmlcatalog
new file mode 100644
index 0000000..22fc227
--- /dev/null
+++ b/debhelper/postinst-xmlcatalog
@@ -0,0 +1,4 @@
+if [ "$1" = "configure" ]; then
+#ADD_PACKAGE#
+#ADD_ROOT#
+fi
diff --git a/debhelper/postrm-xmlcatalog b/debhelper/postrm-xmlcatalog
new file mode 100644
index 0000000..0bf02f7
--- /dev/null
+++ b/debhelper/postrm-xmlcatalog
@@ -0,0 +1,3 @@
+if [ "$1" = "purge" ]; then
+	rm -f #PACKAGECAT# #PACKAGECAT#.old
+fi
diff --git a/debhelper/prerm-xmlcatalog b/debhelper/prerm-xmlcatalog
new file mode 100644
index 0000000..704db94
--- /dev/null
+++ b/debhelper/prerm-xmlcatalog
@@ -0,0 +1,4 @@
+if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
+#DEL_ROOT#
+#DEL_PACKAGE#
+fi
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..24c4e9d
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,47 @@
+xml-core for Debian
+-------------------
+
+De-Facto Standard Tool for Debian XML Catalog System Maintenance
+----------------------------------------------------------------
+update-xmlcatalog(8) in the xml-core package is the de-facto standard
+tool to be used to maintain XML catalog files on a Debian system,
+just as update-catalog(8) in the sgml-base package is the standard
+tool to be used to maintain SGML catalog files on a Debian system.  A
+Debian XML/SGML Policy document to this effect is currently under
+development.
+
+Incompatibility of update-xmlcatalog(8) and xmlcatalog(1)
+---------------------------------------------------------
+update-xmlcatalog(8) in the xml-core package and xmlcatalog(1) in the
+libxml2-utils package are _incompatible_.  The former has an internal
+database of all the entries in all the XML catalog files it maintains
+and regenerates the indicated XML catalog file completely from scratch
+upon an update.  The latter updates the indicated XML catalog file
+directly.  This means that any change made to an XML catalog file
+using xmlcatalog(1) is overwritten the next time that XML catalog file
+is updated using update-xmlcatalog(8).
+
+Debhelper Support
+-----------------
+This package contains the debhelper script 'dh_installxmlcatalogs'
+to support installing local XML catalog files and registering XML
+entities in the XML catalog system.  It complies with the current
+draft Debian XML/SGML policy.  For more information see the manual
+page.
+
+Debian XML & SGML Mailing List
+------------------------------
+The Debian mailing list 'debian-sgml at lists.debian.org' is used to
+discuss issues related to XML and SGML on Debian systems, with an
+emphasis on proper integration of tools, packaging standards and the
+writing of documentation for XML and SGML users.
+
+Debian XML & SGML Group Project
+-------------------------------
+The 'Debian XML/SGML Group' project (http://debian-xml-sgml.alioth.debian.org/)
+has been setup on Debian Alioth (http://alioth.debian.org/) to develop
+and maintain XML and SGML packages for the Debian Project in a
+collaborative effort.
+
+--
+Ardo van Rangelrooij (ardo at debian.org)
diff --git a/debian/TODO b/debian/TODO
new file mode 100644
index 0000000..02b5ffa
--- /dev/null
+++ b/debian/TODO
@@ -0,0 +1,30 @@
+------------------------------------------------------------------------------
+To do list for xml-core
+------------------------------------------------------------------------------
+
+BUGS:
+------------------------------------------------------------------------------
+Number Description
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+WISHLIST:
+------------------------------------------------------------------------------
+Number Description
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+VARIOUS:
+------------------------------------------------------------------------------
+Description
+------------------------------------------------------------------------------
+* public CVS repository (Alioth?)
+* support regenerate CLI to regenerate the root XML catalog files and
+  package XML catalog files 
+* install and register all versions of the XML catalog schema
+  (including symlinks under /usr/share/sgml and registration in the
+  SGML catalog system) (don't forget the copyright)
+* put as much as possible code in a module (e.g. Debian::XML::Catalog)
+* add John Cowan's script:
+  http://lists.oasis-open.org/archives/entity-resolution/200106/msg00021.html
+------------------------------------------------------------------------------
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..ab513fc
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,135 @@
+xml-core (0.09) unstable; urgency=low
+
+  * schemas/catalog: added official FPI for XML catalog DTD
+    (closes: Bug#231816)
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sun, 25 Apr 2004 11:09:19 -0500
+
+xml-core (0.08) unstable; urgency=low
+
+  * Moved 'dh_installxmlcatalogs' and 'autoscripts' into 'debhelper' directory
+    - debian/rules: updated accordingly
+  * Moved schemas and associated catalogs into 'schemas' directory
+    - debian/xml-core.sgmlcatalogs; updated accordingly
+    - debian/xml-core.xmlcatalogs; updated accordingly
+  * Moved 'update-xmlcatalog*' and XML catalog templates to 'tools' directory
+  * Added Makefiles to all new subdirectories and put all the common parts
+    in 'MAKE/include'
+  * tools/update-xmlcatalog: absorbed manual page in POD format
+  * debian/control: changed maintainer's email address to the new Debian
+    XML/SGML Group's packages mailing list
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Wed, 21 Apr 2004 11:09:24 -0500
+
+xml-core (0.07) unstable; urgency=low
+
+  * update-xmlcatalog: changed to be idempotent for XML entity registration
+    (closes: Bug#232502)
+  * debian/README.Debian: fixed various small typos and such
+    (closes: Bug#230845)
+  * debian/control: changed 'Maintainer' to 'Debian XML/SGML Group
+    <debian-xml-sgml-devel at lists.alioth.debian.org>' and added current
+    maintainer as 'Uploaders'
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Mon, 23 Feb 2004 22:31:10 -0600
+
+xml-core (0.06) unstable; urgency=low
+
+  * update-xmlcatalog.8: updated to match update-xmlcatalog
+  * Added XML infrastructure directories
+    (closes: Bug#228656)
+    - Makefile: created the XML infrastructure directories under
+      /usr/share/xml and under /usr/share/local/xml
+    - debian/rules: updated to use 'dh_usrlocal'
+    - debian/xml-core.{post,pre}*: removed obsolete code
+  * Added dh_installxmlcatalogs and associated autoscripts
+    - Makefile: updated to generate dh_installxmlcatalogs(1)
+    - debian/control: added build-dependency on 'perl'
+    - Makefile: updated to install dh_installxmlcatalogs and associated files
+    - debian/control: added 'Suggests' for 'debhelper (>= 4.1)'
+    - debian/README.Debian: updated to mention debhelper support
+  * Converted to use dh_installxmlcatalogs
+    - debian/xml-core.xmlcatalogs: added
+    - debian/rules: updated to use dh_installxmlcatalogs
+    - debian/xml-core.{post,pre}*: removed obsolete code
+  * Added registration of XML catalog schema in SGML catalog system
+    (closes: Bug#229259)
+    - debian/xml-core.links: added
+    - debian/rules: updated to use dh_link
+    - catalog: added
+    - debian/xml-core.sgmlcatalogs: added
+    - debian/rules: updated to use dh_installcatalogs
+  * Provided proper examples
+    (closes: Bug#227130)
+    - examples/foo.xmlcatalogs: added
+    - examples/foo.p*: updated
+  * debian/control: rewrote short and long description
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sun,  1 Feb 2004 13:06:52 -0600
+
+xml-core (0.05) unstable; urgency=low
+
+  * update-xmlcatalog: changed catalog path generation for root catalog to
+    add "file://" protocol just as is done for package catalogs
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sat, 10 Jan 2004 16:45:24 -0600
+
+xml-core (0.04) unstable; urgency=low
+
+  * catalog.xml: reverted back to original version
+  * catalog.header: changed prolog to support bootstrapping XML catalog system
+    (now really closing bug #223041)
+  * debian/control: upgraded to Debian Policy 3.6.1 (no changes)
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Thu, 25 Dec 2003 10:10:26 -0600
+
+xml-core (0.03) unstable; urgency=low
+
+  * catalog.xml: changed prolog to support bootstrapping the XML catalog system
+    (closes: Bug#223041)
+  * Added debian/README.Debian
+  * update-xmlcatalog.8: added a link to the README.Debian
+  * update-xmlcatalog.8: added a note about update-xmlcatalog(8) being the
+    de-facto standard tool to maintain the XML catalog system on a Debian
+    system
+  * update-xmlcatalog.8: added a note about the impopatibility between
+    update-xmlcatalog(8) and xmlcatalog(1) (from the libxml2-utils package)
+    (closes: Bug#207470)
+  * update-xmlcatalog.8: various cosmetic updates
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sat,  6 Dec 2003 14:03:38 -0600
+
+xml-core (0.02) unstable; urgency=low
+
+  * update-xmlcatalog: improved legacy /etc/xml/catalog handling
+    (closes: Bug#207070)
+    - preinst moves legacy '/etc/xml/catalog' to '/etc/xml/catalog.legacy'
+    - postrm moves legacy '/etc/xml/catalog.legacy' back to '/etc/xml/catalog'
+    - update-xmlcatalog: fixed erroneous catalog data file check
+  * debian/prerm: improved to clean own catalog files more robustly
+    (closes: Bug#207171)
+  * update-xmlcatalog: improved command-line option checking
+  * update-xmlcatalog: added proper support for local XML catalog files
+  * debian/control: removed suggestion of not yet existing 'xml-core-doc'
+  * debian/control: improved long description
+  * README: various small cosmetic updates
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Mon, 25 Aug 2003 19:55:00 -0500
+
+xml-core (0.01) unstable; urgency=low
+
+  * Initial official release
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sat, 16 Aug 2003 12:50:43 -0500
+
+xml-core (0.0.02) experimental; urgency=low
+
+  * First public, highly experimental prelimenary release
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sun, 10 Aug 2003 12:16:54 -0500
+
+xml-core (0.0.01) experimental; urgency=low
+
+  * Initial private prelimenary release
+
+ -- Ardo van Rangelrooij <ardo at debian.org>  Sat,  5 Apr 2003 16:26:27 -0600
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..005657a
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,33 @@
+Source: xml-core
+Section: text
+Priority: optional
+Maintainer: Debian XML/SGML Group <debian-xml-sgml-pkgs at lists.alioth.debian.org>
+Uploaders: Ardo van Rangelrooij <ardo at debian.org>
+Standards-Version: 3.6.1
+Build-Depends-Indep: perl, debhelper (>= 4.1.75)
+
+Package: xml-core
+Section: text
+Priority: optional
+Architecture: all
+Depends: ${perl:Depends}, sgml-base (>= 1.17)
+Suggests: debhelper (>= 4.1.75)
+Description: XML infrastructure and XML catalog file support
+ This package creates the XML infrastructure directories and provides
+ XML catalog file support in compliance with the current Debian XML
+ Policy draft:
+ .
+   * infrastructure directories:
+      - /etc/xml
+      - /usr/share/xml/{declaration,entities,misc,schema}
+      - /usr/share/local/xml/{declaration,entities,misc,schema}
+ .
+   * XML catalog schema: OASIS XML Catalog Committee Specification 1.0
+ .
+   * update-xmlcatalog(8): tool for maintaining the root XML catalog
+     file and the package XML catalog files in the '/etc/xml' directory
+     as well as local XML catalog files.
+ .
+   * dh_installxmlcatalogs(1): debhelper tool for installing local XML
+     catalog files and registering XML entities in package XML catalog
+     files and the root XML catalog file (requires debhelper package)
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..bf14d00
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,26 @@
+This is the Debian package of xml-core.  It is assembled and maintained
+by Ardo van Rangelrooij <ardo at debian.org>.
+
+Authors: Ardo van Rangelrooij <ardo at debian.org>
+
+Copyright:
+
+Copyright (c) 2003 Ardo van Rangelrooij
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License with
+the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL;
+if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+Suite 330, Boston, MA  02111-1307  USA
+
+On a Debian system a copy of the GNU General Public Licence can be
+found in the file '/usr/share/common-licenses/GPL'.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ec73592
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,62 @@
+#!/usr/bin/make -f
+## ----------------------------------------------------------------------
+## debian/rules : package script for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+## uncomment this to turn on verbose mode
+#export DH_VERBOSE=1
+
+## ----------------------------------------------------------------------
+TMP_DIR		= debian/tmp
+
+## ----------------------------------------------------------------------
+## targets
+
+clean:
+		dh_testdir
+		dh_testroot
+		dh_clean
+		rm -f build-stamp install-stamp
+
+build:		build-stamp
+build-stamp:
+		dh_testdir
+		$(MAKE)
+		touch build-stamp
+
+install:	install-stamp
+install-stamp:	build
+		dh_testdir
+		dh_testroot
+		dh_clean -k
+		dh_installdirs
+		$(MAKE) install prefix=$(CURDIR)/$(TMP_DIR)/usr
+		touch install-stamp
+
+binary-indep:	build install
+		dh_testdir
+		dh_testroot
+		dh_install --sourcedir=$(TMP_DIR)
+		dh_installdocs
+		dh_installexamples
+		dh_installchangelogs
+		DH_AUTOSCRIPTDIR=debhelper debhelper/dh_installxmlcatalogs
+		dh_installcatalogs
+		dh_link
+		dh_usrlocal
+		dh_compress
+		dh_fixperms
+		dh_installdeb
+		dh_perl
+		dh_gencontrol
+		dh_md5sums
+		dh_builddeb
+
+binary-arch:
+
+binary:		binary-indep binary-arch
+
+.PHONY:		clean build install binary-indep binary-arch binary
+
+## ----------------------------------------------------------------------
diff --git a/debian/xml-core.examples b/debian/xml-core.examples
new file mode 100644
index 0000000..e39721e
--- /dev/null
+++ b/debian/xml-core.examples
@@ -0,0 +1 @@
+examples/*
diff --git a/debian/xml-core.install b/debian/xml-core.install
new file mode 100644
index 0000000..73752c9
--- /dev/null
+++ b/debian/xml-core.install
@@ -0,0 +1 @@
+usr
diff --git a/debian/xml-core.links b/debian/xml-core.links
new file mode 100644
index 0000000..69f2828
--- /dev/null
+++ b/debian/xml-core.links
@@ -0,0 +1 @@
+usr/share/xml/schema/xml-core/catalog.dtd	usr/share/sgml/dtd/xml-core/catalog.dtd
diff --git a/debian/xml-core.postinst b/debian/xml-core.postinst
new file mode 100644
index 0000000..27c4c16
--- /dev/null
+++ b/debian/xml-core.postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/postinst : postinstallation script for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+set -e
+
+## ---------------------------------------------------------------------- 
+## automatically generated debhelper commands
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/debian/xml-core.postrm b/debian/xml-core.postrm
new file mode 100644
index 0000000..61c6c90
--- /dev/null
+++ b/debian/xml-core.postrm
@@ -0,0 +1,48 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/postrm : postremoval script for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+set -e
+
+## ---------------------------------------------------------------------- 
+## automatically generated debhelper commands
+#DEBHELPER#
+
+## ----------------------------------------------------------------------
+if [ "$1" = "purge" ]
+then
+
+    ## ------------------------------------------------------------------
+    ## remove /var/lib/xml-core
+    cd /var/lib
+    rmdir --ignore-fail-on-non-empty xml-core
+    cd - >/dev/null
+
+    ## ------------------------------------------------------------------
+    ## remove root XML catalog
+    rm -f /etc/xml/catalog
+    rm -f /etc/xml/catalog.old
+
+    ## ------------------------------------------------------------------
+    ## remove /etc/xml
+    cd /etc
+    rmdir --ignore-fail-on-non-empty xml
+    cd - >/dev/null
+
+    ## ------------------------------------------------------------------
+    ## restore legacy /etc/xml/catalog
+    if [ -f /etc/xml/catalog.legacy ]
+    then
+        cd /etc/xml
+	mv catalog.legacy catalog
+        cd - >/dev/null
+    fi
+
+fi
+
+## ---------------------------------------------------------------------- 
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/debian/xml-core.preinst b/debian/xml-core.preinst
new file mode 100644
index 0000000..28a2c8d
--- /dev/null
+++ b/debian/xml-core.preinst
@@ -0,0 +1,50 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/preinst : preinstallation script for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+set -e
+
+## ----------------------------------------------------------------------
+if [ "$1" = "install" -o "$1" = "upgrade" ]
+then
+
+    ## ------------------------------------------------------------------
+    ## create /var/lib/xml-core
+    if [ ! -d /var/lib/xml-core ]
+    then
+	mkdir /var/lib/xml-core 2>/dev/null
+    fi
+
+    ## ------------------------------------------------------------------
+    ## create /etc/xml
+    if [ ! -d /etc/xml ]
+    then
+	mkdir /etc/xml 2>/dev/null
+    fi
+
+fi
+
+## ----------------------------------------------------------------------
+if [ "$1" = "install" ]
+then
+
+    ## ------------------------------------------------------------------
+    ## preserve legacy /etc/xml/catalog
+    if [ -f /etc/xml/catalog ]
+    then
+        cd /etc/xml
+	mv catalog catalog.legacy
+        cd - >/dev/null
+    fi
+
+fi
+
+## ---------------------------------------------------------------------- 
+## automatically generated debhelper commands
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/debian/xml-core.prerm b/debian/xml-core.prerm
new file mode 100644
index 0000000..62fd97b
--- /dev/null
+++ b/debian/xml-core.prerm
@@ -0,0 +1,15 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/prerm : preremoval script for xml-core
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+set -e
+
+## ---------------------------------------------------------------------- 
+## automatically generated debhelper commands
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/debian/xml-core.sgmlcatalogs b/debian/xml-core.sgmlcatalogs
new file mode 100644
index 0000000..1b095e0
--- /dev/null
+++ b/debian/xml-core.sgmlcatalogs
@@ -0,0 +1 @@
+schemas/catalog /usr/share/sgml/dtd/xml-core/catalog
diff --git a/debian/xml-core.xmlcatalogs b/debian/xml-core.xmlcatalogs
new file mode 100644
index 0000000..e62af7f
--- /dev/null
+++ b/debian/xml-core.xmlcatalogs
@@ -0,0 +1,3 @@
+local;schemas/catalog.xml;/usr/share/xml/schema/xml-core/catalog.xml
+root-and-package;system;http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd;/usr/share/xml/schema/xml-core/catalog.xml
+root-and-package;public;-//OASIS//DTD XML Catalogs V1.0//EN;/usr/share/xml/schema/xml-core/catalog.xml
diff --git a/examples/foo.postinst b/examples/foo.postinst
new file mode 100755
index 0000000..0291067
--- /dev/null
+++ b/examples/foo.postinst
@@ -0,0 +1,39 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/postinst: post-installation script for foo
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+## Abort if any command returns an error value
+set -e
+
+## --------------------------------------------------------------
+## Install XML catalog entries
+if [ "$1" = "configure" ]
+then
+
+    update-xmlcatalog --verbose --add --package foo --type public \
+        --id "-//FOO//DTD FOO//EN" \
+        --local /usr/share/xml/schema/foo/catalog.xml
+
+    update-xmlcatalog --verbose --add --package foo --type system \
+        --id "http://www.foo.org/foo/foo.dtd" \
+        --local /usr/share/xml/schema/foo/catalog.xml
+
+    update-xmlcatalog --verbose --add --root --type public \
+        --id "-//FOO//DTD FOO//EN" \
+        --package foo
+
+    update-xmlcatalog --verbose --add --root --type system \
+        --id "http://www.foo.org/foo/foo.dtd" \
+        --package foo
+
+fi
+
+## ----------------------------------------------------------------------
+## Automatically added sections
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/examples/foo.postrm b/examples/foo.postrm
new file mode 100755
index 0000000..848a8d7
--- /dev/null
+++ b/examples/foo.postrm
@@ -0,0 +1,26 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/postrm: postremoval script for foo
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+## Abort if any command returns an error value
+set -e
+
+## --------------------------------------------------------------
+## Remove package XML catalog file
+if [ "$1" = "purge" ]
+then
+
+    rm -f /etc/xml/foo.xml
+    rm -f /etc/xml/foo.xml.old
+
+fi
+
+## ----------------------------------------------------------------------
+## Automatically added sections
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/examples/foo.prerm b/examples/foo.prerm
new file mode 100755
index 0000000..c533433
--- /dev/null
+++ b/examples/foo.prerm
@@ -0,0 +1,35 @@
+#!/bin/sh
+## ----------------------------------------------------------------------
+## debian/prerm: preremoval script for foo
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+## Abort if any command returns an error value
+set -e
+
+## --------------------------------------------------------------
+## Remove XML catalog entries
+if [ "$1" = "remove" -o "$1" = "upgrade" ]
+then
+
+    update-xmlcatalog --verbose --add --root --type public \
+        --id "-//FOO//DTD FOO//EN"
+
+    update-xmlcatalog --verbose --add --root --type system \
+        --id "http://www.foo.org/foo/foo.dtd"
+
+    update-xmlcatalog --verbose --add --package foo --type public \
+        --id "-//FOO//DTD FOO//EN"
+
+    update-xmlcatalog --verbose --add --package foo --type system \
+        --id "http://www.foo.org/foo/foo.dtd"
+
+fi
+
+## ----------------------------------------------------------------------
+## Automatically added sections
+#DEBHELPER#
+
+exit 0
+
+## ----------------------------------------------------------------------
diff --git a/examples/foo.xmlcatalogs b/examples/foo.xmlcatalogs
new file mode 100644
index 0000000..3975512
--- /dev/null
+++ b/examples/foo.xmlcatalogs
@@ -0,0 +1,3 @@
+local;catalog.xml;/usr/share/xml/schema/foo/catalog.xml
+root-and-package;public;-//FOO//DTD FOO//EN;/usr/share/xml/schema/foo/catalog.xml
+root-and-package;system;http://www.foo.org/foo/foo.dtd;/usr/share/xml/schema/foo/catalog.xml
diff --git a/schemas/Makefile b/schemas/Makefile
new file mode 100644
index 0000000..6387762
--- /dev/null
+++ b/schemas/Makefile
@@ -0,0 +1,37 @@
+## ----------------------------------------------------------------------
+## Makefile : makefile for xml-core/schemas
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+include ../MAKE/include
+
+## ----------------------------------------------------------------------
+## Schemas directory definitions
+pkg_name	= xml-core
+pkg_schema_dir	= $(schema_dir)/$(pkg_name)
+
+## ----------------------------------------------------------------------
+## Schemas file definitions
+schemas		= \
+		catalog.dtd \
+		tr9401.dtd
+
+## ----------------------------------------------------------------------
+## targets
+
+all:
+
+install:
+
+		set -e; \
+		$(INSTALL_DIR) $(pkg_schema_dir); \
+		for f in $(schemas); \
+		do \
+			$(INSTALL_FILE) $$f $(pkg_schema_dir); \
+		done
+
+.PHONY:		\
+		all \
+		install
+
+## ----------------------------------------------------------------------
diff --git a/schemas/catalog b/schemas/catalog
new file mode 100644
index 0000000..6b87d5b
--- /dev/null
+++ b/schemas/catalog
@@ -0,0 +1,17 @@
+-- ...................................................................... --
+-- TR 9401 catalog registration for the XML Catalog DTD                   --
+-- ...................................................................... --
+
+-- ...................................................................... --
+-- public identifiers override system identifiers, if both are supplied   --
+OVERRIDE YES
+
+-- ...................................................................... --
+PUBLIC  "-//OASIS//DTD XML Catalogs V1.0//EN" catalog.dtd
+DTDDECL "-//OASIS//DTD XML Catalogs V1.0//EN" /usr/share/sgml/declaration/xml.dcl
+
+-- ...................................................................... --
+PUBLIC  "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" catalog.dtd
+DTDDECL "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" /usr/share/sgml/declaration/xml.dcl
+
+-- ...................................................................... --
diff --git a/schemas/catalog.dtd b/schemas/catalog.dtd
new file mode 100644
index 0000000..e68068b
--- /dev/null
+++ b/schemas/catalog.dtd
@@ -0,0 +1,147 @@
+<!ENTITY % pubIdChars "CDATA">
+<!ENTITY % publicIdentifier "%pubIdChars;">
+<!ENTITY % partialPublicIdentifier "%pubIdChars;">
+<!ENTITY % uriReference "CDATA">
+<!ENTITY % string "CDATA">
+<!ENTITY % systemOrPublic "(system|public)">
+
+<!ENTITY % p "">
+<!ENTITY % s "">
+<!ENTITY % nsdecl "xmlns%s;">
+
+<!ENTITY % catalog "%p;catalog">
+<!ENTITY % public "%p;public">
+<!ENTITY % system "%p;system">
+<!ENTITY % uri "%p;uri">
+<!ENTITY % rewriteSystem "%p;rewriteSystem">
+<!ENTITY % rewriteURI "%p;rewriteURI">
+<!ENTITY % delegatePublic "%p;delegatePublic">
+<!ENTITY % delegateSystem "%p;delegateSystem">
+<!ENTITY % delegateURI "%p;delegateURI">
+<!ENTITY % nextCatalog "%p;nextCatalog">
+<!ENTITY % group "%p;group">
+
+<!ENTITY % local.catalog.mix "">
+<!ENTITY % local.catalog.attribs "">
+
+<!ELEMENT %catalog; (%public;|%system;|%uri;
+                     |%rewriteSystem;|%rewriteURI;
+                     |%delegatePublic;|%delegateSystem;|%delegateURI;
+                     |%nextCatalog;|%group; %local.catalog.mix;)+>
+<!ATTLIST %catalog;
+	%nsdecl;	%uriReference;		#FIXED
+		'urn:oasis:names:tc:entity:xmlns:xml:catalog'
+	prefer		%systemOrPublic;	#IMPLIED
+	xml:base	%uriReference;		#IMPLIED
+	%local.catalog.attribs;
+>
+
+<!ENTITY % local.public.attribs "">
+
+<!ELEMENT %public; EMPTY>
+<!ATTLIST %public;
+	id		ID			#IMPLIED
+	publicId	%publicIdentifier;	#REQUIRED
+	uri		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.public.attribs;
+>
+
+<!ENTITY % local.system.attribs "">
+
+<!ELEMENT %system; EMPTY>
+<!ATTLIST %system;
+	id		ID			#IMPLIED
+	systemId	%string;		#REQUIRED
+	uri		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.system.attribs;
+>
+
+<!ENTITY % local.uri.attribs "">
+
+<!ELEMENT %uri; EMPTY>
+<!ATTLIST %uri;
+	id		ID			#IMPLIED
+	name		%string;		#REQUIRED
+	uri		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.uri.attribs;
+>
+
+<!ENTITY % local.rewriteSystem.attribs "">
+
+<!ELEMENT %rewriteSystem; EMPTY>
+<!ATTLIST %rewriteSystem;
+	id		ID			#IMPLIED
+	systemIdStartString	%string;	#REQUIRED
+	rewritePrefix		%string;		#REQUIRED
+        %local.rewriteSystem.attribs;
+>
+
+<!ENTITY % local.rewriteURI.attribs "">
+
+<!ELEMENT %rewriteURI; EMPTY>
+<!ATTLIST %rewriteURI;
+	id		ID			#IMPLIED
+	uriStartString	%string;		#REQUIRED
+	rewritePrefix	%string;		#REQUIRED
+        %local.rewriteURI.attribs;
+>
+
+<!ENTITY % local.delegatePublic.attribs "">
+
+<!ELEMENT %delegatePublic; EMPTY>
+<!ATTLIST %delegatePublic;
+	id		ID			#IMPLIED
+	publicIdStartString	%partialPublicIdentifier;	#REQUIRED
+	catalog		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.delegatePublic.attribs;
+>
+
+<!ENTITY % local.delegateSystem.attribs "">
+
+<!ELEMENT %delegateSystem; EMPTY>
+<!ATTLIST %delegateSystem;
+	id		ID			#IMPLIED
+	systemIdStartString	%string;	#REQUIRED
+	catalog		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.delegateSystem.attribs;
+>
+
+<!ENTITY % local.delegateURI.attribs "">
+
+<!ELEMENT %delegateURI; EMPTY>
+<!ATTLIST %delegateURI;
+	id		ID			#IMPLIED
+	uriStartString	%string;		#REQUIRED
+	catalog		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.delegateURI.attribs;
+>
+
+<!ENTITY % local.nextCatalog.attribs "">
+
+<!ELEMENT %nextCatalog; EMPTY>
+<!ATTLIST %nextCatalog;
+	id		ID			#IMPLIED
+	catalog		%uriReference;		#REQUIRED
+	xml:base	%uriReference;		#IMPLIED
+        %local.nextCatalog.attribs;
+>
+
+<!ENTITY % local.group.mix "">
+<!ENTITY % local.group.attribs "">
+
+<!ELEMENT %group; (%public;|%system;|%uri;
+                   |%rewriteSystem;|%rewriteURI;
+                   |%delegatePublic;|%delegateSystem;|%delegateURI;
+                   |%nextCatalog; %local.group.mix;)+>
+<!ATTLIST %group;
+	id		ID			#IMPLIED
+	prefer		%systemOrPublic;	#IMPLIED
+	xml:base	%uriReference;		#IMPLIED
+        %local.group.attribs;
+>
diff --git a/schemas/catalog.xml b/schemas/catalog.xml
new file mode 100644
index 0000000..8428f8e
--- /dev/null
+++ b/schemas/catalog.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE catalog SYSTEM "catalog.dtd">
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> 
+
+<public publicId="-//OASIS//DTD XML Catalogs V1.0//EN" uri="catalog.dtd"/>
+  
+<system systemId="http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd" uri="catalog.dtd"/>
+
+<!-- ====== Customization that adds tr9401 support ====== -->
+
+<public publicId="-//Debian//DTD XML Catalogs V1.0-Based Extension V1.0" uri="tr9401.dtd"/>
+
+<system systemId="http://people.debian.org/~mrj/oasis/catalog/xml/tr9401.dtd" uri="tr9401.dtd"/>
+
+</catalog>
diff --git a/schemas/tr9401.dtd b/schemas/tr9401.dtd
new file mode 100644
index 0000000..d65f0bc
--- /dev/null
+++ b/schemas/tr9401.dtd
@@ -0,0 +1,123 @@
+<!-- $Id: tr9401.dtd,v 1.1 2004/02/28 22:04:34 ardo Exp $ -->
+<!-- 
+        This dtd is a customization layer that provides additional elements 
+        to the (Non-Normative) OASIS XML Catalog Standard DTD to support the 
+        full semantics of the OASIS TR9401:97 Catalog Standard.
+
+        Specifically, it adds the following elements to the DTD: 
+                'doctype' 'document' 'dtddecl' 'entity' 
+                'linktype' 'notation' 'sgmldecl'
+
+        As recommended by the XML Catalog Standard, these additional elements 
+        are implemented as extension elements in the namespace:
+            "urn:oasis:names:tc:entity:xmlns:tr9401:catalog"
+        using the "soc:" namespace prefix.
+
+        The (Non-Normative) DTD for the OASIS XML Catalog is available at 
+        http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd
+
+        The OASIS XML Catalog Standard is available at
+    http://www.oasis-open.org/committees/entity/specs/cs-entity-xml-catalogs-1.0.html
+
+Usage:
+
+        This dtd is identified by the following:
+
+PUBLIC "-//GlobalTransCorp//DTD XML Catalogs V1.0-Based Extension V1.0//EN"
+        
+SYSTEM  "http://globaltranscorp.org/oasis/catalog/xml/tr9401.dtd"
+
+ A typical document instance might use the following DOCTYPE statement:
+
+   <!DOCTYPE catalog
+      PUBLIC "-//GlobalTransCorp//DTD XML Catalogs V1.0-Based Extension V1.0//EN"
+        "http://globaltranscorp.org/oasis/catalog/xml/tr9401.dtd">
+
+        Comments or complaints should be sent to Mark Johnson <mrj at debian.org>
+
+-->
+
+<!ENTITY % nspre "soc:">
+<!ENTITY % nspre-s ":soc">
+<!ENTITY % ns-dec "xmlns%nspre-s;">
+
+<!ENTITY % uriReference "CDATA">
+
+<!ENTITY % doctype  "%nspre;doctype">
+<!ENTITY % document "%nspre;document">
+<!ENTITY % dtddecl  "%nspre;dtddecl">
+<!ENTITY % entity   "%nspre;entity">
+<!ENTITY % linktype "%nspre;linktype">
+<!ENTITY % notation "%nspre;notation">
+<!ENTITY % sgmldecl "%nspre;sgmldecl">
+
+
+<!ENTITY % local.catalog.attribs  "%ns-dec; %uriReference; #FIXED
+                'urn:oasis:names:tc:entity:xmlns:tr9401:catalog'"> 
+
+<!ENTITY % local.catalog.mix  "|%doctype;|%document;|%dtddecl;
+                               |%entity;|%linktype;
+                               |%notation;|%sgmldecl;">
+
+<!ENTITY % catalog.dtd PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
+"catalog.dtd">
+     <!-- "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> -->
+ %catalog.dtd; 
+
+
+<!-- Below are the new elements -->
+
+<!ELEMENT %doctype; EMPTY>
+<!ATTLIST %doctype;
+        id              ID                      #IMPLIED
+        name            CDATA                   #REQUIRED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %document; EMPTY>
+<!ATTLIST %document;
+        id              ID                      #IMPLIED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %dtddecl; EMPTY>
+<!ATTLIST %dtddecl;
+        id              ID                      #IMPLIED
+        publicId        %publicIdentifier;      #REQUIRED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %entity; EMPTY>
+<!ATTLIST %entity;
+        id              ID                      #IMPLIED
+        name            CDATA                   #REQUIRED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %linktype; EMPTY>
+<!ATTLIST %linktype;
+        id              ID                      #IMPLIED
+        name            CDATA                   #REQUIRED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %notation; EMPTY>
+<!ATTLIST %notation;
+        id              ID                      #IMPLIED
+        name            CDATA                   #REQUIRED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
+<!ELEMENT %sgmldecl; EMPTY>
+<!ATTLIST %sgmldecl;
+        id              ID                      #IMPLIED
+        uri             %uriReference;          #REQUIRED
+        xml:base        %uriReference;          #IMPLIED
+>
+
diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 0000000..56c2952
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,59 @@
+## ----------------------------------------------------------------------
+## Makefile : makefile for xml-core/tools
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+include ../MAKE/include
+
+## ----------------------------------------------------------------------
+## Tools directory definitions
+pkg_name	= xml-core
+pkg_share_dir	= $(share_dir)/$(pkg_name)
+
+## ----------------------------------------------------------------------
+## Tools file definitions
+templates	= \
+		catalog.header \
+		catalog.footer
+sbins		= \
+		update-xmlcatalog
+man8s		= \
+		$(addsuffix .$(man8_ext),$(sbins))
+
+## ----------------------------------------------------------------------
+## targets
+
+all:		$(man8s)
+
+%.$(man8_ext):	%
+
+		$(POD2MAN) --section $(man8_ext) --center $(pkg_name) ${<} ${@}
+
+install:
+
+		set -e; \
+		$(INSTALL_DIR) $(pkg_share_dir); \
+		for f in $(templates); \
+		do \
+			$(INSTALL_FILE) $${f} $(pkg_share_dir); \
+		done
+
+		set -e; \
+		$(INSTALL_DIR) $(sbin_dir); \
+		for f in $(sbins); \
+		do \
+			$(INSTALL_BIN) $${f} $(sbin_dir); \
+		done
+
+		set -e; \
+		$(INSTALL_DIR) $(man8_dir); \
+		for f in $(man8s); \
+		do \
+			$(INSTALL_FILE) $${f} $(man8_dir); \
+		done
+
+.PHONY:		\
+		all \
+		install
+
+## ----------------------------------------------------------------------
diff --git a/tools/catalog.footer b/tools/catalog.footer
new file mode 100644
index 0000000..80d2c96
--- /dev/null
+++ b/tools/catalog.footer
@@ -0,0 +1 @@
+</catalog>
diff --git a/tools/catalog.header b/tools/catalog.header
new file mode 100644
index 0000000..f36e2f0
--- /dev/null
+++ b/tools/catalog.header
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
+  "file:///usr/share/xml/schema/xml-core/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
diff --git a/tools/lib/Debian/XML/Catalog.pm b/tools/lib/Debian/XML/Catalog.pm
new file mode 100644
index 0000000..9f044fd
--- /dev/null
+++ b/tools/lib/Debian/XML/Catalog.pm
@@ -0,0 +1,7 @@
+## ----------------------------------------------------------------------
+## Debian/XML/Catalog.pm :
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
+
+## ----------------------------------------------------------------------
diff --git a/tools/update-xmlcatalog b/tools/update-xmlcatalog
new file mode 100755
index 0000000..5b68e5f
--- /dev/null
+++ b/tools/update-xmlcatalog
@@ -0,0 +1,639 @@
+#!/usr/bin/perl
+## ----------------------------------------------------------------------
+## Debian update-xmlcatalog
+## ----------------------------------------------------------------------
+## Copyright (c) 2003-2004 Ardo van Rangelrooij
+##
+## This is free software; see the GNU General Public Licence version 2
+## or later for copying conditions.  There is NO warranty.
+## ----------------------------------------------------------------------
+
+=head1 NAME
+
+update-xmlcatalog - maintain XML catalog files
+
+=head1 SYNOPSIS
+
+B<update-xmlcatalog> B<--add> B<--root> S<B<--package> I<package>>
+S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--del> B<--root> S<B<--package> I<package>>
+S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--add> S<B<--package> I<package>> S<B<--local>
+I<local>> S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--del> S<B<--package> I<package>> S<B<--local>
+I<local>> S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--add> S<B<--local> I<local>> S<B<--file>
+I<file>> S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--del> S<B<--local> I<local>> S<B<--file>
+I<file>> S<B<--type> I<type>> S<B<--id> I<id>>
+
+B<update-xmlcatalog> B<--help>
+
+=head1 DESCRIPTION
+
+B<update-xmlcatalog> add entries to and removes entries from the root
+XML catalog file, a package XML catalog file or a local XML catalog
+file.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--add>
+
+Adds the entry to the root XML catalog file, a package XML catalog
+file or a local XML catalog file.  If the XML catalog file does not
+exist yet, it is automatically created.
+
+=item B<--del>
+
+Deletes the entry from the root XML catalog file, the package XML
+catalog file or the local XML catalog file.  A resulting empty XML
+catalog is not automatically deleted from the filesystem.
+
+=item B<--file>
+
+Indicates a local filename.
+
+=item B<--id>
+
+Indicates the XML catalog file entry identifier.
+
+=item B<--local>
+
+Indicates a local XML catalog file.
+
+=item B<--package>
+
+Indicates a package XML catalog file.
+
+=item B<--root>
+
+Indicates the root XML catalog file.
+
+=item B<--type>
+
+Indicates the XML catalog file entry type (public, system, uri).
+
+=item B<--help>
+
+Displays the usage information.
+
+=back
+
+=head1 NOTES
+
+B<update-xmlcatalog> is the de-facto standard tool to be used to
+maintain XML catalog files on a Debian system, similar to that
+L<update-catalog(8)> is the standard tool to be used to main SGML
+catalog files on a Debian system.  A Debian XML Policy document to
+this effect is currently under development.
+
+B<update-xmlcatalog> and L<xmlcatalog(1)> are incompatible.  The
+former has an internal database of all the entries in all the XML
+catalog files it maintains and regenerates the indicated XML catalog
+file completely from scratch upon an update.  The latter updates the
+indicated XML catalog file directly.  This means that any change made
+to an XML catalog file using L<xmlcatalog(1)> is overwritten the next
+time that XML catalog file is updated using B<update-xmlcatalog>.
+
+=head1 SEE ALSO
+
+F</usr/share/doc/xml-core/README.Debian>
+
+=head1 AUTHOR
+
+=over 0
+
+=item
+Ardo van Rangelrooij <ardo at debian.org>
+
+=back
+
+=cut
+
+## ----------------------------------------------------------------------
+use strict;
+
+## ----------------------------------------------------------------------
+use File::Spec::Functions;
+use Getopt::Long;
+
+## ----------------------------------------------------------------------
+$0  =~ m|[^/]+$|;
+
+## ----------------------------------------------------------------------
+my $name = $&;
+
+## ----------------------------------------------------------------------
+use vars qw( $catalog_data $catalog_data_dir );
+use vars qw( $catalog $catalog_dir );
+use vars qw( %catalog $key $entry );
+
+## ----------------------------------------------------------------------
+$catalog_data_dir = '/var/lib/xml-core';
+$catalog_dir      = '/etc/xml';
+
+## ----------------------------------------------------------------------
+use vars qw( $add );
+use vars qw( $del );
+use vars qw( $file );
+use vars qw( $help );
+use vars qw( $local );
+use vars qw( $package );
+use vars qw( $root );
+use vars qw( $type $id );
+use vars qw( $verbose );
+
+## ----------------------------------------------------------------------
+if ( ! GetOptions(
+		  'add'       => \$add,
+		  'del'       => \$del,
+		  'file=s'    => \$file,
+		  'help'      => \$help,
+		  'id=s'      => \$id,
+		  'local=s'   => \$local,
+		  'package=s' => \$package,
+		  'root'      => \$root,
+		  'type=s'    => \$type,
+		  'verbose'   => \$verbose,
+		  )
+     )
+{
+    &help;
+    exit 1;
+}
+
+
+## ----------------------------------------------------------------------
+if ( defined( $help ) )
+{
+    &help;
+    exit -1;
+}
+
+## ----------------------------------------------------------------------
+if  ( ! ( defined( $add ) || defined( $del ) ) )
+{
+    print STDERR "$name: error: either 'add' or 'del' must be given\n";
+    exit 1;
+}
+elsif  ( ( defined( $add ) && defined( $del ) ) )
+{
+    print STDERR "$name: error: only one of 'add' and 'del' can be given\n";
+    exit 1;
+}
+
+## ----------------------------------------------------------------------
+if ( defined( $add ) )
+{
+    if ( defined( $root ) )
+    {
+	if ( defined( $package ) )
+	{
+	    my $catalog = catfile( $catalog_dir, "$package.xml" );
+	    if ( ! -f $catalog )
+	    {
+		print STDERR "$name: error: package catalog $catalog not found\n";
+		exit 1;
+	    }
+	}
+	else
+	{
+	    print STDERR "$name: error: package catalog not given\n";
+	    exit 1;
+	}
+	if ( defined( $local) || defined( $file ) )
+	{
+	    print STDERR "$name: error: local catalog and file not for adding to root catalog file\n";
+	    exit 1;
+	}
+    }
+    elsif ( defined( $package ) )
+    {
+	if ( defined( $local ) )
+	{
+	    if ( ! -f $local )
+	    {
+		print STDERR "$name: error: local catalog $local not found\n";
+		exit 1;
+	    }
+	}
+	else
+	{
+	    print STDERR "$name: error: local catalog not given\n";
+	    exit 1;
+	}
+	if ( defined( $file ) )
+	{
+	    print STDERR "$name: error: file not for adding to package catalog file\n";
+	    exit 1;
+	}
+    }
+    elsif ( defined( $local ) )
+    {
+	if ( defined( $file ) )
+	{
+	    if ( ! -f $file )
+	    {
+		print STDERR "$name: error: file $file not found\n";
+		exit 1;
+	    }
+	}
+	else
+	{
+	    print STDERR "$name: error: file not given\n";
+	    exit 1;
+	}
+    }
+    else
+    {
+	print STDERR "$name: error: catalog not given\n";
+	exit 1;
+    }
+}
+elsif ( defined( $del ) )
+{
+    if ( defined( $root ) )
+    {
+	my $catalog = catfile( $catalog_dir, 'catalog' );
+	if ( ! -f $catalog )
+	{
+	    print STDERR "$name: error: root catalog $catalog not found\n";
+	    exit 1;
+	}
+	if ( defined( $package) || defined( $local ) || defined( $file ) )
+	{
+	    print STDERR "$name: error: package catalog, local catalog or file not for deleting from root catalog file\n";
+	    exit 1;
+	}
+    }
+    elsif ( defined( $package ) )
+    {
+	my $catalog = catfile( $catalog_dir, "$package.xml" );
+	if ( ! -f $catalog )
+	{
+	    print STDERR "$name: error: package catalog $catalog not found\n";
+	    exit 1;
+	}
+	if ( defined( $local ) || defined( $file ) )
+	{
+	    print STDERR "$name: error: local catalog or file not for deleting from package catalog file\n";
+	    exit 1;
+	}
+    }
+    elsif ( defined( $local ) )
+    {
+	if ( ! -f $local )
+	{
+	    print STDERR "$name: error: local catalog $local not found\n";
+	    exit 1;
+	}
+	if ( defined( $file ) )
+	{
+	    print STDERR "$name: error: file not for deleting from local catalog file\n";
+	    exit 1;
+	}
+    }
+    else
+    {
+	print STDERR "$name: error: catalog not given\n";
+	exit 1;
+    }
+}
+
+## ----------------------------------------------------------------------
+if ( defined( $type ) )
+{
+    if ( defined( $package ) && defined( $file ) )
+    {
+	if ( $type !~ /^(system|uri)$/ )
+	{
+	    print STDERR "$name: error: wrong type\n";
+	    exit 1;
+	}
+    }
+    else
+    {
+	if ( $type !~ /^(public|system|uri)$/ )
+	{
+	    print STDERR "$name: error: wrong type\n";
+	    exit 1;
+	}
+    }
+}
+else
+{
+    print STDERR "$name: error: type not given\n";
+    exit 1;
+}
+
+## ----------------------------------------------------------------------
+if ( ! defined( $id ) )
+{
+    print STDERR "$name: error: id not given\n";
+    exit 1;
+}
+
+## ----------------------------------------------------------------------
+if ( defined( $root ) )
+{
+    $catalog = 'catalog';
+    $catalog_data = catfile( $catalog_data_dir, $catalog );
+    $catalog = catfile( $catalog_dir, $catalog );
+    my $start = $type;
+    $start .= 'Id' unless $type eq 'uri';
+    $start .= 'StartString';
+    $id = "$start=\"$id\"";
+    $type = ( $type eq 'uri' ) ? "\U$type" : "\u$type";
+    $type = "delegate$type";
+    $package = "catalog=\"file:///etc/xml/$package.xml\"";
+    $key = "$type $id";
+    $entry = "$package";
+}
+elsif ( defined( $package ) )
+{
+    $catalog_data = catfile( $catalog_data_dir, $package );
+    $catalog = catfile( $catalog_dir, "$package.xml" );
+    my $start = $type;
+    $start .= 'Id' unless $type eq 'uri';
+    $start .= 'StartString';
+    $id = "$start=\"$id\"";
+    $type = ( $type eq 'uri' ) ? "\U$type" : "\u$type";
+    $type = "delegate$type";
+    $local = "catalog=\"file://$local\"";
+    $key = "$type $id";
+    $entry = "$local";
+}
+elsif ( defined( $local ) )
+{
+    $catalog = $local;
+    $catalog_data = $local;
+    $catalog_data =~ tr|/|_|;
+    $catalog_data = catfile( $catalog_data_dir, $catalog_data );
+    my $start = ( $type eq 'uri' ) ? 'name' : $type;
+    $start .= 'Id' unless $type eq 'uri';
+    $id = "$start=\"$id\"";
+    $file = "uri=\"$file\"";
+    $key = "$type $id";
+    $entry = "$file";
+}
+
+## ----------------------------------------------------------------------
+if ( defined( $add ) )
+{
+    &read_catalog_data if -f $catalog_data;
+    if ( &add_entry )
+    {
+	&create_backup if -f $catalog;
+	&write_catalog_data;
+	&write_catalog;
+    }
+    else
+    {
+	exit 1;
+    }
+}
+elsif ( defined( $del ) )
+{
+    &read_catalog_data;
+    if ( &del_entry )
+    {
+	&create_backup;
+	&write_catalog_data;
+	&write_catalog;
+    }
+    else
+    {
+	exit 1;
+    }
+}
+
+## ----------------------------------------------------------------------
+exit 0;
+
+## ----------------------------------------------------------------------
+sub add_entry
+{
+
+    ## ------------------------------------------------------------------
+    if ( exists( $catalog{ $key } ) )
+    {
+	if ( $catalog{ $key } ne $entry )
+	{
+	    print STDERR "$name: error: entity already registered\n";
+	    return;
+	}
+	else
+	{
+	    print STDERR "$name: notice: entity already registered\n"
+		if $verbose;
+	    return 1;
+	}
+    }
+    else
+    {
+	print "$name: adding entity to catalog data $catalog_data\n"
+	    if $verbose;
+	$catalog{ $key } = $entry;
+	return 1;
+    }
+
+} ## add_entry
+
+## ----------------------------------------------------------------------
+sub del_entry
+{
+
+    ## ------------------------------------------------------------------
+    if ( exists( $catalog{ $key } ) )
+    {
+	print "$name: removing entity from catalog data $catalog_data\n"
+	    if $verbose;
+	delete( $catalog{ $key } );
+	return 1;
+    }
+    else
+    {
+	print STDERR "$name: error: entity not registered\n";
+	return;
+    }
+
+} ## del_entry
+
+## ----------------------------------------------------------------------
+sub read_catalog_data
+{
+
+    ## ------------------------------------------------------------------
+    print "$name: reading catalog data $catalog_data\n" if $verbose;
+    open( CATALOG_DATA, '<', $catalog_data )
+	or die "$name: cannot open catalog data $catalog_data for reading: $!";
+    while ( <CATALOG_DATA> )
+    {
+	chop;
+	my ( $key, $entry ) = split( />/ );
+	$key =~ s/^<//;
+	$entry =~ s/^<//;
+	$catalog{ $key } = $entry;
+    }
+    close( CATALOG_DATA )
+	or die "$name: cannot close catalog data $catalog_data: $!";
+
+} ## read_catalog_data
+
+## ----------------------------------------------------------------------
+sub write_catalog_data
+{
+
+    ## ------------------------------------------------------------------
+    print "$name: writing catalog data $catalog_data\n" if $verbose;
+    open( CATALOG_DATA, '>', $catalog_data )
+	or die "$name: cannot open catalog data $catalog_data for writing: $!";
+    my $counter = 0;
+    for my $key ( keys %catalog )
+    {
+	print( CATALOG_DATA "<$key><$catalog{ $key }>\n" );
+	$counter++;
+    }
+    close( CATALOG_DATA )
+	or die "$name: cannot close catalog data $catalog_data: $!";
+
+    ## ------------------------------------------------------------------
+    if ( $counter == 0 )
+    {
+	print "$name: removing catalog data $catalog_data\n" if $verbose;
+	unlink( $catalog_data );
+    }
+
+} ## write_catalog_data
+
+## ----------------------------------------------------------------------
+sub create_backup
+{
+
+    ## ------------------------------------------------------------------
+    my $backup = $catalog . '.old';
+
+    ## ------------------------------------------------------------------
+    if ( -f $backup )
+    {
+	print "$name: removing backup $backup\n" if $verbose;
+	unlink( $backup )
+	    or die "$name: cannot remove backup $backup: $!";
+    }
+
+    ## ------------------------------------------------------------------
+    print "$name: moving catalog $catalog to backup $backup\n" if $verbose;
+    rename( $catalog, $backup )
+	or die "$name: cannot move catalog $catalog to backup $backup: $!";
+
+} ## create_backup
+
+## ----------------------------------------------------------------------
+sub write_catalog
+{
+
+    ## ------------------------------------------------------------------
+    my @catalog = ();
+
+    ## ------------------------------------------------------------------
+    my $header = '/usr/share/xml-core/catalog.header';
+    open( HEADER, '<', $header )
+	or die "$name: cannot open catalog header $header for reading: $!";
+    while ( <HEADER> )
+    {
+	chop;
+	push( @catalog, $_ );
+    }
+    close( HEADER )
+	or die "$name: cannot close catalog header $header: $!";
+
+    ## ------------------------------------------------------------------
+    my $counter = 0;
+    for my $key ( keys %catalog )
+    {
+	push( @catalog, "<$key $catalog{ $key }/>" );
+	$counter++;
+    }
+
+    ## ------------------------------------------------------------------
+    my $footer = '/usr/share/xml-core/catalog.footer';
+    open( FOOTER, '<', $footer )
+	or die "$name: cannot open catalog footer $footer for reading: $!";
+    while ( <FOOTER> )
+    {
+	chop;
+	push( @catalog, $_ );
+    }
+    close( FOOTER )
+	or die "$name: cannot close catalog footer $footer: $!";
+
+    ## ------------------------------------------------------------------
+    print "$name: writing catalog $catalog\n" if $verbose;
+    open( CATALOG, '>', $catalog )
+	or die "$name: cannot open catalog $catalog for writing: $!";
+    for ( @catalog )
+    {
+	print( CATALOG $_, "\n" );
+    }
+    close( CATALOG )
+	or die "$name: cannot close catalog $catalog: $!";
+
+    ## ------------------------------------------------------------------
+    if ( $counter == 0 )
+    {
+	print "$name: removing catalog $catalog\n" if $verbose;
+	unlink( $catalog );
+    }
+
+} ## write_catalog
+
+## ----------------------------------------------------------------------
+sub help
+{
+
+    ## ------------------------------------------------------------------
+    print <<END;
+Usage:
+    $name <options> --add --root --type <type> \\
+                                                --id <id> --package <package>
+    $name <options> --del --root --type <type> \\
+                                                --id <id>
+
+    $name <options> --add --package <package> --type <type> \\
+                                                --id <id> --local <local>
+    $name <options> --del --package <package> --type <type> \\
+                                                --id <id>
+
+    $name <options> --add --local <local> --type <type> \\
+                                                --id <id> --file <file>
+    $name <options> --del --local <local> --type <type> \\
+                                                --id <id>
+
+    $name --help
+
+With:
+    --file <file>       = a local filename
+    --id <id>           = catalog entry idenitifier
+    --local <local>     = a local XML catalog
+    --package <package> = a package XML catalog
+    --root              = the root XML catalog (= /etc/xml/catalog)
+    --type <type>       = catalog entry type (= public, system, uri)
+
+Options:
+    --verbose = be verbose
+
+END
+
+} ## help
+
+## ----------------------------------------------------------------------
+__END__
+
+## ----------------------------------------------------------------------

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-xml-sgml/xml-core.git



More information about the debian-xml-sgml-commit mailing list