I have problems "downgrading" a bundle within an RCP product using
P2/SynchronizeOperation.

I'm using tycho-demo/itp04-rcp [1] as a base but with the following
modifications:
 - addition of headless update using SynchronizeOperation (inspired by Dave
Orme [2])
 - updated target platform using eclipse-platform-SDK-M20120118-0800-win32
[3] to create local P2 repository (reason was to get the fix for bug 345284
[4])

[1] https://github.com/eclipse/tycho/tree/master/tycho-demo/itp04-rcp
[2]
https://github.com/pieceoftheloaf/SynchronizeOperation/blob/master/webapps/root/test.app/src/test/app/Application.java
[3]
http://download.eclipse.org/eclipse/downloads/drops/M20120118-0800/index.php
[4] https://bugs.eclipse.org/bugs/show_bug.cgi?id=345284


 * Use Case (I'm stating it here because I haven't seen this kind of usage
discussed anywhere)
The RCP product is a client to a server running in multiple environments
(e.g. dev, qa, prod).
Each environment can of course run different versions of the server
application, which in turn may require different client versions.
By means of a settings page in the client, the user can change environment
and restart to apply.
When the client is starting, it should make sure it is running the version
that the server environment it is connecting to requires (by means of e.g.
a P2-repo hosted at each server application).

I should say that this setup is working fine using the pre-p2 update
functionality.


Build steps performed:
 - C:\itp04-rcp>mvn clean install
 - Copy C:\itp04-rcp\eclipse-repository\target\repository to <local
webroot>\www1
 - Unzip
C:\itp04-rcp\eclipse-repository\target\products\example.product.id-win32.win32.x86.zip
to C:\temp\example.product.id-win32.win32.x86
 - C:\itp04-rcp>mvn clean install (to build next version)
 - Copy C:\itp04-rcp\eclipse-repository\target\repository to <local
webroot>\www2


Contents of WWW1-repo (http://localhost/www1)
C:\temp\example.product.id-win32.win32.x86>eclipsec.exe -application
org.eclipse.equinox.p2.director -repository http://localhost/www1 -list

osgi> 201202012232.example_category_id=1.0.0.01-dXLh--7735737357797
201202012232.install_feature2_category=1.0.0.03-ddHh--7735737357797
example-bundle=0.1.0.201202012232
example-feature-2.feature.group=0.2.0.201202012232
example-feature-2.feature.jar=0.2.0.201202012232
example-feature.feature.group=0.1.0.201202012232
example-feature.feature.jar=0.1.0.201202012232
example-feature_root=0.1.0.201202012232
example-feature_root.win32.win32.x86=0.1.0.201202012232
example.product.id=0.1.0.201202012232
example.product.id.executable.win32.win32.x86=0.1.0.201202012232
example.product.id.executable.win32.win32.x86.eclipse=0.1.0.201202012232
+ lots of org.eclipse.* bundles

Contents of WWW2-repo (http://localhost/www2)
C:\temp\example.product.id-win32.win32.x86>eclipsec.exe -application
org.eclipse.equinox.p2.director -repository http://localhost/www2 -list

osgi> 201202012235.example_category_id=1.0.0.01-dXLh--773573735779C
201202012235.install_feature2_category=1.0.0.03-ddHh--773573735779C
example-bundle=0.1.0.201202012235
example-feature-2.feature.group=0.2.0.201202012235
example-feature-2.feature.jar=0.2.0.201202012235
example-feature.feature.group=0.1.0.201202012235
example-feature.feature.jar=0.1.0.201202012235
example-feature_root=0.1.0.201202012235
example-feature_root.win32.win32.x86=0.1.0.201202012235
example.product.id=0.1.0.201202012235
example.product.id.executable.win32.win32.x86=0.1.0.201202012235
example.product.id.executable.win32.win32.x86.eclipse=0.1.0.201202012235
+ lots of org.eclipse.* bundles



Initially, the RCP product has the same versions of example-*IUs found in
WWW1-repo (i.e. ending with qualifier .201202012232)
The "Installed Software"-tab contains:
  Add-on Function for p2 1.0.1.v20110906-1605-7A4FD4DiVOMap8cHSc6vPuny4gqO
org.eclipse.equinox.p2.extras.feature.feature.group Eclipse.org - Equinox
  Eclipse RCP 3.7.1.r37x_v20110729-9DB5FmlFq5JCf0w948R-kz0S0272
org.eclipse.rcp.feature.group Eclipse.org
  Equinox p2 Core Function 1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129
org.eclipse.equinox.p2.core.feature.feature.group Eclipse.org - Equinox
  Equinox p2 Provisioning for IDEs.
2.1.2.R37x_v20110815-1155-6-Bk8pYWZz0qUTX5I15GZWwbXkrl
org.eclipse.equinox.p2.user.ui.feature.group Eclipse.org - Equinox
  Equinox p2 RCP Management Facilities
1.0.1.v20110906-1605-782EqBqNKGVkiV-PUsgz-uny4gqO
org.eclipse.equinox.p2.rcp.feature.feature.group Eclipse.org - Equinox
  Example Feature 0.1.0.201202012232 example-feature.feature.group
Eclipse.org
  Example Feature 2 0.2.0.201202012232 example-feature-2.feature.group
Eclipse.org
  Example Product 0.1.0.201202012232 example.product.id null
"Plugins"-tab containts example-bundle 0.1.0.201202012232

When starting the RCP product pointing it to WWW2-repo, it installs the
example-UIs found in WWW2-repo (ending with qualifier .201202012235)
The "Installed Software"-tab contains:
  Add-on Function for p2 1.0.1.v20110906-1605-7A4FD4DiVOMap8cHSc6vPuny4gqO
org.eclipse.equinox.p2.extras.feature.feature.group Eclipse.org - Equinox
  Eclipse RCP 3.7.1.r37x_v20110729-9DB5FmlFq5JCf0w948R-kz0S0272
org.eclipse.rcp.feature.group Eclipse.org
  Equinox p2 Core Function 1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129
org.eclipse.equinox.p2.core.feature.feature.group Eclipse.org - Equinox
  Equinox p2 Provisioning for IDEs.
2.1.2.R37x_v20110815-1155-6-Bk8pYWZz0qUTX5I15GZWwbXkrl
org.eclipse.equinox.p2.user.ui.feature.group Eclipse.org - Equinox
  Equinox p2 RCP Management Facilities
1.0.1.v20110906-1605-782EqBqNKGVkiV-PUsgz-uny4gqO
org.eclipse.equinox.p2.rcp.feature.feature.group Eclipse.org - Equinox
  Example Feature 0.1.0.201202012235 example-feature.feature.group
Eclipse.org
  Example Feature 2 0.2.0.201202012235 example-feature-2.feature.group
Eclipse.org
  Example Product 0.1.0.201202012235 example.product.id null
"Plugins"-tab containts example-bundle 0.1.0.201202012235

So far, the upgrade has worked from versions .201202012232 -> .201202012235

Now, to simulate a user switching his client to an older server
environment, I try to sync the client to WWW1-repo again, i.e.
"downgrading" from .201202012235 -> .201202012232
After this, the "Installed Software"-tab contains:
  Add-on Function for p2 1.0.1.v20110906-1605-7A4FD4DiVOMap8cHSc6vPuny4gqO
org.eclipse.equinox.p2.extras.feature.feature.group Eclipse.org - Equinox
  Eclipse RCP 3.7.1.r37x_v20110729-9DB5FmlFq5JCf0w948R-kz0S0272
org.eclipse.rcp.feature.group Eclipse.org
  Equinox p2 Core Function 1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129
org.eclipse.equinox.p2.core.feature.feature.group Eclipse.org - Equinox
  Equinox p2 Provisioning for IDEs.
2.1.2.R37x_v20110815-1155-6-Bk8pYWZz0qUTX5I15GZWwbXkrl
org.eclipse.equinox.p2.user.ui.feature.group Eclipse.org - Equinox
  Equinox p2 RCP Management Facilities
1.0.1.v20110906-1605-782EqBqNKGVkiV-PUsgz-uny4gqO
org.eclipse.equinox.p2.rcp.feature.feature.group Eclipse.org - Equinox
  Example Feature 0.1.0.201202012232 example-feature.feature.group
Eclipse.org
  Example Feature 2 0.2.0.201202012232 example-feature-2.feature.group
Eclipse.org
  Example Product 0.1.0.201202012232 example.product.id null

This tells me that the the downgrade of product and features worked as
expected.
The issue I have though is that the "Plugins"-tab still shows
example-bundle 0.1.0.201202012235, i.e. the plugin was not downgraded so
now there's an inconsistency between the running example-feature and the
running example-bundle.

Doing "ss" in the OSGI-console gives me:
82      ACTIVE      example-bundle_0.1.0.201202012235
83      INSTALLED   example-bundle_0.1.0.201202012232

Looking in C:\temp\example.product.id-win32.win32.x86\plugins I find both
versions of the example-bundle:
 - example-bundle_0.1.0.201202012232.jar
 - example-bundle_0.1.0.201202012235.jar
Stopping the client, deleting example-bundle_0.1.0.201202012235.jar from
the file system and starting again gives me the correct ACTIVE bundle:
83      ACTIVE      example-bundle_0.1.0.201202012232


The feature.xml contains <plugin id="example-bundle" version="0.0.0" />
which I thought meant "latest version of example-bundle during build-time"
as opposed to "during runtime" in P2.

To my knowledge, the content.xml seems ok:
 - WWW1-repo (http://pastebin.com/ekVqXhFv)
 - WWW2-repo (http://pastebin.com/ipR5MTRQ)

Could anyone help me debug this further or explain why this is happening?
Perhaps I'm under the wrong assumption that the example-feature allows
one-and-only-one version of the example-bundle?

Many Thanks
Marcus Wallin
_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev

Reply via email to