This commit is contained in:
parent
cc4dafa27d
commit
bb44787334
@ -0,0 +1,59 @@
|
|||||||
|
From 1474fd57e606bdb00417524a7b648f7841b014c8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Fri, 28 Jun 2019 12:15:23 +0200
|
||||||
|
Subject: [PATCH 1/3] Prefer namespaced metadata when duplicates are found
|
||||||
|
|
||||||
|
---
|
||||||
|
.../metadata/impl/DefaultMetadataResult.java | 33 +++++++++++--------
|
||||||
|
1 file changed, 19 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
|
||||||
|
index c8b63214..67bafef5 100644
|
||||||
|
--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
|
||||||
|
+++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
|
||||||
|
@@ -94,23 +94,28 @@ class DefaultMetadataResult
|
||||||
|
}
|
||||||
|
|
||||||
|
ArtifactMetadata otherMetadata = artifactMap.get( artifact );
|
||||||
|
- if ( otherMetadata != null )
|
||||||
|
+
|
||||||
|
+ if ( otherMetadata == null )
|
||||||
|
+ {
|
||||||
|
+ artifactMap.put( artifact, metadata );
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ duplicateArtifacts.add( artifact );
|
||||||
|
+
|
||||||
|
+ if ( ignoreDuplicates )
|
||||||
|
{
|
||||||
|
- duplicateArtifacts.add( artifact );
|
||||||
|
-
|
||||||
|
- if ( ignoreDuplicates )
|
||||||
|
- {
|
||||||
|
- artifactMap.remove( artifact );
|
||||||
|
- logger.warn( "Ignoring metadata for artifact {} as it has duplicate metadata", artifact );
|
||||||
|
- continue;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- logger.warn( "Duplicate metadata for artifact {}", artifact );
|
||||||
|
- }
|
||||||
|
+ artifactMap.remove( artifact );
|
||||||
|
+ logger.warn( "Ignoring metadata for artifact {} as it has duplicate metadata", artifact );
|
||||||
|
+ continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- artifactMap.put( artifact, metadata );
|
||||||
|
+ logger.warn( "Duplicate metadata for artifact {}", artifact );
|
||||||
|
+
|
||||||
|
+ if ( otherMetadata.getNamespace().isEmpty() || !metadata.getNamespace().isEmpty() )
|
||||||
|
+ {
|
||||||
|
+ artifactMap.put( artifact, metadata );
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,81 @@
|
|||||||
|
From 4957492864d6a88a814bfd6f21798b52a4e70515 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Sat, 29 Jun 2019 14:00:13 +0200
|
||||||
|
Subject: [PATCH 2/3] Make xmvn-subst honor settings for ignoring duplicate
|
||||||
|
metadata
|
||||||
|
|
||||||
|
---
|
||||||
|
.../xmvn/tools/subst/SubstCli.java | 25 +++++++++++++------
|
||||||
|
1 file changed, 17 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/xmvn-tools/xmvn-subst/src/main/java/org/fedoraproject/xmvn/tools/subst/SubstCli.java b/xmvn-tools/xmvn-subst/src/main/java/org/fedoraproject/xmvn/tools/subst/SubstCli.java
|
||||||
|
index 423b5e61..30b1ac63 100644
|
||||||
|
--- a/xmvn-tools/xmvn-subst/src/main/java/org/fedoraproject/xmvn/tools/subst/SubstCli.java
|
||||||
|
+++ b/xmvn-tools/xmvn-subst/src/main/java/org/fedoraproject/xmvn/tools/subst/SubstCli.java
|
||||||
|
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.fedoraproject.xmvn.config.Configurator;
|
||||||
|
+import org.fedoraproject.xmvn.config.ResolverSettings;
|
||||||
|
import org.fedoraproject.xmvn.locator.ServiceLocator;
|
||||||
|
import org.fedoraproject.xmvn.locator.ServiceLocatorFactory;
|
||||||
|
import org.fedoraproject.xmvn.metadata.MetadataRequest;
|
||||||
|
@@ -34,26 +35,34 @@ import org.fedoraproject.xmvn.metadata.MetadataResult;
|
||||||
|
*/
|
||||||
|
public class SubstCli
|
||||||
|
{
|
||||||
|
- private final List<String> configuredMetadataRepos;
|
||||||
|
-
|
||||||
|
private MetadataResolver metadataResolver;
|
||||||
|
|
||||||
|
+ private ResolverSettings resolverSettings;
|
||||||
|
+
|
||||||
|
public SubstCli( Configurator configurator, MetadataResolver metadataResolver )
|
||||||
|
{
|
||||||
|
this.metadataResolver = metadataResolver;
|
||||||
|
- configuredMetadataRepos = configurator.getConfiguration().getResolverSettings().getMetadataRepositories();
|
||||||
|
+ resolverSettings = configurator.getConfiguration().getResolverSettings();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private MetadataResult resolveMetadata( List<String> repos )
|
||||||
|
+ {
|
||||||
|
+ MetadataRequest request = new MetadataRequest( repos );
|
||||||
|
+ request.setIgnoreDuplicates( resolverSettings.isIgnoreDuplicateMetadata() );
|
||||||
|
+ MetadataResult result = metadataResolver.resolveMetadata( request );
|
||||||
|
+ return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void run( SubstCliRequest cliRequest )
|
||||||
|
{
|
||||||
|
- List<MetadataResult> metadataResolvers = new ArrayList<>();
|
||||||
|
+ List<MetadataResult> metadataResults = new ArrayList<>();
|
||||||
|
|
||||||
|
if ( cliRequest.getRoot() != null )
|
||||||
|
{
|
||||||
|
List<String> metadataRepos = new ArrayList<>();
|
||||||
|
Path root = Paths.get( cliRequest.getRoot() );
|
||||||
|
|
||||||
|
- for ( String configuredRepo : configuredMetadataRepos )
|
||||||
|
+ for ( String configuredRepo : resolverSettings.getMetadataRepositories() )
|
||||||
|
{
|
||||||
|
Path repoPath = Paths.get( configuredRepo );
|
||||||
|
if ( repoPath.isAbsolute() )
|
||||||
|
@@ -62,12 +71,12 @@ public class SubstCli
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- metadataResolvers.add( metadataResolver.resolveMetadata( new MetadataRequest( metadataRepos ) ) );
|
||||||
|
+ metadataResults.add( resolveMetadata( metadataRepos ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
- metadataResolvers.add( metadataResolver.resolveMetadata( new MetadataRequest( configuredMetadataRepos ) ) );
|
||||||
|
+ metadataResults.add( resolveMetadata( resolverSettings.getMetadataRepositories() ) );
|
||||||
|
|
||||||
|
- ArtifactVisitor visitor = new ArtifactVisitor( cliRequest.isDebug(), metadataResolvers );
|
||||||
|
+ ArtifactVisitor visitor = new ArtifactVisitor( cliRequest.isDebug(), metadataResults );
|
||||||
|
|
||||||
|
visitor.setTypes( cliRequest.getTypes() );
|
||||||
|
visitor.setFollowSymlinks( cliRequest.isFollowSymlinks() );
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
115
0003-Fix-requires-generation-for-self-depending-packages.patch
Normal file
115
0003-Fix-requires-generation-for-self-depending-packages.patch
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
From a07c7079d6e7ed3f799454a827836b3ca3033e45 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
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 @@
|
||||||
|
+<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
+<metadata xmlns="http://fedorahosted.org/xmvn/METADATA/3.0.0">
|
||||||
|
+ <uuid>bfb4d47f-4bf2-49bc-bd85-1d3528e97746</uuid>
|
||||||
|
+ <artifacts>
|
||||||
|
+ <artifact>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-provider-api</artifactId>
|
||||||
|
+ <version>3.3.2</version>
|
||||||
|
+ <path>???example.jar</path>
|
||||||
|
+ </artifact>
|
||||||
|
+ <artifact>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-file</artifactId>
|
||||||
|
+ <version>3.3.2</version>
|
||||||
|
+ <path>???example.jar</path>
|
||||||
|
+ <dependencies>
|
||||||
|
+ <dependency>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-provider-api</artifactId>
|
||||||
|
+ <requestedVersion>3.3.2</requestedVersion>
|
||||||
|
+ </dependency>
|
||||||
|
+ </dependencies>
|
||||||
|
+ </artifact>
|
||||||
|
+ </artifacts>
|
||||||
|
+</metadata>
|
||||||
|
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 @@
|
||||||
|
+<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
+<metadata xmlns="http://fedorahosted.org/xmvn/METADATA/3.2.0">
|
||||||
|
+ <artifacts>
|
||||||
|
+ <artifact>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-provider-api</artifactId>
|
||||||
|
+ <version>3.3.2</version>
|
||||||
|
+ <path>src/test/resources/example.jar</path>
|
||||||
|
+ </artifact>
|
||||||
|
+ <artifact>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-file</artifactId>
|
||||||
|
+ <version>3.3.2</version>
|
||||||
|
+ <path>src/test/resources/example.jar</path>
|
||||||
|
+ <dependencies>
|
||||||
|
+ <dependency>
|
||||||
|
+ <groupId>org.apache.maven.wagon</groupId>
|
||||||
|
+ <artifactId>wagon-provider-api</artifactId>
|
||||||
|
+ <requestedVersion>3.3.2</requestedVersion>
|
||||||
|
+ </dependency>
|
||||||
|
+ </dependencies>
|
||||||
|
+ </artifact>
|
||||||
|
+ </artifacts>
|
||||||
|
+</metadata>
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-connector-aether
|
# spec file for package xmvn-connector-aether
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-connector-gradle
|
# spec file for package xmvn-connector-gradle
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-connector-ivy
|
# spec file for package xmvn-connector-ivy
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-mojo
|
# spec file for package xmvn-mojo
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-parent
|
# spec file for package xmvn-parent
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn-tools
|
# spec file for package xmvn-tools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -27,6 +27,9 @@ Group: Development/Tools/Building
|
|||||||
URL: https://fedora-java.github.io/xmvn/
|
URL: https://fedora-java.github.io/xmvn/
|
||||||
Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/%{parent}-%{version}.tar.xz
|
Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/%{parent}-%{version}.tar.xz
|
||||||
Source1: %{parent}-build.tar.xz
|
Source1: %{parent}-build.tar.xz
|
||||||
|
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: ant
|
BuildRequires: ant
|
||||||
BuildRequires: apache-commons-compress
|
BuildRequires: apache-commons-compress
|
||||||
BuildRequires: beust-jcommander
|
BuildRequires: beust-jcommander
|
||||||
@ -139,6 +142,10 @@ This package provides %{summary}.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{parent}-%{version} -a1
|
%setup -q -n %{parent}-%{version} -a1
|
||||||
|
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
|
||||||
# Bisect IT has no chances of working in local, offline mode, without
|
# Bisect IT has no chances of working in local, offline mode, without
|
||||||
# network access - it needs to access remote repositories.
|
# network access - it needs to access remote repositories.
|
||||||
find -name BisectIntegrationTest.java -delete
|
find -name BisectIntegrationTest.java -delete
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package xmvn
|
# spec file for package xmvn
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC
|
# Copyright (c) 2019 SUSE LLC.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
Loading…
Reference in New Issue
Block a user