Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] multiple providers of the same capability

I have committed the following test case to demonstrate the SWT fragment setup:
public class SWTFragment extends AbstractProvisioningTest {
public void testFragmentPickedByCapability() {
IRequiredCapability[] reqs = createRequiredCapabilities("swt.fragment", "swt.fragment", new VersionRange("[1.0.0, 2.0.0)"), null);
IInstallableUnit swt = createIU("SWT", reqs);

MetadataFactory.InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
iud.setId("SWT.WIN32");
iud.setVersion(new Version("1.0.0"));
iud.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("swt.fragment", "swt.fragment", new Version(1, 0, 0))});
iud.setFilter("(os=win32)");
IInstallableUnit swtW = MetadataFactory.createInstallableUnit(iud);

MetadataFactory.InstallableUnitDescription iud2 = new MetadataFactory.InstallableUnitDescription();
iud.setId("SWT.LINUX");
iud.setVersion(new Version("1.0.0"));
iud.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("swt.fragment", "swt.fragment", new Version(1, 0, 0))});
iud.setFilter("(os=linux)");
IInstallableUnit swtL = MetadataFactory.createInstallableUnit(iud2);

createTestMetdataRepository(new IInstallableUnit[] {swt, swtL, swtW});
IProfile profile = "">class.getName());
IPlanner planner = createPlanner();

ProfileChangeRequest req = new ProfileChangeRequest(profile);
req.setProfileProperty("os", "win32");
req.addInstallableUnits(new IInstallableUnit[] {swt});
ProvisioningPlan plan = planner.getProvisioningPlan(req, null, null);
assertOK("plan", plan.getStatus());
Collector c = plan.getAdditions().query(new InstallableUnitQuery("SWT"), new Collector(), null);
plan.getAdditions().query(new InstallableUnitQuery("SWT.WIN32"), c, null);
assertEquals(2, c.size());
}
}

HTH
Inactive hide details for Igor Fedorenko ---04/09/2009 01:01:01 PM---This is a followup to my previous question about installinIgor Fedorenko ---04/09/2009 01:01:01 PM---This is a followup to my previous question about installing fragment bundles. I am trying to protot


From:

Igor Fedorenko <ifedorenko@xxxxxxxxxxxx>

To:

P2 developer discussions <p2-dev@xxxxxxxxxxx>

Date:

04/09/2009 01:01 PM

Subject:

Re: [p2-dev] multiple providers of the same capability




This is a followup to my previous question about installing fragment
bundles. I am trying to prototype what Pascal has suggested -- add
required org.eclipse.swt osgi.fragment capability (or any fragment,
really). Unfortunately, this breaks if I have multiple applicable
fragments in my repositories.

--
Regards,
Igor

Haigermoser, Helmut wrote:
> Ciao Igor :)
> That's work by design, if you require something and three providers are
> providing it then we consider all three provided packages equal. No
> matter which one we pick you'll always get the right one.
>
> If you try to get a specific providers' package then the best way is to
> express a different dependency, or a more strict version range such that
> it can only be true by fulfilled by your provider...
>
> (Pascal, plz. correct me if I'm wrong...)
>
> HTH,
> Ciao, hh
>
> -----Original Message-----
> From: p2-dev-bounces@xxxxxxxxxxx [
mailto:p2-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Igor Fedorenko
> Sent: Thursday, April 09, 2009 4:12 PM
> To: P2 developer discussions
> Subject: [p2-dev] multiple providers of the same capability
>
> Hello,
>
> I have an installable unit that requires capability which has multiple
> providers. Is P2 expected to resolve and install all available providers
> when I tell it to install my IU?
>
> This does not seem to be the case with P2 from 3.5M6. I tried a (split)
> java.package and osgi.fragment and in both cases P2 appears to pick one
> arbitrary provider. Example how to express such dependencies will be
> much appreciated.
>
> --
> Regards,
> Igor

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev


GIF image

GIF image


Back to the top