| Summary: | [tools] Artifact mirror application: The ”-roots” parameter does not work and always downloads the whole artifact repository. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Elena Yaneva <elena.yaneva> | ||||||
| Component: | p2 | Assignee: | P2 Inbox <equinox.p2-inbox> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||||
| Severity: | minor | ||||||||
| Priority: | P3 | CC: | david_williams, dj.houghton, irbull, jan.von.loewenstein, jeffmcaffer, katya.stoycheva, pascal | ||||||
| Version: | 3.7 | Keywords: | helpwanted | ||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows Vista | ||||||||
| Whiteboard: | stalebug | ||||||||
| Attachments: |
|
||||||||
Created attachment 187193 [details]
The removed check in getCompositeMetadataRepository()
Thanks for the patch. Applying the patch and running the tests produce several errors so I will have to determine if it is a problem with the patch or with the tests themselves. This is the first test that I am checking: org.eclipse.equinox.p2.tests.mirror.NewMirrorApplicationArtifactTest.testIgnoreErrorsArgument testIgnoreErrorsArgument(org.eclipse.equinox.p2.tests.mirror.NewMirrorApplicationArtifactTest) junit.framework.AssertionFailedError: Verifying correct number of Keys expected:<2> but was:<0> It has an interesting setup: - artifact repository A with no actual JARs - metadata repository A referring to artifact A - artifact repository B with JAR for B I think B is not being mirrored since the mirror operation is metadata-driven and we don't have any metadata for artifact B. The second test is expecting a failure because no metadata repository is specified in the test case, but since we changed the code to include all repos, we don't get the failure. junit.framework.AssertionFailedError: No exception thrown at junit.framework.Assert.fail(Assert.java:47) at org.eclipse.equinox.p2.tests.ant.MirrorTaskTest.testMirrorMetadataDestinationWithoutSource(MirrorTaskTest.java:194) I was reviewing the doc (http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/guide/p2_mirror.html) and it turns out that the -roots parameter is not meant to work since it is not supported :) At this point we are adding a new functionality, which would explain why we are seeing all the tests failures. I looked at the code and though it appears the change is done at the simplest place, I think it will impact other code paths that will cause more repositories to be loaded and also try to load repos where there is not necessarily one. A "better" patch (less impacting but more code changes) would be to change the behaviour of the mirroring app when it is run in artifact mode, and the -roots parameter is specified. Additional comments on the patch: - Make sure the code is formatted (the formatter settings are checked in the project) - Create a test case for the pb - Update the license header in the files you are changing - Update the doc (in org.eclipse.platform.doc.user and doc.isv) To be clear, if you want this to move forward, please provide a new patch :) Move all 3.8 bugs to Juno. Patch still welcome This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Created attachment 187192 [details] test repository Hello, Here is the use case: I have a repository and I want to mirror it. From the repository I want to get only an installable unit and all its dependencies, and not to download the whole repository For the purpose, 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 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 removed the check in getCompositeMetadataRepository(), everything worked perfectly and only the needed plugins were mirrored. Steps to reproduce: 1. I'm attaching a test repository. 2. Call the mirror application like that: -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source file:C:/workspace/workspace_MirrorApplication/TestMirroringRepo -destination file:C:/tmp/testRepo3 -roots FirstPlugin 3.The result is that all three plugins are downloaded: FirstPlugin, SecondPlugin and IndependantPlugin. When using the -roots param only FirstPlugin, SecondPlugin should be mirrored. The test Plugins: FirstPlugin requires SecondPlugin IndependantPlugin is not required by FirstPlugin. I'm attaching a patch as well. Best Regards, Elena