Problems with P2 garbage collector [message #1803990] |
Thu, 14 March 2019 23:11 |
Xavipen Mising name Messages: 59 Registered: March 2011 |
Member |
|
|
I have a RAP product and I using the P2 Operations API (org.eclipse.equinox.p2.operations) to install an remove features depending on certain command line arguments.
The features are installed and removed correctly, but the plugins of a removed feature are not deleted.
After some searching I saw what i though was the answer to my question:Equinox/p2/FAQ
I try to install a feature as follows:
myRapApp -install -profileProperties org.eclipse.update.install.features=true
After the install the systemis shutdown, then restart it and uninstall the feature making sure the the p2 garbage collector is explicitly invoke. See code below:
IQueryResult<IInstallableUnit> queryResult = getInstalledIUfromID(rootIdToUninstall);
if (queryResult.isEmpty()) {
log.error("Installable unit {} is not installed.", rootIdToUninstall);
return false;
}
// --- If found, trigger an UninstallOperation ---------------
UninstallOperation uninstallOperation = new UninstallOperation(this.provisioningSession, queryResult.toSet());
IStatus result = this.performOperation(uninstallOperation);
if (!result.isOK()) {
String childStatusStr = null;
for ( IStatus children : result.getChildren()) {
childStatusStr += "\t" + children.toString() + LINE_SEP;
}
log.error("Fail to uninstall {}: {} {} {}", rootIdToUninstall, result.getMessage(), LINE_SEP, childStatusStr);
if ( result.getException() != null ) {
log.error("Uninstalling exception:", result.getException());
}
} else {
IProfileRegistry profileRegistry = (IProfileRegistry) this.provisioningAgent.getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
GarbageCollector gc = (GarbageCollector) this.provisioningAgent.getService(GarbageCollector.SERVICE_NAME);
gc.runGC(profile);
}
Unfortunately, the plugins are still there after the feature is uninstalled.
How can I made sure that I am specifying the "org.eclipse.update.install.features=true" property correctly, it seems that the -profileProperties org.eclipse.update.install.features=true is not doing the trick.
Moreover, is there a way to set this property to true by default?
Could it be that I am still missing something else?
Additionally, using tycho I have materialize a product with several features with installMode="root" and making sure that the org.eclipse.update.install.features=true is in the p2 properties. I have actually inspected the profile files to double check. Everything is there.
However when I uninstall any of the features running the code I put above to invoque explicitly the p2 garbage collector this does not delete the plugins associated to the the feature group but it does delete the feature from the feature folder.
I run out if ideas
[Updated on: Fri, 15 March 2019 00:17] Report message to a moderator
|
|
|
Re: Problems with P2 garbage collector [message #1804013 is a reply to message #1803990] |
Fri, 15 March 2019 18:18 |
Eclipse User |
|
|
|
So it's been a while since I looked at this code... Each time you perform an operation, p2 creates a new version of the profile. So I believe your UninstallOperation will create a new version of the profile, but your GC code is working against the *current version* of the profile. I think if you restructure your code to something like:
perform GC
query
if found {
uninstall
}
I suspect you will see that the features are removed on a *second* run.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03302 seconds