[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Can I change the location to extract features during provisioning using P2 Provisioning Agent?

Hi Dileepa,

I've found your question interesting and decided to check the p2 source. I'm quite sure you're familiar with p2 terminology but in case something is unclear, you can check Pascal's "Understanding and extending p2 for fun and profit" presentation at Slideshare.net

If you run p2 Director in order to create a new installation, you can give it -destination and -bundlepool arguments. According to org.eclipse.equinox.internal.p2.director.app.DirectorApplication#initializeProfile method (see [1]), destination is used to initialize the org.eclipse.equinox.p2.installFolder and org.eclipse.equinox.p2.cache properties. Furthermore, if a -bundlepool argument is provided, it is used instead to initialize the org.eclipse.equinox.p2.cache property. From my experience, -destination argument and therefore p2.installFolder decide where the p2/ directory will go, whereas -bundlepool and p2.cache decide where features/ and plugins/ will reside. However, I was unable to find references to "features/" or "plugins/" in the source code.

So, I decided to check p2 profile contents and opened p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile/1353405221611.profile.gz. It turned out that some of the first lines are indeed as follows:
    <property name='org.eclipse.equinox.p2.installFolder' value='C:\Users\Mikhail\Applications\eclipse-SDK-4.2.1-win32'/>
    <property name='org.eclipse.equinox.p2.cache' value='C:\Users\Mikhail\Applications\eclipse-SDK-4.2.1-win32'/>
So, I changed directory to the one pointed out in p2.cache property, and discovered the artifacts.xml file. When I opened this file, I found out the following lines in it:
    <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
    <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
    <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>

To sum up, it seems that p2.installFolder property is used to decide the location of p2/ directory, whereas p2.cache property is used to decide the location of features/ and plugins/. From p2 Director documentation (see [2])  and source code [1] it follows that you can even share bundle pools between several eclipse installations, although I have never tried this.

By the way, concerning you question about config.ini, I've noticed that if you perform a new installation and don't give director -roaming argument, it will put an absolute path in config.ini, whereas with -roaming argument it will use a path relative to OSGi configuration area location. I think, the value in config.ini is used to find a path to p2 profile, which is later used to find a path to p2 bundlepool. So, if you change this path in config.ini, you might be unable to locate p2/ folder. I think what you need is to make sure that the p2.cache property is correctly initialized in your p2 profile.

[1] http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/4.2/org.eclipse.equinox.p2.director/app/1.0.300/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java#DirectorApplication.initializeProfile%28%29
[2] http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html

Kind regards,
Mikhail Kalkov

Purple Scout AB
Software Developer

Address: Kyrkogatan 20-22, SE-41110 Gothenburg, Sweden
Phone:   +46 (0) 732 - 051405
E-mail:  mikhail.kalkov@xxxxxxxxxxxxxx
Web:     www.purplescout.se



From: "Dileepa Jayakody" <dileepa@xxxxxxxx>
To: "P2 developer discussions" <p2-dev@xxxxxxxxxxx>
Sent: Friday, February 22, 2013 8:57:28 AM
Subject: Re: [p2-dev] Can I change the location to extract features during provisioning using P2 Provisioning Agent?

Hi All,

Does P2 create /features, /plugins directories relative to org.eclipse.equinox.p2.installFolder location during provisioning?
If so can I override this location at runtime?
Can I do this by defining the org.eclipse.equinox.p2.installFolder=@xxxxxxxxxx/../../ in config.ini?

Really appreciate if someone can shed some light on how p2 decides the location to create /features, /plugins directories during provisioning.

Thanks,
Dileepa

On Fri, Feb 22, 2013 at 3:27 AM, Dileepa Jayakody <dileepa@xxxxxxxx> wrote:
Hi All,

How does p2 calculate the location to extract features during provisioning? Is it relative to the osgi.install.area?
The issue I'm facing is, some of the features to install have file-copy instructions in it's p2.infs, and the source files are copied from the features extracted to target directories.
The target distribution contains multiple profiles and their configuration areas defined separately, in below format.

target
|-plugins
|-features
|-p2 {shared p2}

|--ProfileA 
|    |-configuration
|       /config.ini
|       /org.eclipse.equinox.simpleconfigurator/bundles.info
|--ProfileB
|    |-configuration
|       /config.ini
|       /org.eclipse.equinox.simpleconfigurator/bundles.info
 
During build phase when we install features via p2-director giving -destination as target/${Profile}.
Then the installing features are extracted to target/features and the relative path to the extracted feature will be ${installFolder}/../features; this works fine using p2-director, and necessary files get copied during build phase.
But during runtime when we do a feature installation using P2-provisioning agent, the features are extracted in target/${Profile}/features and the relative path to source file (${installFolder}/../features) in above file-copy instruction gets invalid.

Is it possible to configure the place to extract features at runtime? Can I explicitly specify the location to extract features to ProvisioningAgent?
Any help for this is really appreciated as I'm kind of stuck here.

Thanks,
Dileepa




--
Dileepa Jayakody,
Software Engineer, WSO2 Inc.
Lean . Enterprise . Middleware

Mobile : +94777-857616

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev