Linkfarming

Linkfarming is a technique employed by XPI and NPAPI ports ("miniports") for greater flexibility in installation.

Each miniport is installed in LOCALBASE/lib/infra/ID/ (where infra is either "xpi" or "npapi", and ID is unique for each miniport). Symlinks are then farmed in apps, usually lib/appname/{extensions,plugins}/. Once there was an idea to make a separate port, to support advanced linkfarming - allowing user to tune which miniports go to which apps, and to allow packages to invoke linkfarming. We've come to an arguably simpler solution.

There is a folder named LOCALBASE/lib/infra/symlinks/. In it, folders for each app (symlinks/firefox/, symlinks/linux-flock/, ...) In each of those, symlinks which can be copied verbatim into apps. Miniports only have to make one more linkfarming, while apps can just exec the following line on install/upgrade to instantly get all the miniports they are supposed to get:

Linkfarming is important as we might employ it in development of a new-generation packaging architecture. Systems like SEPP offer great flexibility in shlib management, requiring copies of libs kept along within each package. Symlinking can solve the disk space issue and provide for some design improvements. Consider this XPI/NPAPI linkfarming effort as a useful playground serving for development of simple, but powerful techniques.

Smart linkfarming in detail

Linkfarming by example

We're installing www/xpi-adblock:

  1. Extension is installed in PREFIX/lib/xpi/{34274bf4-1d97-a289-e984-17e546307e4f}/
  2. PREFIX/lib/xpi/symlinks/app is created for each of the infrastructure-supported apps. Some of them are firefox, linux-firefox, firefox-devel, linux-firefox-devel, flock, linux-seamonkey, etc.

  3. Links are created in PREFIX/lib/xpi/symlinks/app for each adblock-supported app - *firefox* and *flock*. In fact, mozilla and netscape are also supported by adblock, but XPI infrastructure does not support them yet, so they are not touched.

  4. Links are created in each supported app's extension subdir. In our case this will be X11BASE/lib/{*firefox*,*flock*}/extensions/. If firefox and/or flock are not installed, creation of some links is skipped silently.

We're installing www/linux-firefox:

  1. Browser is installed in PREFIX/lib/linux-firefox.
  2. Links are copied from LOCALBASE/lib/xpi/symlinks/linux-firefox/ over to PREFIX/lib/linux-firefox/extensions/.

We're deinstalling www/xpi-adblock:

  1. Extension is deleted from PREFIX/lib/xpi/xpi-id.

  2. Adblock-specific links are deleted from PREFIX/lib/xpi/symlinks/app for each adblock-supported app.

  3. Adblock-specific links are deleted from each supported app's extension subdir.
  4. Any empty dirs among PREFIX/lib/xpi/symlinks/app (for each of the infrastructure-supported apps), PREFIX/lib/xpi/symlinks, and PREFIX/lib/xpi are deleted.

We're deinstalling www/linux-firefox:

  1. Links are preened in PREFIX/lib/linux-firefox/extensions/.
  2. Browser is deleted from PREFIX/lib/linux-firefox.

Linkfarming (last edited 2008-06-17 21:38:25 by localhost)