Thursday, July 10, 2008

Fun With p2



This walkthrough is intended chronicle my experiences with the Equinox provisioning platform Admin UI. I was able to glean most of the info needed from the Admin UI wiki at http://wiki.eclipse.org/Equinox_p2_Getting_Started_Admin_UI.
I tried http://wiki.eclipse.org/Equinox_p2_Admin_UI_Users_Guide
first, but it wasn't very helpful.

Download the equinox p2 agent and unzip to a good location (I used /opt/p2). Note that due to p2 limitations it is painful to move the agent around after provisioning multiple profiles.
It seems to take a few moments [too long] to start up (and why does it add a workspace directory to my Desktop?!).
It is also possible to run the Admin UI from within Eclipse by installing the Equinox Provisioning Agent Feature.

Add Metadata and Artifact Repositories for at least http://download.eclipse.org/releases/ganymede/ and http://download.eclipse.org/eclipse/updates/3.4milestones/.
Whoa, it looks like the first add gets displayed many times (see picture) [1].
Where is that nice drag and drop from the Software Update... feature [2]?

Drill down into the Metadata Repositories.
I find it nicer to group the Installable Units (IU) by category (Window->Preferences).

In the Profiles view there is an EquinoxProvisioningUI profile corresponding to the agent itself. Add a new profile for the Eclipse SDK and set the location and bundle pool location.
"/home/lee/user" seems like a poor default [3].
I would have like to set a global bundle pool for all users, but didn't want to run as root, so the bundle pool location I chose was /home/lee/.p2 [4].

Drag and drop the org.eclipse.sdk.ide feature from install list.
I tried installs with org.eclipse.platform.ide and org.eclipse.platform.sdk and they both installed but failed to start.

Approve the installations and proceed to Finish.
Check out some of the improved equinox security features at http://wiki.eclipse.org/Trusted_Bundles.
I had some problems taking a screen shot of the downloads, possibly due to my humble AMD Sempron 2800+ 1.6GHz CPU being pegged.
After about 10 minutes (for my 6.6 Mb/s connection--according to http://speedtest.net/) the install should complete and the IU should be displayed in the profile.

Navigate to the install location and launch your new Eclipse instance.
If you select Help->About Eclipse and click the Configuration button, you will notice one of the limiting factors of the agent...for some reason each install points back to the p2 agent for their p2 metadata [5].

Create a new profile in the Admin UI with the same bundle pool location (/home/lee/.p2) and install the Eclipse SDK IU to this profile.
Notice that this time, the install is only 4KB and will take about 10 seconds.
Way cool.

Launch your new Eclipse instance and open Help -> Software Updates...
You will notice the only Installed unit listed is the Eclipse SDK itself.
Lets install a new feature (the SCA tools feature from the STP project looks pretty interesting).
Using the filter list to narrow down installable units would be useful but it seems very slow [6].
The SCA tools install took me about 4 minutes.
Looks like the install button is missing its uppermost pixels, but that seems to have gone away now.

Restart Eclipse and be sure the plugins were properly installed
If you installed the SCA tools like me, create a new SCA example project using the wizard and note that the errors will go away when you point the tooling at an apache tuscany distribution.

Next, install the same feature to your original Eclipse Profile instance and you should see that it finds the plugins from your bundle pool.
My SCA Tools install took about 15 seconds this time

Back in the Admin UI, you can refresh the Profiles view but for some reason it can't see the newly installed features (after a quick restart they will magically appear) [7].
Next, lets install another Ganymede IU for good measure.
This time I went with the JavaScript Development Toolkit

Notice that directly after the install, the new IU shows up under "Installed Software" from you Eclipse instance. However, like installing plugins normally, it may require a restart to take effect.
At least you can use File -> Restart now instead of a manual stop and start (I used Switch Workspace -> Other for this in previous releases).
If you open the other Eclipse Profile installation, you can verify that it does not contain the newly installed feature.

Now suppose we would like to remove the SCA tooling feature from one of our profiles. In the Admin UI, there is no way to uninstall features.
This was very annoying when I installed the org.eclipse.platform.sdk feature and it wouldn't work...basically I had to remove the whole profile and delete the files manually.

However, if you have a working Eclipse install, it should still be possible to revert to a previous configuration by selecting the Revert Configuration... button in the Update Software... dialog.
Once again, the Admin UI will require a restart to notice the change in profile.

Overall, the p2 experience is very promising, despite the numerous annoying bugs left to solve. I am impressed with how this all came together, especially given some of the p2 criticism I heard near the end game for Ganymede.

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240472
[2]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240600
[3]https://bugs.eclipse.org/bugs/show_bug.cgi?id=229699
[4]https://bugs.eclipse.org/bugs/show_bug.cgi?id=222130
[5]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240601
[6]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240603
[7]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240602

1 comment:

Jethro said...

have you tried installing Equinox Provisioning Agent Feature in eclipse 3.6.2? I failed in this version.