Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
javapackages-tools.28016
0001-Let-maven_depmap.py-generate-metadata-with...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Let-maven_depmap.py-generate-metadata-with-dependenc.patch of Package javapackages-tools.28016
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor