Dear group,
I am not sure, this is the 100% correct place to ask, but I could not find a specifig p2-users group out there, only a p2-dev group, wich looks like for the p2 folks only. If you know of such a group, please let me know.
We hope you
can help us with a problem with updating a specific feature of our product.
We have a
feature based product, built with tycho, which also fetches some features from
another repository, also build with tycho, being maintained/developed separately. This one features an update-site, providing a couple of features. So from our
product’s perspective this is a kind of “third party dependency”.
Now we want
to implement the possibility to specifically update these features in a
headless way via p2. The features are actually only a subset of the features, our product consists of.
Gathering from this example: http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application,
we managed to get the IProvisioningAgent, IMetadataRepositoryManager, ProvisioningSession
and ProvisioningJob running. Also, querying the IMetadataRepository delivers
the artifacts that should be updated with their version numbers.
The following code returns the list of installabe units:
IMetadataRepository repository = manager.loadRepository(new URI("http://artifacts/p2-language-repository-2/"), new NullProgressMonitor());
IQueryResult<IInstallableUnit> query = repository.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
Iterator<IInstallableUnit> iterator = query.iterator();
while (iterator.hasNext()) {
IInstallableUnit iu = iterator.next();
LOG.info(iu.getId() + ": " + iu.getVersion());
}
The problem
now is, that calling UpdateOperation.getPossibleUpdates() return an empty list. So
somehow it looks like the "compare logic" does not get, that these features could
be updated.
ProvisioningSession session = new ProvisioningSession(agent);
LOG.info("ProvisioningSession is " + session);
// the default update operation looks for updates to the currently
// running profile, using the default profile root marker. To change
// which installable units are being updated, use the more detailed
// constructors.
UpdateOperation operation = new UpdateOperation(session,query.toSet());
Update[] xxxx = operation.getPossibleUpdates();
LOG.error("There are "+xxxx.length+" updates");
for (Update currentUpdate : xxxx) {
LOG.error(currentUpdate.toUpdate.getId());
}
Are we on
the wrong track, trying to achieve what we intend? Are we missing something?
Any help is
greatly appreciated!
Cheers!
Markward