Update to upstream snapshot of 4.0.0

This commit is contained in:
Mikolaj Izdebski 2019-10-28 10:01:17 +01:00
parent 6aa5075096
commit cd269ac8a8
6 changed files with 10 additions and 267 deletions

1
.gitignore vendored
View File

@ -43,3 +43,4 @@
/xmvn-2.5.0.tar.xz
/xmvn-3.0.0.tar.xz
/xmvn-3.1.0.tar.xz
/5d1e284.tar.gz

View File

@ -1,59 +0,0 @@
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

View File

@ -1,81 +0,0 @@
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

View File

@ -1,115 +0,0 @@
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

View File

@ -1 +1 @@
SHA512 (xmvn-3.1.0.tar.xz) = 3351f00c81039cc2f856ac59562bcd6f6bcef44b86e9e1b31eec9828ee1ade227b36ef29e2a4981193e7c69e8cea07b7f9616b678ac150dfaccc688e465f7478
SHA512 (5d1e284.tar.gz) = 6f87dd21983059f41af9a6f16a48712f7f1bef146ce60530a9dea19cf2a611b09c98f7165a00585bce1441f6d7d362a9ade441069a36b5406fde7d23789f8263

View File

@ -4,18 +4,15 @@
Name: xmvn
Version: 3.1.0
Release: 2%{?dist}
Version: 4.0.0~20191027.5d1e284
Release: 1%{?dist}
Summary: Local Extensions for Apache Maven
License: ASL 2.0
URL: https://fedora-java.github.io/xmvn/
BuildArch: noarch
Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.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
#Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz
Source0: https://github.com/fedora-java/xmvn/archive/5d1e284.tar.gz
BuildRequires: maven >= 3.5.0
BuildRequires: maven-local
@ -180,10 +177,7 @@ Summary: API documentation for %{name}
This package provides %{summary}.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%setup -q -n xmvn-5d1e284e74e4315040bfd231e0a5638b9199b7e6
# Bisect IT has no chances of working in local, offline mode, without
# network access - it needs to access remote repositories.
@ -326,6 +320,9 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/
%doc LICENSE NOTICE
%changelog
* Mon Oct 28 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.0~20191027.5d1e284-1
- Update to upstream snapshot of 4.0.0
* Fri Jun 28 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.1.0-2
- Prefer namespaced metadata when duplicates are found