Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Creating InstallableUnits on the fly

IUs without artifacts are supported. This is used extensively throughout p2 testing.
I think the issue you are running into is that each IU must provide a capability with its ID and version in the IIU. NAMESPACE_IU_ID
If you look at a p2 IU in a repo, you should be able to see that.

Pascal

-----Original Message-----
From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx] On Behalf Of Krzysztof Daniel
Sent: July-03-13 6:19 AM
To: p2-dev@xxxxxxxxxxx
Subject: Re: [p2-dev] Creating InstallableUnits on the fly

So this is the code that I've got right now:

// create dropletIU, add it to the repository and to the change request InstallableUnit dropletIU = new InstallableUnit();
			dropletIU.setVersion(Version.create("1.0.0"));
dropletIU.setId(repository.getLocation().toString());
			dropletIU.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("droplet", dropletIU.getId(), dropletIU.getVersion())}); changeRequest.add(dropletIU);
repository.addInstallableUnits(Arrays.asList((IInstallableUnit)
dropletIU));


//and then, for each unit found in the repo (except droplet unit)

// each bundle should depend on a parent droplet List<IRequirement> listOfRequirements = new ArrayList<IRequirement>(iu.getMetaRequirements());
				listOfRequirements.add(MetadataFactory.createRequirement("droplet",
dropletIU.getId(), new VersionRange(dropletIU.getVersion(), true, dropletIU.getVersion(), true), null, false, true, true));

((InstallableUnit)
iu).setMetaRequiredCapabilities(listOfRequirements.toArray(new
IRequirement[] {}));

and then, the parent droplet should depend on the bundle:
req.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), new VersionRange(iu.getVersion(), true, iu.getVersion(), true), null, false, true, true)); changeRequest.add(iu);


The plan fails because of:Status ERROR: org.eclipse.equinox.p2.director
code=0 Software being installed: Ac 1.0.0.201307021158 (ac.feature.jar
1.0.0.201307021158) null
   Status ERROR: org.eclipse.equinox.p2.director code=0 Missing
requirement: file:/tmp/droplets/ac_up/ 1.0.0 requires 'file:/tmp/droplets/ac_up/ [1.0.0]' but it could not be found null
   Status ERROR: org.eclipse.equinox.p2.director code=1 Cannot satisfy
dependency: null children=[Status ERROR: org.eclipse.equinox.p2.director
code=0 From: Ac 1.0.0.201307021158 (ac.feature.jar 1.0.0.201307021158) null Status ERROR: org.eclipse.equinox.p2.director code=0 To: droplet file:/tmp/droplets/ac_up/ [1.0.0] null]

What am I doing wrong? Are installable units without artifacts supported at all?
--
Krzysztof Daniel <kdaniel@xxxxxxxxxx>
Red Hat

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


Back to the top