Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356905

Summary: Unable to update rooted plugin due to unknown dependency - org.eclipse.equinox.p2.operations code=10007
Product: [Eclipse Project] Equinox Reporter: Boden <brussell>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Latest profile we are trying to update (DefaultProfile)
none
Our config.ini
none
Our bundles.info
none
Artifact/metadata repo which contains a sample update
none
Last 10,000 lines of p2 tracing for the failed update none

Description Boden CLA 2011-09-07 05:51:23 EDT
Build Identifier: 20100917-0705

We have an OSGi/Equinox product consisting of a number of plugins (I realize a product of features is most likely a better layout -- we are working on this). Each of our product plugins has been provisioned such that they are 'rooted' and hence should be p2 updatable.

To support our updates, we have implemented a simple plugin which essentially provides the same functionality as the p2 console plugin (i.e. prov* commands) except it allows us to install all IUs in a repo in batch mode, rather than 1-by-1 as does the provinstall command. This java impl uses the operations API to perform install/updates. Here's snippet of our code which performs an UpdateOperation:

				UpdateOperation updateOperation = new UpdateOperation(
						new ProvisioningSession(agent));
				IStatus result = updateOperation.resolveModal(new NullProgressMonitor());
				if (result.isOK()) {
					Job job = updateOperation.getProvisioningJob(new NullProgressMonitor());
					job.schedule();
				} else {
					updStrm.println(Messages.getInstance().getString(locale, "updates.existing.error", result.getMessage())); //$NON-NLS-1$
					return;
				}

We are in the process of testing the update functionality. Updating of all of our rooted IUs (plugins) works fine with the exception of 1 (IU) plugin -- com.ibm.cfs.autostarter. When trying to update this particular IU, p2 gives us an error that it cannot be uninstall because other software requires it. I added some debug code and turned on p2 tracing to try and capture some details. The tail of the output upon update looks like this:

[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] Projection complete: 984
[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] Invoking solver: 1315387468640
[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] Satisfiable !
[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] Solver solution found: 31

[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] null --> [R]com.ibm.cfs.autostarter 2.2.0.0-20110
910
[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] [IInstallableUnit property for com.ibm.cfs.autost
arter 2.2.0.0-20110910] org.eclipse.equinox.p2.type.root = null --> true
[p2] Wed Sep 07 05:24:28 EDT 2011 - [OSGi Console] [IInstallableUnit property for com.ibm.cfs.autost
arter 2.2.0.0-20110910] org.eclipse.equinox.p2.internal.inclusion.rules = null --> STRICT
Error updating existing Items. Cause: Operation details
Status INFO: org.eclipse.equinox.p2.operations code=0 Operation details null children=[Status INFO:
org.eclipse.equinox.p2.operations code=10007 "The CFS Auto Starter" cannot be fully uninstalled beca
use other installed software requires it.  The parts that are not required will be uninstalled. null
]

I've been digging for quite some time and am not understanding why this 1 IU has other IUs that depend on it. The impl of this plugin is very simple an implements a BundleTracker which autostarts all bundles. None of our other plugins import/depend on this plugin and this plugin only imports a few org.osgi.framework.* classes.

I've also tried working around this update issue by using provremove, confapply, provinstall to reinstall this particular IU at a new version level (i.e. trying to find some way to update it, even if not pretty). This does not work either and I end up with the initial bundle installed after performing the steps.





Reproducible: Always

Steps to Reproduce:
1. Install our p2 provisioned (updatable) product which consists of a number of rooted plugins.
2. Use the UpdateOperations API to try and update the autostarter IU.
3. View the output
4. Verify the autostarter IU was not updated.
Comment 1 Boden CLA 2011-09-07 05:52:47 EDT
Created attachment 202872 [details]
Latest profile we are trying to update (DefaultProfile)
Comment 2 Boden CLA 2011-09-07 05:53:33 EDT
Created attachment 202873 [details]
Our config.ini
Comment 3 Boden CLA 2011-09-07 05:54:10 EDT
Created attachment 202874 [details]
Our bundles.info
Comment 4 Boden CLA 2011-09-07 05:57:33 EDT
Created attachment 202875 [details]
Artifact/metadata repo which contains a sample update

This artifact/metadata repo contains a single IU -- an updated version of the IU which cannot be updated.
Comment 5 Boden CLA 2011-09-07 06:00:20 EDT
Created attachment 202876 [details]
Last 10,000 lines of p2 tracing for the failed update
Comment 6 Boden CLA 2011-09-07 06:33:06 EDT
After further inspection of our current profile (DefaultProfile) I found that our product (com.ibm.cfs.product) IU has the autostarter IU in its required element -->
    <unit id='com.ibm.cfs.product' version='2.2.0.0-20110831'>
      <update id='com.ibm.cfs.product' range='0.0.0' severity='0'/>
      <properties size='3'>
        <property name='org.eclipse.equinox.p2.name' value='Starter Kit for Cloud'/>
        <property name='lineUp' value='true'/>
        <property name='org.eclipse.equinox.p2.type.group' value='true'/>
      </properties>
      <provides size='1'>
        <provided namespace='org.eclipse.equinox.p2.iu' name='com.ibm.cfs.product' version='2.2.0.0-20110831'/>
      </provides>
      <requires size='68'>
...
        <required namespace='org.eclipse.equinox.p2.iu' name='com.ibm.cfs.autostarter' range='[2.2.0.0-20110831,2.2.0.0-20110831]'/>


<--

If I manually remove the required autostarter elem in the profile and update the property size for the product IU, I can successfully update the autostarter IU. However our bundles.info does not retain the start level or auto-start settings as defined in our product IU. Rather the bundle now takes on the defaults as per the IUs manifest -- is this expected?

I'm not sure how the autostarter bundle was included as a required IU on the product. However we build with maven/tycho so its possible there's an issue in that space.
Comment 7 Boden CLA 2011-09-07 08:17:41 EDT
Given my last comment regarding the fact that our 'autostarter' UI is marked as required by our product IU, I believe p2 is working as designed. I'm going to resolve this bug as I think the issue is on my side -- to understand where/why the autostarter UI is set as a required UI of our product.

If someone reads this defect and believe there is p2 work it can be reopened.

Thx