librelist archives

« back to archive

The "main" XML catalog file... where to put it?

The "main" XML catalog file... where to put it?

From:
Justin Clift
Date:
2010-10-29 @ 05:06
Hi all,

Recently created an xhtml1-dtds formula, which installs the w3 xhtml1
dtds in it's own private area, so libvirt can use them for doc
generation:

  HOMEBREW_PREFIX/share/xhtml1-dtds-1.0/

Although that works for us, it's kind of non-optimal in a wider sense.

Apparently, on other *nix platforms, there's a system wide XML catalog
file in a fixed location /etc/xml/catalog  <-- that's a file, not a dir

The way it's (apparently) supposed to work, is that as other packages
get installed on the system, the xmlcatalog command gets used to add
reference entries to them in this system wide catalog file.

"/etc/xml/catalog" isn't going to work for Homebrew, as that breaks
the underpinning location flexibility.  I'm thinking that for Homebrew
in general, a better approach would be having a user writeable central
location, 1 per Homebrew, like this:

  HOMEBREW_PREFIX/etc/xml/catalog

And as XML packages (like ours) are installed, the xmlcatalog command
gets runs to add them to it.

Trying to think of the best approach to achieve this.  Easiest would
probably be to create a new formula, say xml-catalog-base.rb, whose
only purpose is to create an empty central XML catalog file in that
location.  Everything that needs to install into it, would then
have it as a dependency (to make sure it's in plce), and then run the
appropriate xmlcatalog commands to add to it.

Does this seem like the right kind of approach?

Regards and best wishes,

Justin Clift

Re: The "main" XML catalog file... where to put it?

From:
Max Howell
Date:
2010-10-29 @ 10:15
        
        etc already is what you want, just put the stuff there.Here's the 
definition of Formula.etc:def etc; HOMEBREW_PREFIX+'etc' end
        
            Hi all,Recently created an xhtml1-dtds formula, which installs
the w3 xhtml1dtds in it's own private area, so libvirt can use them for 
docgeneration:  HOMEBREW_PREFIX/share/xhtml1-dtds-1.0/Although that works 
for us, it's kind of non-optimal in a wider sense.Apparently, on other 
*nix platforms, there's a system wide XML catalogfile in a fixed location 
/etc/xml/catalog  <-- that's a file, not a dirThe way it's (apparently) 
supposed to work, is that as other packagesget installed on the system, 
the xmlcatalog command gets used to addreference entries to them in this 
system wide catalog file."/etc/xml/catalog" isn't going to work for 
Homebrew, as that breaksthe underpinning location flexibility.  I'm 
thinking that for Homebrewin general, a better approach would be having a 
user writeable centrallocation, 1 per Homebrew, like this:  
HOMEBREW_PREFIX/etc/xml/catalogAnd as XML packages (like ours) are 
installed, the xmlcatalog commandgets runs to add them to it.Trying to 
think o
f the best approach to achieve this.  Easiest wouldprobably be to create a
new formula, say xml-catalog-base.rb, whoseonly purpose is to create an 
empty central XML catalog file in thatlocation.  Everything that needs to 
install into it, would thenhave it as a dependency (to make sure it's in 
plce), and then run theappropriate xmlcatalog commands to add to it.Does 
this seem like the right kind of approach?Regards and best wishes,Justin 
Clift
    

Re: [homebrew] Re: The "main" XML catalog file... where to put it?

From:
Justin Clift
Date:
2010-10-30 @ 02:50
On 10/29/2010 09:15 PM, Max Howell wrote:
> etc already is what you want, just put the stuff there.
> 
> Here's the definition of Formula.etc:
> 
> def etc; HOMEBREW_PREFIX+'etc' end

Thanks Max.  I'm getting the feeling that I'm using the
wrong approach here.

It seems formulas (at the moment) are hard coded to not function
without having a URL, even when it's not needed?

  $ brew install xml-catalog-base
  Error: No url provided

  $ cat xml-catalog-base.rb
  require 'formula'

  class XmlCatalogBase <Formula
    def install
      # Create the XML catalog base directory
      (etc+'xml').mkpath

      # Generate a brand new XML catalog file
      system "xmlcatalog --noout --create #{etc}/xml/catalog"
    end
  end

I can get around it by putting in some made up URL, but that
then adds a dependency on an external (downloadable) location,
plus actually tries to install the downloaded file. :/