Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] An issue with the artifact mirror application

Hello,
 
I have a few questions regarding the mirror application:
 
My use-case:
I have a repository and I want to mirror it. And from the repository I want  to get only an installable unit and all its dependencies, and not to download  the whole repository.
 
And the questions:
  1. Is there a way to mirror both the artifact and metadata repository in one iteration or you have to call the artifact and metadata application one after the other like that:
Metadata:
-application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source file:C:/workspace/workspace_MirrorApplication/TestMirroringRepo
-destination file:C:/tmp/testRepo3 -roots FirstPlugin
Artifact:
-application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source file:C:/workspace/workspace_MirrorApplication/TestMirroringRepo
-destination file:C:/tmp/testRepo3 -roots FirstPlugin
 
If I have to call them twice, there is a lot of duplicate tasks performed like the dependencies resolution and repositories loading.
 
  2.  I’m using  the “-roots”  parameter as an argument, in order to call the dependency resolution mechanism in the mirror application and to download only the root and all its dependencies.
The metadata mirroring works perfectly. However, in the artifact mirror case I found an issue:
 
The bug:
The ”-roots” parameter does not work and always downloads the whole artifact repository.
 
I debugged the case and the problem is that in the org.eclipse.equinox.p2.internal.repository.tools.MirrorApplication.initializeIUs() method, the queryResult variable does not get populated with correct result. It should return, in the example case, installable unit “FirstPlugin” with the version it found in the metadata repository.
 
The root cause:
And the root cause is that the metadata repository is not initialized.
The source repository (the one we want to mirror from) is not added as a child to the compositeMetadataRepository, because of a check.
The check is:
If medatada application: the source repository is added only to the compositeMetadataRepository
If artifact application: the source repository is added only to the compositeArtifactRepository
This is done in the getCompositeMetadataRepository() method of the org.eclipse.equinox.p2.internal.repository.tool.AbstractApplication class.
 
Actually, the metadata repository has to be added in both cases, because the metadata is needed for the dependency resolution.
When I changed the check in the artifact case, everything worked perfectly and only the needed plugins were mirrored.
 
Is there a better way to solve my use-case? Maybe a Mirror Ant Task or another application – in the code of the MirrorApplication there are comments about old and new application?
It would be great if there was only one application that does both tasks – metadata and artifact mirroring.
 
Thank you,
Elena 
 

Back to the top