| Both sides previous revision Previous revision Next revision | Previous revision |
| andrewpantyukhin:linkfarming [2006/07/29 20:55] – AndrewPantyukhin | andrewpantyukhin:linkfarming [2022/10/04 00:55] (current) – Chase page rename KubilayKocak |
|---|
| ===== Linkfarming ===== | ===== Linkfarming ===== |
| |
| Linkfarming is a technique employed by ["XPI"] and ["NPAPI"] ports ("miniports") for greater flexibility in installation. | Linkfarming is a technique employed by XPI and [[AndrewPantyukhin/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. | 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. In each of those, symlinks which can be copied verbatim into apps. Then xpi-ports will only have to make one more linkfarming, while apps will just "cp -R LOCALBASE/lib/xpi/symlinks/APP_NAME/ X11BASE/lib/APP_NAME/extensions/".// | 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: |
| | ''%%cp -R LOCALBASE/lib/infra/symlinks/appname/ PREFIX/lib/appname/{extensions,plugins}/%%'' |
| |
| This approach can also be exploited for ["NPAPI"] plugin installation, where tuning is often very desirable. Folder named X11BASE/lib/browser_plugins/symlinks. Developers can later be seduced to migrate to LOCALBASE/lib/npapi for consistency. | Linkfarming is important as we might employ it in development of a new-generation packaging architecture. Systems like [[http://www.sepp.ee.ethz.ch/|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. |
| | |
| Linkfarming is important as we might employ it in development of a new-generation packaging architecture. Systems like [http://www.sepp.ee.ethz.ch/ 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 playground serving for development of simple, but powerful techniques. | |
| |
| ==== Smart linkfarming in detail ==== | ==== Smart linkfarming in detail ==== |
| |
| * Every plugin/extension (let's call it a miniport) knows a list of all apps supported by the infrastructure. | * Every miniport knows a list of all apps supported by the infrastructure. |
| * The list can be stored in a common makefile. | * The list can be stored in a common makefile. |
| * The lists for different infrastructures (plugins and extensions) can differ. E.g. opera supports NPAPI, but not XPI. | * The lists for different infrastructures (plugins and extensions) can differ. E.g. opera supports NPAPI, but not XPI. |
| * When app is installed it copies links from the //symlink// subdir with matching title over to its subdirs. Apps preen their subdirs for links on deinstall. Thus the infrastructure is fully portupgrade-safe and quite user-friendly. | * When app is installed it copies links from the //symlink// subdir with matching title over to its subdirs. Apps preen their subdirs for links on deinstall. Thus the infrastructure is fully portupgrade-safe and quite user-friendly. |
| |
| Let's have an example: | === Linkfarming by example === |
| |
| We're installing www/xpi-adblock: | We're installing www/xpi-adblock: |
| - Extension is installed in PREFIX/lib/xpi///xpi-id//. | - Extension is installed in PREFIX/lib/xpi/{34274bf4-1d97-a289-e984-17e546307e4f}/ |
| - 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. | - 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. |
| - 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. | - 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. |
| - Adblock-specific links are deleted from PREFIX/lib/xpi/symlinks/**//app//** for each adblock-supported app. | - Adblock-specific links are deleted from PREFIX/lib/xpi/symlinks/**//app//** for each adblock-supported app. |
| - Adblock-specific links are deleted from each supported app's extension subdir. | - Adblock-specific links are deleted from each supported app's extension subdir. |
| - Any empty dirs among PREFIX/lib/xpi/symlinks/**//app//** (for each of the infrastructure-supported apps), PREFIX/lib/xpi/symlinks, PREFIX/lib/xpi are deleted. | - 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: | We're deinstalling www/linux-firefox: |