Hi again , Dileepa
I've started to write this reply some time ago but have only got time to finish
it today.
1. Whenever you do anything with p2, you run p2 Agent which is essentially an
"executable version of p2/ directory". The important bit is that you can
provision both the eclipse installation which you use to run p2 director
(self-provisioning) as well as any other eclipse installation (external
provisioning). This is one part, which I didn't quite get from your
explanation. How do
2. If I understand correctly, you have an installed Eclipse product, which is
described by a p2 profile with the following properties:
org.eclipse.equinox.p2.installFolder = ${basedir}/target/WSO2Carbon
/WSO2CarbonProfile
org.eclipse.equinox.p2.cache = ${basedir}/target/WSO2Carbon
org.eclipse.equinox.p2.roaming = true
Then you use p2 director to provision this profile, and later move
${basedir}/target/WSO2Carbon to ${basedir}/
target/wso2carbon-core-4.1.0-SNAPSHOT /repository/components . After doing that
the p2 profile contains the following properties.
org.eclipse.equinox.p2.installFolder = ${basedir}
/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
org.eclipse.equinox.p2.cache = ${basedir}
/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
org.eclipse.equinox.p2.roaming = false
org.eclipse.equinox.p2.cache.shared = ${basedir}
/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
Do you know why paths are absolute and roaming is set to false? I recall that
there were some issues with moving eclipse and eclipse/p2 directories when
roaming is disabled. I think I've seen problems even when roaming was enabled
(see Eclipse bugs 344155 and 344153 ). Try to do "grep -RI $old_path $new_path"
and checking if profile contains correct relative paths or absolute ones.
3. Can you try installing features before moving Eclipse folder? Do you see the
same problem?
/Mikhail
----- Original Message -----
From: "Dileepa Jayakody" <[email protected]>
To: "P2 developer discussions" <[email protected]>
Sent: Friday, February 22, 2013 8:16:55 PM
Subject: Re: [p2-dev] Can I change the location to extract features during
provisioning using P2 Provisioning Agent?
Hi Mikhail and all,
Thanks a lot for the detailed explanation. Appreciate it very much :), Pascal's
presentation@slideshare was also very helpful for me to understand p2 concepts.
My requirement is to share the same /features, /plugins created during
build-time using p2-director, for feature-installations at runtime.
When I looked at my profile in
p2/org.eclipse.equinox.p2.engine/profileRegistry/WSO2CarbonProfile.profile I
can see below properties;
<profile id='WSO2CarbonProfile' timestamp='1361556570247'>
<properties size='5'>
<property name=' org.eclipse.equinox.p2.installFolder '
value='/dileepa/kernel/trunk/distribution/kernel/target/WSO2Carbon/WSO2CarbonProfile'/>
<property name=' org.eclipse.equinox.p2.cache '
value='/dileepa/kernel/trunk/distribution/kernel /target/WSO2Carbon '/>
<property name='org.eclipse.update.install.features' value='true'/>
<property name='org.eclipse.equinox.p2.roaming' value='true'/>
<property name='org.eclipse.equinox.p2.environments' value=' osgi.nl =en_GB,
osgi.ws =gtk,osgi.arch=x86,osgi.os=linux'/>
</properties>
</profile>
As you can see, the 'org.eclipse.equinox.p2.cache' property is set to the
target-root (WSO2Carbon); and this is where both /features, /plugins
directories are created as we give -bundlepool ${basedir}/target/WSO2Carbon in
director.
The issue I'm facing is during runtime when performing a provisioning action
the /features, /plugins are not extracted to above location; instead they are
extracted inside the running-Profile's root directory, and I see during runtime
p2.cache location is initialized as below;
org.eclipse.equinox.p2.cache :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
(Please note that in the build-phase after the features are installed using
p2-director we manually copy the generated p2 stuff under a new target folder
:/wso2carbon-core-4.1.0-SNAPSHOT /repository/components . So /target/WSO2Carbon
corresponds to target/wso2carbon-core-4.1.0-SNAPSHOT /repository/components
directory in the final target)
According to the original property set in the Profile,
org.eclipse.equinox.p2.cache should have being initialized with :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components
But it points to the running Profile's root directory (
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
) and my features with p2-instructions to copy files are not installed
correctly giving IOExceptions as it can't find the source file using the given
file-path ${installFolder}/features/${ feature.id }_${version}/myFile.txt.
Below are the total list of properties initialized in the running Profile
during runtime;
Using P2-director we only specify -profileProperties
org.eclipse.update.install.features=true, all others props below are intialized
by P2 implicitly.
org.eclipse.equinox.p2.installFolder :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
org.eclipse.equinox.p2.cache :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
org.eclipse.update.install.features : true
org.eclipse.equinox.p2.roaming : false
org.eclipse.equinox.p2.environments : osgi.nl =en_GB, osgi.ws
=gtk,osgi.arch=x86,osgi.os=linux
eclipse.touchpoint.launcherName : null
org.eclipse.equinox.p2.surrogate : true
org.eclipse.equinox.p2.shared.timestamp : 1361556595118
org.eclipse.equinox.p2.cache.shared :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
org.eclipse.equinox.p2.configurationFolder :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile/configuration
org.eclipse.equinox.p2.launcherConfiguration :
/dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile/configuration/eclipse.ini.ignored
Is there a way I can override org.eclipse.equinox.p2.cache property of the
running profile to point to the correct location?
Does anyone have an idea on how above property defined in the Profile has
initialzed with a different value during runtime?
At startup we define osgi.install.area, osgi.configuration.area and
eclipse.p2.data.area as per the running Profile. Does these osgi-runtime
properties have an effect on changing P2 properties at runtime?
Thanks,
Dileepa
On Fri, Feb 22, 2013 at 5:20 PM, Mikhail Kalkov < [email protected]
> wrote:
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='(& (classifier=osgi.bundle))'
output='${repoUrl}/plugins/${id}_${version}.jar'/>
<rule filter='(& (classifier=binary))'
output='${repoUrl}/binary/${id}_${version}'/>
<rule filter='(& (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: [email protected]
Web: www.purplescout.se
From: "Dileepa Jayakody" < [email protected] >
To: "P2 developer discussions" < [email protected] >
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
[email protected]/../../ 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 < [email protected] > wrote:
<blockquote>
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
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev
</blockquote>
--
Dileepa Jayakody,
Software Engineer, WSO2 Inc.
Lean . Enterprise . Middleware
Mobile : +94777-857616
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev