From ba824f063a223ed810f0ffa2c4e31ea6e8913e93 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Mon, 1 Jul 2019 12:26:36 +0200 Subject: [PATCH] Fix requires generation for self-depending packages --- ...d-metadata-when-duplicates-are-found.patch | 2 +- ...honor-settings-for-ignoring-duplicat.patch | 2 +- ...neration-for-self-depending-packages.patch | 115 ++++++++++++++++++ xmvn.spec | 2 + 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 0003-Fix-requires-generation-for-self-depending-packages.patch diff --git a/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch b/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch index 0f808c1..de58426 100644 --- a/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch +++ b/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch @@ -1,7 +1,7 @@ From 1474fd57e606bdb00417524a7b648f7841b014c8 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Fri, 28 Jun 2019 12:15:23 +0200 -Subject: [PATCH 1/2] Prefer namespaced metadata when duplicates are found +Subject: [PATCH 1/3] Prefer namespaced metadata when duplicates are found --- .../metadata/impl/DefaultMetadataResult.java | 33 +++++++++++-------- diff --git a/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch b/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch index 94c4774..ee57d31 100644 --- a/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch +++ b/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch @@ -1,7 +1,7 @@ From 4957492864d6a88a814bfd6f21798b52a4e70515 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Sat, 29 Jun 2019 14:00:13 +0200 -Subject: [PATCH 2/2] Make xmvn-subst honor settings for ignoring duplicate +Subject: [PATCH 2/3] Make xmvn-subst honor settings for ignoring duplicate metadata --- diff --git a/0003-Fix-requires-generation-for-self-depending-packages.patch b/0003-Fix-requires-generation-for-self-depending-packages.patch new file mode 100644 index 0000000..d722c09 --- /dev/null +++ b/0003-Fix-requires-generation-for-self-depending-packages.patch @@ -0,0 +1,115 @@ +From a07c7079d6e7ed3f799454a827836b3ca3033e45 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Mon, 1 Jul 2019 12:22:04 +0200 +Subject: [PATCH 3/3] Fix requires generation for self-depending packages + +--- + .../tools/install/impl/DefaultInstaller.java | 5 ++++ + .../tools/install/impl/InstallerTest.java | 9 +++++++ + .../test/resources/self-requires-resolved.xml | 25 +++++++++++++++++++ + .../src/test/resources/self-requires.xml | 24 ++++++++++++++++++ + 4 files changed, 63 insertions(+) + create mode 100644 xmvn-tools/xmvn-install/src/test/resources/self-requires-resolved.xml + create mode 100644 xmvn-tools/xmvn-install/src/test/resources/self-requires.xml + +diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultInstaller.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultInstaller.java +index e051e823..671d79d3 100644 +--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultInstaller.java ++++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultInstaller.java +@@ -275,6 +275,11 @@ public class DefaultInstaller + dependency.setNamespace( resolvedMetadata.getNamespace() ); + return; + } ++ } ++ ++ for ( String version : Arrays.asList( dependency.getRequestedVersion(), Artifact.DEFAULT_VERSION ) ) ++ { ++ Artifact dependencyArtifact = dependency.toArtifact().setVersion( version ); + + // Next try system artifact resolver + ResolutionRequest request = new ResolutionRequest( dependencyArtifact ); +diff --git a/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/InstallerTest.java b/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/InstallerTest.java +index 48db907d..ccbbf63d 100644 +--- a/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/InstallerTest.java ++++ b/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/InstallerTest.java +@@ -204,6 +204,15 @@ public class InstallerTest + installRoot.resolve( "usr/share/maven-metadata/test-pkg.xml" ) ); + } + ++ @Test ++ public void testSelfRequires() ++ throws Exception ++ { ++ install( "self-requires.xml" ); ++ assertMetadataEqual( getResource( "self-requires-resolved.xml" ), ++ installRoot.resolve( "usr/share/maven-metadata/test-pkg.xml" ) ); ++ } ++ + @Test + public void testSubpackage() + throws Exception +diff --git a/xmvn-tools/xmvn-install/src/test/resources/self-requires-resolved.xml b/xmvn-tools/xmvn-install/src/test/resources/self-requires-resolved.xml +new file mode 100644 +index 00000000..59e8ad61 +--- /dev/null ++++ b/xmvn-tools/xmvn-install/src/test/resources/self-requires-resolved.xml +@@ -0,0 +1,25 @@ ++ ++ ++ bfb4d47f-4bf2-49bc-bd85-1d3528e97746 ++ ++ ++ org.apache.maven.wagon ++ wagon-provider-api ++ 3.3.2 ++ ???example.jar ++ ++ ++ org.apache.maven.wagon ++ wagon-file ++ 3.3.2 ++ ???example.jar ++ ++ ++ org.apache.maven.wagon ++ wagon-provider-api ++ 3.3.2 ++ ++ ++ ++ ++ +diff --git a/xmvn-tools/xmvn-install/src/test/resources/self-requires.xml b/xmvn-tools/xmvn-install/src/test/resources/self-requires.xml +new file mode 100644 +index 00000000..16a78328 +--- /dev/null ++++ b/xmvn-tools/xmvn-install/src/test/resources/self-requires.xml +@@ -0,0 +1,24 @@ ++ ++ ++ ++ ++ org.apache.maven.wagon ++ wagon-provider-api ++ 3.3.2 ++ src/test/resources/example.jar ++ ++ ++ org.apache.maven.wagon ++ wagon-file ++ 3.3.2 ++ src/test/resources/example.jar ++ ++ ++ org.apache.maven.wagon ++ wagon-provider-api ++ 3.3.2 ++ ++ ++ ++ ++ +\ No newline at end of file +-- +2.21.0 + diff --git a/xmvn.spec b/xmvn.spec index 90a7e9d..8966c6e 100644 --- a/xmvn.spec +++ b/xmvn.spec @@ -15,6 +15,7 @@ Source0: https://github.com/fedora-java/xmvn/releases/download/%{version} Patch1: 0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch Patch2: 0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch +Patch3: 0003-Fix-requires-generation-for-self-depending-packages.patch BuildRequires: maven >= 3.5.0 BuildRequires: maven-local @@ -183,6 +184,7 @@ This package provides %{summary}. %setup -q %patch1 -p1 %patch2 -p1 +%patch3 -p1 # Bisect IT has no chances of working in local, offline mode, without # network access - it needs to access remote repositories.