Accepting request 975900 from Java:packages
Added patches to generate dependencies better OBS-URL: https://build.opensuse.org/request/show/975900 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/javapackages-tools?expand=0&rev=30
This commit is contained in:
commit
57c7556d05
@ -0,0 +1,81 @@
|
||||
From d2db56cd30a48bd2ece7a5112e67c80417406a36 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Fri, 29 Apr 2022 12:08:21 +0200
|
||||
Subject: [PATCH 1/3] Let maven_depmap.py generate metadata with dependencies
|
||||
under certain circumstances
|
||||
|
||||
---
|
||||
java-utils/maven_depmap.py | 43 +++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 42 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
|
||||
index 92e0ff4c..f684a728 100644
|
||||
--- a/java-utils/maven_depmap.py
|
||||
+++ b/java-utils/maven_depmap.py
|
||||
@@ -49,6 +49,7 @@ from copy import deepcopy
|
||||
from javapackages.maven.pom import POM
|
||||
from javapackages.metadata.artifact import MetadataArtifact
|
||||
from javapackages.metadata.alias import MetadataAlias
|
||||
+from javapackages.metadata.dependency import MetadataDependency
|
||||
from javapackages.metadata.metadata import Metadata
|
||||
|
||||
from javapackages.common.exception import JavaPackagesToolsException
|
||||
@@ -132,6 +133,38 @@ def _make_files_versioned(versions, pom_path, jar_path, pom_base, jar_base):
|
||||
# return paths to versioned, but regular files (not symlinks)
|
||||
return ret_pom_path, ret_jar_path
|
||||
|
||||
+def _resolve_deps(pom):
|
||||
+ deps = []
|
||||
+ depm = []
|
||||
+ props = {}
|
||||
+
|
||||
+ deps.extend([x for x in pom.dependencies])
|
||||
+ depm.extend([x for x in pom.dependencyManagement])
|
||||
+ props = pom.properties
|
||||
+ if pom.groupId:
|
||||
+ props["project.groupId"] = pom.groupId
|
||||
+ if pom.artifactId:
|
||||
+ props["project.artifactId"] = pom.artifactId
|
||||
+ if pom.version:
|
||||
+ props["project.version"] = pom.version
|
||||
+
|
||||
+ for d in deps:
|
||||
+ d.interpolate(props)
|
||||
+
|
||||
+ for dm in depm:
|
||||
+ dm.interpolate(props)
|
||||
+
|
||||
+ # apply dependencyManagement on deps
|
||||
+ for d in deps:
|
||||
+ for dm in depm:
|
||||
+ if d.compare_to(dm):
|
||||
+ d.merge_with(dm)
|
||||
+ break
|
||||
+
|
||||
+ # only deps with scope "compile" or "runtime" are interesting
|
||||
+ deps = [x for x in deps if x.scope in ["", "compile", "runtime"]]
|
||||
+
|
||||
+ return deps
|
||||
|
||||
# Add a file to a ZIP archive (or JAR, WAR, ...) unless the file
|
||||
# already exists in the archive. Provided by Tomas Radej.
|
||||
@@ -279,7 +312,15 @@ def _main():
|
||||
if namespace:
|
||||
artifact.namespace = namespace
|
||||
|
||||
- artifact.properties["xmvn.resolver.disableEffectivePom"] = "true"
|
||||
+ pom = POM(pom_path)
|
||||
+ if pom.parent or pom.packaging == "pom":
|
||||
+ artifact.properties["xmvn.resolver.disableEffectivePom"] = "true"
|
||||
+ else:
|
||||
+ deps = []
|
||||
+ for d in _resolve_deps(pom):
|
||||
+ deps.append(MetadataDependency.from_mvn_dependency(d))
|
||||
+ if deps:
|
||||
+ artifact.dependencies = set(deps)
|
||||
|
||||
|
||||
buildroot = os.environ.get('RPM_BUILD_ROOT')
|
||||
--
|
||||
2.36.0
|
||||
|
@ -0,0 +1,29 @@
|
||||
From c0a4b557eb9a3b20c36fabe67ffac953ba78d2a5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Fri, 29 Apr 2022 13:27:10 +0200
|
||||
Subject: [PATCH 2/3] Do not try to construct POM from maven coordinate string
|
||||
|
||||
---
|
||||
java-utils/maven_depmap.py | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
|
||||
index f684a728..367632e6 100644
|
||||
--- a/java-utils/maven_depmap.py
|
||||
+++ b/java-utils/maven_depmap.py
|
||||
@@ -312,8 +312,10 @@ def _main():
|
||||
if namespace:
|
||||
artifact.namespace = namespace
|
||||
|
||||
- pom = POM(pom_path)
|
||||
- if pom.parent or pom.packaging == "pom":
|
||||
+ pom = None
|
||||
+ if have_pom:
|
||||
+ pom = POM(pom_path)
|
||||
+ if not pom or pom.parent or pom.packaging == "pom":
|
||||
artifact.properties["xmvn.resolver.disableEffectivePom"] = "true"
|
||||
else:
|
||||
deps = []
|
||||
--
|
||||
2.36.0
|
||||
|
136
0003-Fix-tests-after-the-recent-maven_depmap.py-changes.patch
Normal file
136
0003-Fix-tests-after-the-recent-maven_depmap.py-changes.patch
Normal file
@ -0,0 +1,136 @@
|
||||
From 527108b4d064417ab41da7abd70a47f58fcf91d6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Fri, 29 Apr 2022 13:27:33 +0200
|
||||
Subject: [PATCH 3/3] Fix tests after the recent maven_depmap.py changes
|
||||
|
||||
---
|
||||
test/data/maven_depmap/test_alias_extension-want.xml | 6 ------
|
||||
test/data/maven_depmap/test_basic-want.xml | 6 ------
|
||||
test/data/maven_depmap/test_buildroot-want.xml | 6 ------
|
||||
test/data/maven_depmap/test_versioned_with_pom-want.xml | 6 ------
|
||||
test/data/maven_depmap/test_war-want.xml | 6 ------
|
||||
5 files changed, 30 deletions(-)
|
||||
|
||||
diff --git a/test/data/maven_depmap/test_alias_extension-want.xml b/test/data/maven_depmap/test_alias_extension-want.xml
|
||||
index 6b0d1aee..d502fdf8 100644
|
||||
--- a/test/data/maven_depmap/test_alias_extension-want.xml
|
||||
+++ b/test/data/maven_depmap/test_alias_extension-want.xml
|
||||
@@ -13,9 +13,6 @@
|
||||
</ns1:alias>
|
||||
</ns1:aliases>
|
||||
<ns1:path>%s/usr/share/java/commons-io.jar</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
<ns1:artifact>
|
||||
<ns1:groupId>alias</ns1:groupId>
|
||||
@@ -30,9 +27,6 @@
|
||||
</ns1:alias>
|
||||
</ns1:aliases>
|
||||
<ns1:path>%s/JPP-alias.pom</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
</ns1:artifacts>
|
||||
</ns1:metadata>
|
||||
diff --git a/test/data/maven_depmap/test_basic-want.xml b/test/data/maven_depmap/test_basic-want.xml
|
||||
index 540f076a..200044bf 100644
|
||||
--- a/test/data/maven_depmap/test_basic-want.xml
|
||||
+++ b/test/data/maven_depmap/test_basic-want.xml
|
||||
@@ -6,9 +6,6 @@
|
||||
<ns1:artifactId>bndlib</ns1:artifactId>
|
||||
<ns1:version>1.50.0</ns1:version>
|
||||
<ns1:path>%s/usr/share/java/bndlib.jar</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
<ns1:artifact>
|
||||
<ns1:groupId>biz.aQute</ns1:groupId>
|
||||
@@ -16,9 +13,6 @@
|
||||
<ns1:extension>pom</ns1:extension>
|
||||
<ns1:version>1.50.0</ns1:version>
|
||||
<ns1:path>%s/JPP-bndlib.pom</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
</ns1:artifacts>
|
||||
</ns1:metadata>
|
||||
diff --git a/test/data/maven_depmap/test_buildroot-want.xml b/test/data/maven_depmap/test_buildroot-want.xml
|
||||
index 604046a5..9fa588d4 100644
|
||||
--- a/test/data/maven_depmap/test_buildroot-want.xml
|
||||
+++ b/test/data/maven_depmap/test_buildroot-want.xml
|
||||
@@ -7,9 +7,6 @@
|
||||
<ns1:version>17</ns1:version>
|
||||
<ns1:extension>war</ns1:extension>
|
||||
<ns1:path>%s/usr/share/java/commons-war.war</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
<ns1:artifact>
|
||||
<ns1:groupId>commons</ns1:groupId>
|
||||
@@ -17,9 +14,6 @@
|
||||
<ns1:version>17</ns1:version>
|
||||
<ns1:extension>pom</ns1:extension>
|
||||
<ns1:path>/usr/share/maven-poms/JPP-commons-war.pom</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
</ns1:artifacts>
|
||||
</ns1:metadata>
|
||||
diff --git a/test/data/maven_depmap/test_versioned_with_pom-want.xml b/test/data/maven_depmap/test_versioned_with_pom-want.xml
|
||||
index c2b344e1..8d259ab9 100644
|
||||
--- a/test/data/maven_depmap/test_versioned_with_pom-want.xml
|
||||
+++ b/test/data/maven_depmap/test_versioned_with_pom-want.xml
|
||||
@@ -9,9 +9,6 @@
|
||||
<ns1:version>2013.10</ns1:version>
|
||||
</ns1:compatVersions>
|
||||
<ns1:path>%s/usr/share/java/testversioned-2013.10.jar</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
<ns1:artifact>
|
||||
<ns1:groupId>alias</ns1:groupId>
|
||||
@@ -22,9 +19,6 @@
|
||||
<ns1:version>2013.10</ns1:version>
|
||||
</ns1:compatVersions>
|
||||
<ns1:path>%s/JPP-testversioned-2013.10.pom</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
</ns1:artifacts>
|
||||
</ns1:metadata>
|
||||
diff --git a/test/data/maven_depmap/test_war-want.xml b/test/data/maven_depmap/test_war-want.xml
|
||||
index cac27a84..e8e2e56b 100644
|
||||
--- a/test/data/maven_depmap/test_war-want.xml
|
||||
+++ b/test/data/maven_depmap/test_war-want.xml
|
||||
@@ -7,9 +7,6 @@
|
||||
<ns1:version>17</ns1:version>
|
||||
<ns1:extension>war</ns1:extension>
|
||||
<ns1:path>%s/usr/share/java/commons-war.war</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
<ns1:artifact>
|
||||
<ns1:groupId>commons</ns1:groupId>
|
||||
@@ -17,9 +14,6 @@
|
||||
<ns1:extension>pom</ns1:extension>
|
||||
<ns1:version>17</ns1:version>
|
||||
<ns1:path>%s/JPP-commons-war.pom</ns1:path>
|
||||
- <ns1:properties>
|
||||
- <xmvn.resolver.disableEffectivePom>true</xmvn.resolver.disableEffectivePom>
|
||||
- </ns1:properties>
|
||||
</ns1:artifact>
|
||||
</ns1:artifacts>
|
||||
</ns1:metadata>
|
||||
--
|
||||
2.36.0
|
||||
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 29 10:21:41 UTC 2022 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Added patches:
|
||||
* 0001-Let-maven_depmap.py-generate-metadata-with-dependenc.patch
|
||||
* 0002-Do-not-try-to-construct-POM-from-maven-coordinate-st.patch
|
||||
* 0003-Fix-tests-after-the-recent-maven_depmap.py-changes.patch
|
||||
+ Let maven_depmap.py generate metadata with dependencies under
|
||||
certain circumstances
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 30 11:49:00 UTC 2021 - David Anes <david.anes@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -45,6 +45,10 @@ Patch1: python-optional.patch
|
||||
#PATCH-FIX-SUSE: SUSE did not bump epoch of openjdk packages, whereas Fedora did
|
||||
# Avoid generating unresolvable requires
|
||||
Patch2: suse-no-epoch.patch
|
||||
#PATCH-FIX-SUSE: Let maven_depmap.py generate metadata with dependencies under certain circumstances
|
||||
Patch3: 0001-Let-maven_depmap.py-generate-metadata-with-dependenc.patch
|
||||
Patch4: 0002-Do-not-try-to-construct-POM-from-maven-coordinate-st.patch
|
||||
Patch5: 0003-Fix-tests-after-the-recent-maven_depmap.py-changes.patch
|
||||
BuildRequires: asciidoc
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: perl
|
||||
|
Loading…
Reference in New Issue
Block a user