forked from pool/javapackages-tools
This commit is contained in:
parent
0dd6cedd99
commit
3f6404f475
@ -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] 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
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 29 10:21:41 UTC 2022 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Added patch:
|
||||
* 0001-Let-maven_depmap.py-generate-metadata-with-dependenc.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,8 @@ 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
|
||||
BuildRequires: asciidoc
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: perl
|
||||
|
Loading…
x
Reference in New Issue
Block a user