From 038b4e572abdbd4ef09bef30f09d931c56eb04dc Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Tue, 8 Jun 2021 20:17:56 +0200 Subject: [PATCH] Bootstrap Maven as non-modular packages Resolves: rhbz#1951482 --- .gitignore | 2 + ...nitial-PoC-of-XMvn-toolchain-manager.patch | 77 ++++++ ...d-metadata-when-duplicates-are-found.patch | 59 ---- ...honor-settings-for-ignoring-duplicat.patch | 81 ------ ...neration-for-self-depending-packages.patch | 115 -------- 0004-Honour-source-parameter.patch | 37 --- sources | 2 +- xmvn.spec | 259 +++++++++++------- 8 files changed, 238 insertions(+), 394 deletions(-) create mode 100644 0001-Initial-PoC-of-XMvn-toolchain-manager.patch delete mode 100644 0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch delete mode 100644 0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch delete mode 100644 0003-Fix-requires-generation-for-self-depending-packages.patch delete mode 100644 0004-Honour-source-parameter.patch diff --git a/.gitignore b/.gitignore index fd97208..cfc3a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ /xmvn-2.5.0.tar.xz /xmvn-3.0.0.tar.xz /xmvn-3.1.0.tar.xz +/5d1e284.tar.gz +/da67577.tar.gz diff --git a/0001-Initial-PoC-of-XMvn-toolchain-manager.patch b/0001-Initial-PoC-of-XMvn-toolchain-manager.patch new file mode 100644 index 0000000..37b1d81 --- /dev/null +++ b/0001-Initial-PoC-of-XMvn-toolchain-manager.patch @@ -0,0 +1,77 @@ +From c9362d3f23f950bb6987c63c67b06528de3ce100 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Thu, 23 Jan 2020 12:50:42 +0100 +Subject: [PATCH] Initial PoC of XMvn toolchain manager + +--- + .../aether/XMvnMavenLifecycleParticipant.java | 38 +++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java +index 0e360488..ddd6151b 100644 +--- a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java ++++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java +@@ -15,10 +15,15 @@ + */ + package org.fedoraproject.xmvn.connector.aether; + ++import java.util.Collections; ++ + import org.apache.maven.AbstractMavenLifecycleParticipant; + import org.apache.maven.MavenExecutionException; + import org.apache.maven.execution.MavenExecutionRequest; + import org.apache.maven.execution.MavenSession; ++import org.apache.maven.project.MavenProject; ++import org.apache.maven.toolchain.MisconfiguredToolchainException; ++import org.apache.maven.toolchain.ToolchainManagerPrivate; + import org.codehaus.plexus.component.annotations.Component; + import org.codehaus.plexus.component.annotations.Requirement; + import org.codehaus.plexus.logging.Logger; +@@ -42,6 +47,9 @@ public class XMvnMavenLifecycleParticipant + @Requirement( role = XMvnMojoExecutionListener.class ) + private XMvnMojoExecutionListener mojoExecutionListener; + ++ @Requirement ++ private ToolchainManagerPrivate toolchainManager; ++ + @Override + public void afterSessionStart( MavenSession session ) + throws MavenExecutionException +@@ -61,4 +69,34 @@ public class XMvnMavenLifecycleParticipant + chainedListener.addExecutionListener( reportGenerator ); + request.setExecutionListener( chainedListener ); + } ++ ++ @Override ++ public void afterProjectsRead( MavenSession session ) ++ throws MavenExecutionException ++ { ++ MavenProject currentProject = session.getCurrentProject(); ++ ++ try ++ { ++ for ( var toolchain : toolchainManager.getToolchainsForType( "jdk", session ) ) ++ { ++ if ( toolchain.matchesRequirements( Collections.singletonMap( "xmvn", "xmvn" ) ) ) ++ { ++ for ( var project : session.getAllProjects() ) ++ { ++ session.setCurrentProject( project ); ++ toolchainManager.storeToolchainToBuildContext( toolchain, session ); ++ } ++ } ++ } ++ } ++ catch ( MisconfiguredToolchainException e ) ++ { ++ throw new MavenExecutionException( "Unable to configure toolchains", e ); ++ } ++ finally ++ { ++ session.setCurrentProject( currentProject ); ++ } ++ } + } +-- +2.21.0 + diff --git a/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch b/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch deleted file mode 100644 index de58426..0000000 --- a/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 1474fd57e606bdb00417524a7b648f7841b014c8 Mon Sep 17 00:00:00 2001 -From: Mikolaj Izdebski -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 - diff --git a/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch b/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch deleted file mode 100644 index ee57d31..0000000 --- a/0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 4957492864d6a88a814bfd6f21798b52a4e70515 Mon Sep 17 00:00:00 2001 -From: Mikolaj Izdebski -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 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 repos ) -+ { -+ MetadataRequest request = new MetadataRequest( repos ); -+ request.setIgnoreDuplicates( resolverSettings.isIgnoreDuplicateMetadata() ); -+ MetadataResult result = metadataResolver.resolveMetadata( request ); -+ return result; - } - - private void run( SubstCliRequest cliRequest ) - { -- List metadataResolvers = new ArrayList<>(); -+ List metadataResults = new ArrayList<>(); - - if ( cliRequest.getRoot() != null ) - { - List 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 - diff --git a/0003-Fix-requires-generation-for-self-depending-packages.patch b/0003-Fix-requires-generation-for-self-depending-packages.patch deleted file mode 100644 index d722c09..0000000 --- a/0003-Fix-requires-generation-for-self-depending-packages.patch +++ /dev/null @@ -1,115 +0,0 @@ -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/0004-Honour-source-parameter.patch b/0004-Honour-source-parameter.patch deleted file mode 100644 index 2639357..0000000 --- a/0004-Honour-source-parameter.patch +++ /dev/null @@ -1,37 +0,0 @@ -From cc643c14f5f6d3c623e9d1afe48265be236db97a Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Thu, 9 Jul 2020 17:52:47 +0100 -Subject: [PATCH 4/4] Honour source parameter - ---- - .../main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java -index 3d6ef5e..ea18b2a 100644 ---- a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java -+++ b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java -@@ -84,6 +84,9 @@ public class JavadocMojo - @Parameter( defaultValue = "${project.build.directory}", required = true ) - private File buildDirectory; - -+ @Parameter( property = "source" ) -+ private String source; -+ - private static String quoted( Object obj ) - { - String arg = obj.toString(); -@@ -226,6 +229,10 @@ public class JavadocMojo - opts.add( quoted( docencoding ) ); - opts.add( "-doctitle" ); - opts.add( quoted( "Javadoc for package XXX" ) ); -+ if ( source != null ) { -+ opts.add( "-source" ); -+ opts.add( quoted( source ) ); -+ } - - for ( Path file : files ) - opts.add( quoted( file ) ); --- -2.26.2 - diff --git a/sources b/sources index b8c592c..99f08bf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (xmvn-3.1.0.tar.xz) = 3351f00c81039cc2f856ac59562bcd6f6bcef44b86e9e1b31eec9828ee1ade227b36ef29e2a4981193e7c69e8cea07b7f9616b678ac150dfaccc688e465f7478 +SHA512 (da67577.tar.gz) = d68cfaea21ec9d5f9ee7e70a2d40cd111c53f8d10868766b9994637a06568b3846360b10402ca93ae29b974abe354146a1a5dc9a72a90e5cc4dcfb314d31845b diff --git a/xmvn.spec b/xmvn.spec index 156b30f..5fda9f4 100644 --- a/xmvn.spec +++ b/xmvn.spec @@ -1,57 +1,73 @@ +# Workaround for rhbz#1969370: __bootstrap macro is not defined in +# CentOS Stream, See https://bugzilla.redhat.com/1969370 +%global __bootstrap ~bootstrap + +%bcond_without bootstrap + # XMvn uses OSGi environment provided by Tycho, it shouldn't require # any additional bundles. %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^osgi\\($ -# Integration tests are disabled by default, but you can run them by -# adding "--with its" to rpmbuild or mock invocation. -%bcond_with its +%if 0%{?fedora} +%bcond_without ivy +%else +%bcond_with ivy +%endif -%bcond_with gradle +%if %{with bootstrap} +%global mbi 1 +%endif Name: xmvn -Version: 3.1.0 +Version: 4.0.0~20191028.da67577 Release: 9%{?dist} Summary: Local Extensions for Apache Maven License: ASL 2.0 - URL: https://fedora-java.github.io/xmvn/ -Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz - -# Upstream bug-fix patch: -# https://github.com/fedora-java/xmvn/commit/a4d655c -Patch1: 0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch -# Upstream bug-fix patch: -# https://github.com/fedora-java/xmvn/commit/ccde1f4 -Patch2: 0002-Make-xmvn-subst-honor-settings-for-ignoring-duplicat.patch -# Downstream bug-fix patch from modular branch: -Patch3: 0003-Fix-requires-generation-for-self-depending-packages.patch -# Submitted upstream: https://github.com/fedora-java/xmvn/pull/57 -Patch4: 0004-Honour-source-parameter.patch - BuildArch: noarch -BuildRequires: maven >= 3.6.1 +#Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz +Source0: https://github.com/fedora-java/xmvn/archive/da67577.tar.gz + +Patch0: 0001-Initial-PoC-of-XMvn-toolchain-manager.patch + BuildRequires: maven-local -BuildRequires: apache-commons-compress -BuildRequires: beust-jcommander -BuildRequires: cglib -BuildRequires: maven-dependency-plugin -BuildRequires: maven-plugin-build-helper -BuildRequires: maven-assembly-plugin -BuildRequires: maven-install-plugin -BuildRequires: maven-plugin-plugin -BuildRequires: objectweb-asm -BuildRequires: modello -BuildRequires: xmlunit-assertj -BuildRequires: apache-ivy -BuildRequires: junit -BuildRequires: easymock -BuildRequires: maven-invoker -BuildRequires: plexus-containers-container-default -BuildRequires: plexus-containers-component-annotations -BuildRequires: plexus-containers-component-metadata -%if %{with gradle} -BuildRequires: gradle >= 4.4.1 +%if %{with bootstrap} +BuildRequires: javapackages-bootstrap +%else +BuildRequires: mvn(com.beust:jcommander) +BuildRequires: mvn(org.apache.commons:commons-compress) +BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations) +BuildRequires: mvn(org.apache.maven.plugins:maven-assembly-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) +BuildRequires: mvn(org.apache.maven.resolver:maven-resolver-api) +BuildRequires: mvn(org.apache.maven.resolver:maven-resolver-util) +BuildRequires: mvn(org.apache.maven:maven-artifact) +BuildRequires: mvn(org.apache.maven:maven-core) +BuildRequires: mvn(org.apache.maven:maven-model) +BuildRequires: mvn(org.apache.maven:maven-model-builder) +BuildRequires: mvn(org.apache.maven:maven-plugin-api) +BuildRequires: mvn(org.codehaus.modello:modello-maven-plugin) +BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) +BuildRequires: mvn(org.codehaus.plexus:plexus-classworlds) +BuildRequires: mvn(org.codehaus.plexus:plexus-component-annotations) +BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata) +BuildRequires: mvn(org.codehaus.plexus:plexus-container-default) +BuildRequires: mvn(org.codehaus.plexus:plexus-utils) +BuildRequires: mvn(org.easymock:easymock) +BuildRequires: mvn(org.junit.jupiter:junit-jupiter) +BuildRequires: mvn(org.ow2.asm:asm) +BuildRequires: mvn(org.slf4j:slf4j-api) +BuildRequires: mvn(org.slf4j:slf4j-simple) +BuildRequires: mvn(org.xmlunit:xmlunit-assertj) +%if %{with ivy} +BuildRequires: mvn(org.apache.ivy:ivy) +%endif +%endif + +# Used to determine location of Maven home +%if %{without bootstrap} +BuildRequires: %{_bindir}/mvn %endif Requires: %{name}-minimal = %{version}-%{release} @@ -65,7 +81,6 @@ creating RPM packages containing Maven artifacts. %package minimal Summary: Dependency-reduced version of XMvn -Requires: maven-lib >= 3.6.1 Requires: %{name}-api = %{version}-%{release} Requires: %{name}-connector-aether = %{version}-%{release} Requires: %{name}-core = %{version}-%{release} @@ -74,22 +89,21 @@ Requires: apache-commons-lang3 Requires: atinject Requires: google-guice Requires: guava -Requires: maven-lib -Requires: maven-resolver-api -Requires: maven-resolver-impl -Requires: maven-resolver-spi -Requires: maven-resolver-util -Requires: maven-wagon-provider-api +Requires: maven-resolver +Requires: maven-wagon Requires: plexus-cipher Requires: plexus-classworlds Requires: plexus-containers-component-annotations Requires: plexus-interpolation Requires: plexus-sec-dispatcher Requires: plexus-utils -Requires: sisu-inject -Requires: sisu-plexus +Requires: sisu Requires: slf4j +Requires: maven-lib >= 3.4.0 +Requires: maven-jdk-binding +Suggests: maven-openjdk11 + %description minimal This package provides minimal version of XMvn, incapable of using remote repositories. @@ -124,16 +138,7 @@ provides integration of Maven Resolver with XMvn. It provides an adapter which allows XMvn resolver to be used as Maven workspace reader. -%if %{with gradle} -%package connector-gradle -Summary: XMvn Connector for Gradle - -%description connector-gradle -This package provides XMvn Connector for Gradle, which provides -integration of Gradle with XMvn. It provides an adapter which allows -XMvn resolver to be used as Gradle resolver. -%endif - +%if %{with ivy} %package connector-ivy Summary: XMvn Connector for Apache Ivy @@ -141,6 +146,7 @@ Summary: XMvn Connector for Apache Ivy This package provides XMvn Connector for Apache Ivy, which provides integration of Apache Ivy with XMvn. It provides an adapter which allows XMvn resolver to be used as Ivy resolver. +%endif %package mojo Summary: XMvn MOJO @@ -170,16 +176,6 @@ Basically it's just an interface to artifact resolution mechanism implemented by XMvn Core. The primary intended use case of XMvn Resolver is debugging local artifact repositories. -%package bisect -Summary: XMvn Bisect -# Explicit javapackages-tools requires since scripts use -# /usr/share/java-utils/java-functions -Requires: javapackages-tools - -%description bisect -This package provides XMvn Bisect, which is a debugging tool that can -diagnose build failures by using bisection method. - %package subst Summary: XMvn Subst # Explicit javapackages-tools requires since scripts use @@ -210,12 +206,11 @@ Summary: API documentation for %{name} This package provides %{summary}. %prep -%setup -q +%setup -q -n xmvn-da67577d9252f0b1fffed546c7c23d97a97dec4b +%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 +# Port to xmlunit-assertj3 +find -name '*.java' -exec sed -i 's/org\.xmlunit\.assertj/org.xmlunit.assertj3/' {} + # Bisect IT has no chances of working in local, offline mode, without # network access - it needs to access remote repositories. @@ -229,8 +224,11 @@ find -name ResolverIntegrationTest.java -delete %mvn_package ":xmvn{,-it}" __noinstall -%if %{without gradle} +%pom_remove_dep :xmvn-bisect +%pom_disable_module xmvn-bisect xmvn-tools %pom_disable_module xmvn-connector-gradle +%if %{without ivy} +%pom_disable_module xmvn-connector-ivy %endif # Upstream code quality checks, not relevant when building RPMs @@ -248,57 +246,57 @@ find -name ResolverIntegrationTest.java -delete %pom_remove_plugin :maven-jar-plugin xmvn-tools # get mavenVersion that is expected -maven_home=$(realpath $(dirname $(realpath $(which mvn)))/..) +maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..) mver=$(sed -n '//{s/.*>\(.*\)<.*/\1/;p}' \ xmvn-parent/pom.xml) mkdir -p target/dependency/ -cp -aL ${maven_home} target/dependency/apache-maven-$mver +cp -a ${maven_home} target/dependency/apache-maven-$mver %build -%if %{with its} -%mvn_build -s -j -- -Prun-its -%else -%mvn_build -s -j -- -Dmaven.test.failure.ignore=true -%endif +%mvn_build -s -j +version=4.0.0-SNAPSHOT tar --delay-directory-restore -xvf target/*tar.bz2 -chmod -R +rwX %{name}-%{version}* +chmod -R +rwX %{name}-${version}* # These are installed as doc -rm -f %{name}-%{version}*/{AUTHORS-XMVN,README-XMVN.md,LICENSE,NOTICE,NOTICE-XMVN} +rm -f %{name}-${version}*/{AUTHORS-XMVN,README-XMVN.md,LICENSE,NOTICE,NOTICE-XMVN} # Not needed - we use JPackage launcher scripts -rm -Rf %{name}-%{version}*/lib/{installer,resolver,subst,bisect}/ +rm -Rf %{name}-${version}*/lib/{installer,resolver,subst,bisect}/ # Irrelevant Maven launcher scripts -rm -f %{name}-%{version}*/bin/* +rm -f %{name}-${version}*/bin/* %install %mvn_install -maven_home=$(realpath $(dirname $(realpath $(which mvn)))/..) +version=4.0.0-SNAPSHOT +maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..) install -d -m 755 %{buildroot}%{_datadir}/%{name} -cp -r %{name}-%{version}*/* %{buildroot}%{_datadir}/%{name}/ +cp -r%{?mbi:L} %{name}-${version}*/* %{buildroot}%{_datadir}/%{name}/ for cmd in mvn mvnDebug; do cat <%{buildroot}%{_datadir}/%{name}/bin/$cmd #!/bin/sh -e export _FEDORA_MAVEN_HOME="%{_datadir}/%{name}" -exec ${maven_home}/bin/$cmd "\${@}" +exec %{_datadir}/maven/bin/$cmd "\${@}" EOF chmod 755 %{buildroot}%{_datadir}/%{name}/bin/$cmd done # helper scripts -%jpackage_script org.fedoraproject.xmvn.tools.bisect.BisectCli "" "-Dxmvn.home=%{_datadir}/%{name}" xmvn/xmvn-bisect:beust-jcommander:maven-invoker:plexus/utils xmvn-bisect %jpackage_script org.fedoraproject.xmvn.tools.install.cli.InstallerCli "" "" xmvn/xmvn-install:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander:slf4j/api:slf4j/simple:objectweb-asm/asm:commons-compress xmvn-install %jpackage_script org.fedoraproject.xmvn.tools.resolve.ResolverCli "" "" xmvn/xmvn-resolve:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander xmvn-resolve %jpackage_script org.fedoraproject.xmvn.tools.subst.SubstCli "" "" xmvn/xmvn-subst:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander xmvn-subst -# copy over maven lib directory -cp -r ${maven_home}/lib/* %{buildroot}%{_datadir}/%{name}/lib/ +# copy over maven boot and lib directories +cp -r%{?mbi:L} ${maven_home}/boot/* %{buildroot}%{_datadir}/%{name}/boot/ +cp -r%{?mbi:L} ${maven_home}/lib/* %{buildroot}%{_datadir}/%{name}/lib/ # possibly recreate symlinks that can be automated with xmvn-subst +%if !0%{?mbi} %{name}-subst -s -R %{buildroot} %{buildroot}%{_datadir}/%{name}/ +%endif # /usr/bin/xmvn ln -s %{_datadir}/%{name}/bin/mvn %{buildroot}%{_bindir}/%{name} @@ -311,6 +309,26 @@ install -d -m 755 %{buildroot}%{_datadir}/%{name}/conf/ cp -P ${maven_home}/conf/settings.xml %{buildroot}%{_datadir}/%{name}/conf/ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ +# Make sure javapackages config is not bundled +rm -rf %{buildroot}%{_datadir}/%{name}/{configuration.xml,config.d/,conf/toolchains.xml,maven-metadata/} + +# Workaround for rpm bug 447156 - rpm fails to change directory to symlink +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/ +%pretrans -p minimal +path = "/usr/share/xmvn/conf/logging" +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) + end + os.rename(path, path .. ".rpmmoved") + end +end + %files %{_bindir}/mvn-local @@ -327,6 +345,7 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ %{_datadir}/%{name}/bin/mvnDebug %{_datadir}/%{name}/boot %{_datadir}/%{name}/conf +%ghost %{_datadir}/%{name}/conf/logging.rpmmoved %files parent-pom -f .mfiles-xmvn-parent %doc LICENSE NOTICE @@ -339,11 +358,9 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ %files connector-aether -f .mfiles-xmvn-connector-aether -%if %{with gradle} -%files connector-gradle -f .mfiles-xmvn-connector-gradle -%endif - +%if %{with ivy} %files connector-ivy -f .mfiles-xmvn-connector-ivy +%endif %files mojo -f .mfiles-xmvn-mojo @@ -352,9 +369,6 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ %files resolve -f .mfiles-xmvn-resolve %{_bindir}/%{name}-resolve -%files bisect -f .mfiles-xmvn-bisect -%{_bindir}/%{name}-bisect - %files subst -f .mfiles-xmvn-subst %{_bindir}/%{name}-subst @@ -365,8 +379,18 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ %doc LICENSE NOTICE %changelog -* Fri Apr 16 2021 Mohan Boddu - 3.1.0-9 -- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 +* Tue Jun 08 2021 Mikolaj Izdebski - 4.0.0~20191028.da67577-9 +- Bootstrap Maven for CentOS Stream 9 + +* Tue Jun 01 2021 Mikolaj Izdebski - 4.0.0~20191028.da67577-8 +- Workaround for rpm bug 447156 - rpm fails to change directory to symlink + +* Wed May 26 2021 Mikolaj Izdebski - 4.0.0~20191028.da67577-7 +- Conditionally enable Ivy connector + +* Mon May 17 2021 Mikolaj Izdebski - 4.0.0~20191028.da67577-6 +- Bootstrap build +- Non-bootstrap build * Thu Jan 28 2021 Fedora Release Engineering - 3.1.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild @@ -386,9 +410,24 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ * Thu Jun 25 2020 Alexander Kurtakov 3.1.0-3 - Ignore test failures as they fail when built Java 11. +* Mon Apr 20 2020 Mikolaj Izdebski - 4.0.0~20191028.da67577-5 +- Disable Ivy connector + +* Wed Feb 19 2020 Mikolaj Izdebski - 4.0.0~20191028.da67577-4 +- Require maven-jdk-binding + * Fri Jan 31 2020 Fedora Release Engineering - 3.1.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild +* Thu Jan 23 2020 Mikolaj Izdebski - 4.0.0~20191028.da67577-3 +- Implement toolchain manager + +* Tue Nov 05 2019 Mikolaj Izdebski - 4.0.0~20191028.da67577-2 +- Mass rebuild for javapackages-tools 201902 + +* Mon Oct 28 2019 Mikolaj Izdebski - 4.0.0~20191028.da67577-1 +- Update to upstream snapshot of 4.0.0 + * Thu Oct 17 2019 Fabio Valentini - 3.1.0-1 - Update to version 3.1.0. @@ -407,6 +446,24 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/ * Sat Jul 27 2019 Fedora Release Engineering - 3.0.0-24 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild +* Fri Jun 28 2019 Mikolaj Izdebski - 3.1.0-2 +- Prefer namespaced metadata when duplicates are found + +* Fri Jun 14 2019 Mikolaj Izdebski - 3.1.0-1 +- Update to upstream version 3.1.0 + +* Thu May 30 2019 Marian Koncek - 3.0.0-25 +- Update maven-invoker to version 3.0.1 + +* Fri May 24 2019 Mikolaj Izdebski - 3.0.0-24 +- Mass rebuild for javapackages-tools 201901 + +* Fri Apr 19 2019 Marian Koncek - 3.0.0-23 +- Port to Xmlunit 2.6.2 + +* Sat Apr 13 2019 Mikolaj Izdebski - 3.0.0-22 +- Switch to Maven 3.6.1 and non-compat Guava + * Sun Feb 03 2019 Fedora Release Engineering - 3.0.0-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild