Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] How to specify the configuration area for P2 ProvisioningAgent to locate the bundles.info

Hi All,

We use a P2 ProvisioningAgent to perform provisioning operations in our runtime. Our initial product distribution structure was similar to a generic Eclipse installation with (dropins, plugins, features, configuration and p2 directories).
Now we are looking at shipping multiple-profile installations in a single distribution using a shared p2 data area along with different configuration directories for each Profile, see the new layout at [1]. So now default the configuration directory is changed to have separate configuration directory per Profile.

AFAIU during the provisioning action, the P2 Agent updates the relevant Profile and also adds the newly installed bundles to the configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
But with the new directory layout to support multiple-profile installations, after performing a provisioning action, only the Profile is updated with the newly installed IUs. The bundles.info in the relavant configuration directory is not updated.

Is there a way to provide the osgi.configuration.area argument to the P2 Agent so that it can find the bundles.info file to update after a provisioning action?
I have also added the code-segment here on how we are performing P2 provisioning actions using P2 API [2].
Any help/pointers on this is a life-saver!

Thanks,
Dileepa

[1] new layout;

repository/components/
|--ProfileA
|    /configuration
|       |--config.ini
|       |--org.eclipse.equinox.
simpleconfigurator/bundles.info
|
|--ProfileB
|    /configuration
|       |--config.ini
|       |--org.eclipse.equinox.simpleconfigurator/bundles.info 

repository/components/p2 {shared p2 data directory for created profiles}
|--org.eclipse.equinox.p2.engine
|          |--profileRegistry
|                |---ProfileA.profile
|                |---ProfileB.profile 


[2] The Provisioning code segment;

           String P2_AGENT_LOCATION = System.getProperty("carbon.home") + File.separator + "repository" + File.separator +"components" + File.separator + "p2";
           URI agentURI = getAgentURI(P2_AGENT_LOCATION);
           provisioningAgent = provisioningAgentProvider.createAgent(agentURI);
            IPlanner planner = (IPlanner)provisioningAgent.getService(IPlanner.SERVICE_NAME);
            setPlanner(planner);
            IMetadataRepositoryManager metadataRepositoryManager =
                    (IMetadataRepositoryManager)provisioningAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
            setMetadataRepositoryManager(metadataRepositoryManager);
            IArtifactRepositoryManager artifactRepositoryManager =
                    (IArtifactRepositoryManager)provisioningAgent.getService(IArtifactRepositoryManager.SERVICE_NAME);
            setArtifactRepositoryManager(artifactRepositoryManager);
            IProfileRegistry profileRegistry = (IProfileRegistry)provisioningAgent.getService(IProfileRegistry.SERVICE_NAME);
            setProfileRegistry(profileRegistry);
            IEngine engine = (IEngine)provisioningAgent.getService(IEngine.SERVICE_NAME);
            setP2Engine(engine);
            setProvisioningContext(new ProvisioningContext(provisioningAgent));
            
             provisioningAgent.registerService(IProvisioningAgent.INSTALLER_AGENT, provisioningAgentProvider.createAgent(null)); 
             ProvisioningContext context = ServiceHolder.getProvisioningContext();
             IEngine engine = ServiceHolder.getP2Engine();
             context.setMetadataRepositories(ServiceHolder.getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL));
             context.setArtifactRepositories(ServiceHolder.getArtifactRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL));
             IStatus status = PlanExecutionHelper.executePlan(provisioningPlan, engine, context, new NullProgressMonitor());
--
Dileepa Jayakody,
Software Engineer, WSO2 Inc.
Lean . Enterprise . Middleware

Mobile : +94777-857616

Back to the top