Hello,

Here is the bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334896

The thing is that the code is really there, so I was able to work around both 
the missing functionality -  a single application for metadata and artifact 
mirroring  - and the bug.

>From my code, I just created an instance of the mirror application and set the 
>source Uri, the destination Uri and the Installable units to mirror.
And if I do not set the kind to be artifact nor metadata the default is both, 
so the metadata repo is initialized and the bug is worked around.
As a bonus, the mirroring happens in just one call to the application.


Best Regards,
Elena


From: [email protected] [mailto:[email protected]] On Behalf 
Of Pascal Rapicault
Sent: Wednesday, January 19, 2011 6:04 AM
To: P2 developer discussions
Subject: Re: [p2-dev] An issue with the artifact mirror application


On 2011-01-18, at 5:16 PM, Yaneva, Elena wrote:


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.

                        Even though all the code is here, to my surprise, I 
could not find any application doing that out of the box... Contributions 
welcome :) It probably suffice to just create a new application.



  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 
theorg.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 
theorg.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.
            Given how far you went in this analysis, I would appreciate if you 
could open a bug (https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox) 
and attach a patch.


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.
            We currently provide an ant task, named p2.mirror that does what 
you are after: 
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_repositorytasks.htm
  you can also find examples of it at 
http://wiki.eclipse.org/Equinox/p2/Ant_Tasks

HTH

PaScaL



Thank you,
Elena

_______________________________________________
p2-dev mailing list
[email protected]<mailto:[email protected]>
https://dev.eclipse.org/mailman/listinfo/p2-dev

_______________________________________________
p2-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/p2-dev

Reply via email to