[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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