Hi Mikhail,
Thanks a lot for your help on this.
Actually the long list of profile properties in my previous mail, are what
I got at runtime when I printed the profile properties as below;
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
for (String key: profile.getProperties().keySet()){
System.out.println(key + " : " + profile.getProperty(key));
}
The long list of props was a result of some trial and error tasks I did
when invoking p2-director with -profileProperties parameter (setting
org.eclipse.equinox.p2.configurationFolder,
org.eclipse.equinox.p2.installFolder, org.eclipse.equinox.p2.cache) So
please disregard the p2.roaming=false in that list, as it's probably a
wrong output during my trials.
I ran p2-director removing those additional -profileProperties and setting
only -profileProperties org.eclipse.update.install.features=true and
-roaming enabled.
Then I get the below set of properties set in the Profile at
/dileepa/kernel/trunk/distribution/kernel/
target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/p2/org.eclipse.equinox.p2.engine/profileRegistry/WSO2CarbonProfile.profile
(after the product is moved)
<properties size='6'>
<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'/>
<property name='eclipse.touchpoint.launcherName' value='null'/>
</properties>
Please note that org.eclipse.equinox.p2.cache:
*/dileepa/kernel/trunk/distribution/kernel/target/WSO2Carbon,
*is the location the bundle pool is located prior to moving the target
product to the new location:/dileepa/kernel/trunk/distribution/kernel/target
/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/*. *
When installing features using p2-director prior to moving the product I
can successfully find /features /plugins at:
/dileepa/kernel/trunk/distribution/kernel/target/WSO2Carbon and copy
resources with the installing features, without any problem. *
*
However after the product is moved to the new location and final packaging
is done, at product startup I see a new profile.gz with a new timestamp
generated at /profileRegistry/WSO2CarbonProfile.profile and in that Profile
the prop values are changed as below;
<properties size='6'>
<property name='org.eclipse.equinox.p2.installFolder'
value=/dileepa/kernel/trunk/distribution/kernel/backup/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile'/>
* <property name='org.eclipse.equinox.p2.cache'
value='/dileepa/kernel/trunk/distribution/kernel/backup/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile'/>
*
<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'/>
<property name='eclipse.touchpoint.launcherName' value='null'/>
</properties>
*
*And with above p2.cache value, I cannot install features which have
resources to be copied during configure phase with paths set relative
${installFolder}/../features because now features are extracted at
${installFolder}/features based on the above changed p2.cache value.
When roaming is enabled how does P2 compute these paths of a moving
product? Does it compute them relative to any other property like
osgi.install.area or eclipse.p2.data.area?*
*
At startup I set OSGi runtime configurations as below;
osgi.install.area: ${carbon.home}/repository/components/${profile}
osgi.configuration.area:
${carbon.home}/repository/components/${profile}/configuration
eclipse.p2.data.area: ${carbon.home}/repository/components/p2*
*
The solution I was looking for above problem is a way to override p2.cache
property during runtime. But as I see there is no straight forward way to
setProperty() of a running profile.
Do you see any better way to resolve the issue I'm facing?
Thanks,
Dileepa*
** *
On Fri, Mar 1, 2013 at 1:16 PM, Mikhail Kalkov <
[email protected]> wrote:
> 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<https://bugs.eclipse.org/bugs/show_bug.cgi?id=344155>and
> 344153 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=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
>
> ------------------------------
> *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/componentsdirectory 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#initializeProfilemethod
>> (see [1]), destination is used to initialize the
>> org.eclipse.equinox.p2.installFolder and
>> org.eclipse.equinox.p2.cacheproperties. Furthermore, if a
>> -bundlepool argument is provided, it is used instead to initialize the
>> org.eclipse.equinox.p2.cache property. From my experience,
>> -destinationargument 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 -roamingargument,
>> 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:
>>
>>> 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
>>
>>
>
>
> --
> 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
>
>
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev