Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » p2.inf instructions don't use newly updated plugin, instead use the currently installed version(During the update of a custom touchpoint action, the previous version of the action gets called instead of its new version.)
p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863658] Mon, 19 February 2024 14:09 Go to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
I am trying to update a custom P2 touchpoint action that is called at the configuration phase with a p2.inf file. However, I noticed that during the update process, the old version of the custom action gets called instead of the new version installed with the update.

This is in contrast to when I install the action for the first time (v0), in which case the newly installed action gets invoked during the installation. However, an update will invoke the previous version of the action (v0) from the initial installation, not the newly updated one (v1). An update after that will invoke the previous version (v1), not the currently updated one (v2), and so on.

Is there some way to make P2 invoke the action from the update and not the previous version that is currently installed? By the time we reach the Configure phase we should already be past the Install phase. Since it's possible to invoke the action during its first installation it should also be possible to do this in the update. I have tried using metaRequirements, range, and other instructions, without success.

My code looks as follows:

Plugin: com.project.plugin
└─+com.project.plugin.actions
  └──MyCustomAction.java

plugin.xml:
<plugin>
    <extension
        point="org.eclipse.equinox.p2.engine.actions">
        <action
            class="com.project.plugin.actions.MyCustomAction"
            name="myCustomAction"
            touchpointType="org.eclipse.equinox.p2.native"
            touchpointVersion="1.0.0"
            version="1.0.0">
        </action>
    </extension>
</plugin>

META-INF/p2.inf:
provides.0.namespace=com.project.plugin
provides.0.name=myCustomAction
provides.0.version=1.0.0

Feature: com.project.feature

p2.inf:
metaRequirements.0.namespace=com.project.plugin
metaRequirements.0.name=myCustomAction
metaRequirements.0.range=1.0.0

instructions.configure=com.project.plugin.myCustomAction();

feature.xml:
<feature
    id="com.project.feature"
    label="Feature"
    version="1.0.0.qualifier"
    provider-name="Provider">
    <plugin
         id="com.project.plugin"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>
</feature>

[Updated on: Mon, 19 February 2024 17:23]

Report message to a moderator

Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863664 is a reply to message #1863658] Tue, 20 February 2024 09:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
It might help if your metaRequirements.0.range specified the updated version that you want to have installed. Because the already installed bundle likely satisfied the current requirement Of course the version between the v0 and v1 must somehow be different I assume, but if the difference is important, the newer one should probably be 1.1.0 or 1.0.1...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863668 is a reply to message #1863664] Tue, 20 February 2024 13:25 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
When I try try that (provides.0.version=1.0.1, metaRequirements.0.range=1.0.1 in the updated v1) I get a dependency error message before the installation can even begin:

Your original request has been modified.
  "Feature" is already installed, so an update will be performed instead.
The actions required to successfully install the requested software are incompatible with the software to install. 
  Cannot complete the install because of a conflicting dependency.
    Software being installed: org.eclipse.equinox.p2.engine.actions.root.DefaultProfile 1.0.0.1708430071967
    Software currently installed: Feature 1.0.0.202402201151 (com.project.feature.feature.group 1.0.0.202402201151)
    Only one of the following can be installed at once: 
      Plugin 1.0.0.202402201202 (com.project.plugin 1.0.0.202402201202)
      Plugin 1.0.0.202402201151 (com.project.plugin 1.0.0.202402201151)
    Cannot satisfy dependency:
      From: Feature 1.0.0.202402201151 (com.project.feature.feature.group 1.0.0.202402201151)
      To: org.eclipse.equinox.p2.iu; com.project.plugin [1.0.0.202402201151,1.0.0.202402201151]
    Cannot satisfy dependency:
      From: org.eclipse.equinox.p2.engine.actions.root.DefaultProfile 1.0.0.1708430071967
      To: com.project.plugin; myCustomAction 1.0.1

Changing the range back to 1.0.0 allows the installation to proceed, with the problem noted before of invoking the v0 action.

If I could resolve this dependency problem I may be able to get it to use the latest bundle. I noticed the same dependency error if I use $version$.
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863670 is a reply to message #1863668] Tue, 20 February 2024 15:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
I see yes, you've installed a feature that includes the plugin and therefore you cannot update the only the plugin without updating the feature. I expect the feature does not need to include the plugin because it already has a requirement on the plugin via the p2.inf's metaRequirements so the plugin will necessarily be installed when the feature is installed. So try to remove it from the feature...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863674 is a reply to message #1863670] Tue, 20 February 2024 19:20 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
Removing it from features.xml gives an error that it could not be found:
Cannot complete the install because one or more required items could not be found.
  Software being installed: Feature 1.0.0.202402201823 (com.project.feature.feature.group 1.0.0.202402201823)
  Missing requirement: Feature 1.0.0.202402201823 (com.project.feature.feature.group 1.0.0.202402201823) requires 'com.project.plugin; myCustomAction 1.0.0' but it could not be found

I tried adding requires in addition to metaRequirements, same error.
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863685 is a reply to message #1863674] Wed, 21 February 2024 08:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
Are you sure the bundle is still in the p2 repository? The fact it's not found suggests it's not in the repository. Note that the include forces the bundle to be included in the repository but I don't know how you are building the repository. Using a category.xml? If that case you can directly specify the bundle in the category.xml. If you are build with Tycho, you can also specify that the repository should include all transitive requirements.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863738 is a reply to message #1863685] Fri, 23 February 2024 19:20 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
Your suggestion worked. I removed the bundle from feature.xml and added it to category.xml and now upon installing the update it executes the newest instructions from version 1.0.0.$qualifier$ of Plugin. I don't even need META-INF/p2.inf in Plugin anymore.

This works in my toy example where the plugin is installed for the first time, however in my application I get dependency problems from the other plugins in feature.xml that import this plugin.

Is there some way to keep the bundle in feature.xml and force it to use the latest version of Feature, with the p2.inf with metaRequirements.range=1.0.0.$qualifier$ placed in another feature (CallingFeature) that has no other dependencies on Plugin? P2, however, doesn't just override the previous Feature, instead giving me the error below when, for example, going from v732 to v956. This dependency conflict seems trivial to me since I just want the latest version. What is going on?

Your original request has been modified.
  "Feature" is already installed, so an update will be performed instead.
  "CallingFeature" is already installed, so an update will be performed instead.
The actions required to successfully install the requested software are incompatible with the software to install. 
  Cannot complete the install because of a conflicting dependency.
    Software being installed: org.eclipse.equinox.p2.engine.actions.root.DefaultProfile 1.0.0.1708587975572
    Software currently installed: Feature 1.0.0.202402220732 (com.project.plugin.feature.feature.group 1.0.0.202402220732)
    Only one of the following can be installed at once: 
      Plugin 1.0.0.202402220956 (com.project.plugin 1.0.0.202402220956)
      Plugin 1.0.0.202402220732 (com.project.plugin 1.0.0.202402220732)
    Cannot satisfy dependency:
      From: Feature 1.0.0.202402220732 (com.project.plugin.feature.feature.group 1.0.0.202402220732)
      To: org.eclipse.equinox.p2.iu; com.project.plugin [1.0.0.202402220732,1.0.0.202402220732]
    Cannot satisfy dependency:
      From: org.eclipse.equinox.p2.engine.actions.root.DefaultProfile 1.0.0.1708587975572
      To: org.eclipse.equinox.p2.iu; com.project.plugin 1.0.0.202402220956
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863748 is a reply to message #1863738] Sat, 24 February 2024 07:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
This to me suggests you are requiring an exact version of (including) com.project.plugin in com.project.plugin.feature.feature.group
    Cannot satisfy dependency:
      From: Feature 1.0.0.202402220732 (com.project.plugin.feature.feature.group 1.0.0.202402220732)
      To: org.eclipse.equinox.p2.iu; com.project.plugin [1.0.0.202402220732,1.0.0.202402220732]


Don't include the "meta" plugin in any feature. Even if the meta plugin is required by something other bundle, it does not need to be included in a feature. If a feature F includes or imports a bundle X, then any bundle Y that bundle X requires directly or transitively, will be installed without also including/importing bundle y in a feature. So anything that needs to be installed in order to complete the installation should probably not be included in any feature, perhaps imported with a permissive version range would be fine, but not include.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863799 is a reply to message #1863748] Tue, 27 February 2024 12:06 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
By the "meta" plugin you mean the com.project.plugin that I am trying to install, correct?

I already removed any reference to com.project.plugin except for metaRequirements. I noticed the following:

  1. When com.project.feature has no metaRequirements, the feature installs. When I include the metaRequirements to com.project.plugin, I get a dependency conflict like in this previous message. NB: com.project.feature and com.project.plugin already exists in the application, with previous versions.
  2. Creating a copy plugin com.project.plugincopy and a new feature com.project.dummyfeature with just metaRequirements allows me to install com.project.plugincopy the way I want, with the newest version being installed and executed every time, and with no dependency conflicts. Unfortunately it seems bad practice to me to pollute my project with new workaround features and plugins every time I need a new action.


What I am trying to solve is the problem in item 1. The metaRequirements are somehow causing a dependency error/version conflict. Removing the metaRequirements solves the conflict, but doesn't give me the action. There is no reference to com.project.plugin in feature.xml that to my knowledge could be causing the conflict.

I also noticed that when I make metaRequirements.0.range=[0,2], the version conflict disappears but the latest action is not executed - like in the OP. But when I specify 1.0.0.$qualifier$ as the version I get the dependency error. The combination of com.project.plugin with metaRequirements.0.range=1.0.0.$qualifier$ for some reason gives dependency problems. Any help in solving this would be appreciated.

[Updated on: Tue, 27 February 2024 13:09]

Report message to a moderator

Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863804 is a reply to message #1863799] Tue, 27 February 2024 14:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
It's very hard to solve an abstract problem that I can only imagine from some descriptive words. I would expect that if the feature has a metaRequirements.0.range = [1.0.0,2.0.0) and then later you update the "meta" plugin to 1.0.1 and change the feature so it has metaRequirements.0.range = [1.0.1,2.0.0), then p2 will want to install the 1.0.1 version of that plugin and because the already-installed feature allows 1.0.1 within the range of [1.0.0,2.0.0) the feature can remain installed (until it is updated later) and then the 1.0.1 plugin can be installed immediately without conflict. That's what I expect in principle...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863877 is a reply to message #1863804] Sun, 03 March 2024 18:41 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
What do the Eclipse developers do when they introduce a new action to the Eclipse touchpoint action plugins (org.eclipse.equinox.p2.touchpoint.eclipse and org.eclipse.equinox.p2.touchpoint.natives), and need to call that action in the same update from a p2.inf? Having metaRequirements.range=$version$ leads to the dependency conflict mentioned earlier, while a permissive range will give the error that the action could not be found (because it doesn't exist yet in the currently installed version). This is what I am trying to do: add a new action and invoke it from a p2.inf in the same update.

[Updated on: Sun, 03 March 2024 18:44]

Report message to a moderator

Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863887 is a reply to message #1863877] Mon, 04 March 2024 08:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
This is just not a commonly used feature. And, as I said, if the version ranges are narrow enough to force an update to the metada-required bundle but are also permissive enough that installing (updating to) the new meta-required bundle will not cause a conflict with any other currently installed bundle or feature (because these other things all have a range that permits the new higher bundle version), then I would expect and hope that the meta-required plugin is installed/updated and used for the rest of the update process. But given I have to guess as the exact details of what you are doing, and given this is not a commonly used feature, i.e., not a feature used by the Eclipse SDK nor by any of the Eclipse Packages on the download pages, I don't think you will find anyone with detailed experience to answer the question based on their own use of this feature. Even finding someone with the necessary expertise to hire will be a challenge...

I can try to help on the forum, but if you say something leads to a dependency conflict then I need exact details of what versions of what bundles and feature are installed along with what version ranges are on all their requirements, as well as versions are you trying update to along with their version ranges. Even just showing the conflict error message will provide tea leaves to read which is better than the current shadows...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863946 is a reply to message #1863887] Thu, 07 March 2024 14:47 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
I've uploaded an example project that reproduces the problems I'm seeing (latest version not being used, and dependency conflict when the latest version is specified), together with instructions.

https://github.com/axelbstein/com.project.root
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863978 is a reply to message #1863685] Fri, 08 March 2024 16:09 Go to previous messageGo to next message
Axel Stein is currently offline Axel SteinFriend
Messages: 10
Registered: February 2024
Junior Member
I uploaded your suggestion to this branch: bundle_solution.

Quote:
If you are build with Tycho, you can also specify that the repository should include all transitive requirements.


How can I do this? Does this mean that I can install the plugin without putting it in category.xml? How can I specify to Tycho that the repository should include all transitive dependencies? I tried unsuccessfully with <pomDependencies>, it said that the plugin is not found after I remove it from category.xml. It would be useful to do this so the plugin does not appear as "Uncategorized" in the Install New Software dialog.
Re: p2.inf instructions don't use newly updated plugin, instead use the currently installed version [message #1863980 is a reply to message #1863978] Fri, 08 March 2024 17:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33222
Registered: July 2009
Senior Member
https://tycho.eclipseprojects.io/doc/latest/tycho-p2-repository-plugin/assemble-maven-repository-mojo.html#includeTransitiveDependencies

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:requires org.eclipse.equinox.p2.iu
Next Topic:Inquiry About Support for Java 21
Goto Forum:
  


Current Time: Fri Oct 04 00:17:47 GMT 2024

Powered by FUDForum. Page generated in 0.49807 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top