[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Packaging dtds



I wrote some a catalog handling %post(un) in the Red Hat Linux 9/Fedora
Core 1 time frame.  Not sure if it's still up to date, though.

> I would like to package a dtd for a package of mine: pam_mount. It has an xml 
> config file that has this dtd line:
> 
> <!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
> 
The DOCTYPE that I was dealing with was:

  <!DOCTYPE checklist
    PUBLIC "-//BadgerWare//DTD QA Assistant Checklist File 0.3//EN"
    "http://qa-assistant.sf.net/dtds/checklist/0.3/checklist.dtd";>

I think some of the differences we see below are due to PUBLIC instead
of SYSTEM.  Some other differences are due to upstream's use of a
subcatalog.

> Where do I now have to install the dtd? Is it 
> /usr/share/xml/dtds/pam_mount/pam_mount.conf.xml.dtd? I guess I will also have 
> to create some XML catalog file, probably with xmlcatalog to make xmllint find 
> the dtd automatically. This seems to work:
> 
> # for /etc/catalog and xmlcatalog
> Requires:         xml-common
> Requires(post):   xml-common libxml2
> Requires(postun): xml-common libxml2
> 
This looks correct.

> %post
> /usr/bin/xmlcatalog --noout --add "rewriteSystem" pam_mount.conf.xml.dtd 
> file:///usr/share/xml/pam_mount/dtds/pam_mount.conf.xml.dtd /etc/xml/catalog 
> &> /dev/null || :
> 

I did:

  ROOTCATALOG=%{_sysconfdir}/xml/catalog
  /usr/bin/xmlcatalog --noout --add "delegatePublic" \
      "-//BadgerWare//DTD QA Assistant" \
      "file://$CATALOG" $ROOTCATALOG &> /dev/null || :
  /usr/bin/xmlcatalog --noout --add "delegateSystem" \
      "http://qa-assistant.sf.net/dtds"; \
      "file://$CATALOG" $ROOTCATALOG &> /dev/null || :
  /usr/bin/xmlcatalog --noout --add "delegateURI" \
      "http://qa-assistant.sf.net/dtds"; \
      "file://$CATALOG" $ROOTCATALOG &> /dev/null || :

[Corrected from next post]
> %postun
> if [ $1 = 0 ]; then
> /usr/bin/xmlcatalog --noout --del
> file://%{_datadir}/xml/pam_mount/dtds/pam_mount.conf.xml.dtd
> %{_sysconfdir}/catalog
> fi
> 
  ROOTCATALOG=%{_sysconfdir}/xml/catalog
  CATALOG=%{_datadir}/xml/qa-assistant/xmlcatalog

  /usr/bin/xmlcatalog --noout --del \
      "-//BadgerWare//DTD QA Assistant" &> /dev/null || :
  /usr/bin/xmlcatalog --noout --del \
      "http://qa-assistant.sf.net/dtds";

The $CATALOG file referenced in the above snippets was created by the
upstream Makefile.  It added rewriteSystem as you do and also rewriteURI
and public:

 $(XMLCATALOG) --noout --add "public" \
  "-//BadgerWare//DTD QA Assistant Checklist File 0.3//EN" \
  "checklist/0.3/checklist.dtd" $(DESTDIR)$(CATALOG);
 $(XMLCATALOG) --noout --add "rewriteSystem" \
  "http://qa-assistant.sf.net/dtds/checklist/0.3"; \
  "checklist/0.3/" $(DESTDIR)$(CATALOG);
 $(XMLCATALOG) --noout --add "rewriteURI" \
  "http://qa-assistant.sf.net/dtds/checklist/0.3"; \
  "checklist/0.3/" $(DESTDIR)$(CATALOG);

The dtd ended up in %{_datadir}/xml/qa-assistant/checklist/0.3/checklist.dtd

The catalog referencing it was in %{_datadir}/xml/qa-assistant/xmlcatalog

> If this is good, I will suggest to include this in the Guidelines or add it 
> somewhere else in the wiki. Or is there already some guidance that I did not 
> find?
> 
This should go on Packaging/ScriptletSnippets when done.

-Toshio

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]