RPMifying Mozilla Firebird Extensions

The process is something like this for a majority of XPIs I've come across thus far.

  1. Under %prep, extract .xpi file to BUILD dir.
  2. Under %install, extracted contents of the .xpi file should be installed under /usr/lib/MozillaFirebird/chrome with the exact structure from the xpi file (the exception to this rule is the install.js, which comes with each xpi file and is only used during the install). I've found that most simple extensions contain a single .jar file that has all XUL content.
  3. Now comes the tricky part - we need to register the extension/chrome with one of the ugliest goddam hacks I've ever seen. We add one or more line to /usr/lib/MozillaFirebird/chrome/installed-chrome.txt that points to the files we just laid down. The lines required will vary from extension to extension; it is usually possible to deduce the format but some extensions do some special stuff with locales and whatnot. I think the only surefire way to know what these lines need to look like is to run Firebird as root, install the extension through the browser, and then grab the lines out of installed-chrome.txt. Anyway, I had to add a bunch of crap to %post that appends the lines to installed-chrome.txt and then to executes /usr/lib/MozillaFirebird/regchrome. This updates chrome.rdf (and possibly some other files).
  4. For %preun, you need to remove the lines added to installed-chrome.txt and exec regchrome again. I hacked this up with an error-proned grep -v extension-name, which seems to work so far but definitely needs refined.

Moving forward there are a few things I need to figure out. If anyone has info on these, please let me know.

What's the license on these things?
I haven't seen a single reference to redistribution policy anywhere. Are most of these covered under the standard Mozilla license?

Packaging Guidelines

I'd like to throw together some RPM packaging guidelines for Firebird extensions. Right now I have all of the extensions I've packaged in a single SRPM and I'm using %package to split them out. This saves some time when I'm adding new extensions but isn't very maintainable. I also have 4 function macros defined at the top of the spec file for extracting the xpi, adding/removing installed-chrome.txt entries, running regchrome, etc. It might be nice to move these into a macros file somewhere.

Another thing to standardize on is a package name prefix. I've been using MozillaFirebird-ext-name. I'm starting to think that the -ext may not be necessary. On pure aesthetics, I prefer MozillaFirebird-googlebar to MozillaFirebird-ext-googlebar.