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

Bug 323887

Summary: Prevent main feature from being un-installed
Product: [Eclipse Project] Equinox Reporter: Samuel Wu <samuelwu>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: john.arthorne, kim.moir, krzysztof.daniel, pascal, pwebster
Version: 3.6   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 340791, 345723    
Attachments:
Description Flags
patch none

Description Samuel Wu CLA 2010-08-28 14:32:46 EDT
Build Identifier: Eclipse 3.6

When a feature is chosen to be uninstalled, update manager checks whether this action would remove the main eclipse feature and doesn't allow it if it would damage the workbench.
P2 doesn't have this function. It allows any feature to be removed.

Reproducible: Always

Steps to Reproduce:
1. Start an eclipse sdk
2. Open the about dialog and installation history
3. Select the SDK and uninstall it
4. Restart when the sdk asks for it
5. The workbench can't be started any more
Comment 1 Pascal Rapicault CLA 2010-08-29 10:22:44 EDT
It is possible to mark IUs to not be uninstalled (this will only be honoured by the UI). I suspect that the SDK does not set the flag. I have opened bug #323908 because the director app does not cover for this case.
Comment 2 Pascal Rapicault CLA 2010-08-29 10:23:09 EDT
Moving to releng
Comment 3 Samuel Wu CLA 2010-08-30 08:55:32 EDT
Pascal,
Can you please advise how to set the uninstallable attribute? I have some other features which should not be uninstalled as well.
Comment 4 DJ Houghton CLA 2010-09-10 16:09:31 EDT
I think you can set the IProfile.LOCK_UNINSTALL property on the installable unit.
Comment 5 Kim Moir CLA 2010-09-13 10:23:22 EDT
DJ, should this property be set using the p2.inf that we use during the build for building the SDK?
Comment 6 DJ Houghton CLA 2010-09-13 10:25:58 EDT
Not sure... Pascal do you know?
Comment 7 Kim Moir CLA 2011-01-10 11:37:46 EST
Pascal, can you comment on the previous comment?  Do we set IProfile.LOCK_UNINSTALL using the p2.inf used in the build?
Comment 8 Pascal Rapicault CLA 2011-03-10 13:46:17 EST
Whether or not an IU should be uninstallable is not the decision of the producer of an IU but a consumer one since it really depends on the context of the application. 
For example, in some cases I want to have the SDK be marked uninstallable, and in some others I want to have the SDK and egit. 
This property needs to be set when the initial installation is created. At this point I don't know if this can be set using the director (or the installer) but we should probably look into this if it is not the case.
Comment 9 DJ Houghton CLA 2011-03-10 16:24:11 EST
First we need to investigate if we can add a new arg to the director, then we must modify the build scripts to use the new arg. Moving back to p2 until step 1 is complete.
Comment 10 Krzysztof Daniel CLA 2011-03-11 02:01:17 EST
This request is pretty similar to the bug 312254.
Comment 11 DJ Houghton CLA 2011-03-23 14:13:03 EDT
Created attachment 191777 [details]
patch

Here is a patch which adds a new argument to the director application:
   -iuProfileProperties <path>

The java.util.Properties-style file that it points to should have the format:
   <id>.<keyword>.<uniqueNum>=value

For instance the following will set the CDT feature as locked:

org.eclipse.cdt.feature.group.key.0=org.eclipse.equinox.p2.type.lock
org.eclipse.cdt.feature.group.value.0=1
Comment 12 DJ Houghton CLA 2011-03-23 14:15:54 EDT
Fix released.
Opened bug 340791 to address changes in RelEng.
Closing.