Fix TypeError in maven_depmap (see: rhbz#1191657)
This commit is contained in:
parent
caae28c6c6
commit
0680d41535
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,3 +65,4 @@
|
||||
/javapackages-4.3.0.tar.xz
|
||||
/javapackages-4.3.1.tar.xz
|
||||
/javapackages-4.3.2.tar.xz
|
||||
/javapackages-4.4.0.tar.xz
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
From 88865fc14c8cdd9e43b35daf056df5b9b93ba0e5 Mon Sep 17 00:00:00 2001
|
||||
From: Michal Srb <msrb@redhat.com>
|
||||
Date: Fri, 13 Feb 2015 06:48:10 +0100
|
||||
Subject: [PATCH] [maven_depmap] Open existing metadata in binary mode
|
||||
|
||||
---
|
||||
java-utils/maven_depmap.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
|
||||
index 78fe643..9094c22 100644
|
||||
--- a/java-utils/maven_depmap.py
|
||||
+++ b/java-utils/maven_depmap.py
|
||||
@@ -192,7 +192,7 @@ def write_metadata(metadata_file, artifacts):
|
||||
xml = gzip.open(metadata_file, 'rb').read()
|
||||
except IOError:
|
||||
# Not a gzipped file?
|
||||
- xml = open(metadata_file, "r").read()
|
||||
+ xml = open(metadata_file, "rb").read()
|
||||
# FIXME make proper support for multiple model versions
|
||||
xml = xml.replace(b'http://fedorahosted.org/xmvn/METADATA/2.0.0',
|
||||
b'http://fedorahosted.org/xmvn/METADATA/2.3.0')
|
||||
--
|
||||
2.1.0
|
||||
|
@ -1,85 +0,0 @@
|
||||
From 37dec7006368fc85f4cefa31d3e92f7daff3f680 Mon Sep 17 00:00:00 2001
|
||||
From: Michal Srb <msrb@redhat.com>
|
||||
Date: Wed, 7 Jan 2015 00:47:08 +0100
|
||||
Subject: [PATCH 1/3] [mvn_artifact] Fix "TypeError: process_raw_request() got
|
||||
an unexpected keyword argument 'scl'"
|
||||
|
||||
---
|
||||
java-utils/mvn_artifact.py | 12 +++++-------
|
||||
macros.d/macros.xmvn | 2 +-
|
||||
2 files changed, 6 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/java-utils/mvn_artifact.py b/java-utils/mvn_artifact.py
|
||||
index 424252b..eb27a82 100644
|
||||
--- a/java-utils/mvn_artifact.py
|
||||
+++ b/java-utils/mvn_artifact.py
|
||||
@@ -88,7 +88,7 @@ class UnknownVersion(Exception):
|
||||
pass
|
||||
|
||||
|
||||
-def get_parent_pom(pom, scl=None):
|
||||
+def get_parent_pom(pom):
|
||||
try:
|
||||
metadata = Metadata(config)
|
||||
known_artifacts = metadata.get_provided_artifacts()
|
||||
@@ -103,7 +103,7 @@ def get_parent_pom(pom, scl=None):
|
||||
|
||||
req = ResolutionRequest(pom.groupId, pom.artifactId,
|
||||
extension="pom", version=pom.version)
|
||||
- result = XMvnResolve.process_raw_request([req], scl=scl)[0]
|
||||
+ result = XMvnResolve.process_raw_request([req])[0]
|
||||
if not result:
|
||||
raise Exception("Unable to resolve parent POM")
|
||||
|
||||
@@ -169,7 +169,7 @@ def expand_props(deps, props):
|
||||
d.interpolate(props)
|
||||
|
||||
|
||||
-def gather_dependencies(pom_path, scl=None):
|
||||
+def gather_dependencies(pom_path):
|
||||
if not pom_path:
|
||||
return []
|
||||
pom = POM(pom_path)
|
||||
@@ -189,7 +189,7 @@ def gather_dependencies(pom_path, scl=None):
|
||||
except PomLoadingException:
|
||||
pass
|
||||
if not ppom:
|
||||
- ppom = get_parent_pom(parent, scl=scl)
|
||||
+ ppom = get_parent_pom(parent)
|
||||
|
||||
parent = ppom.parent
|
||||
pom_props = get_model_variables(ppom)
|
||||
@@ -246,8 +246,6 @@ if __name__ == "__main__":
|
||||
help="skip dependencies section in resulting metadata")
|
||||
parser.add_option("-D", action="append", type="str",
|
||||
help="add artifact property", metavar="property=value")
|
||||
- parser.add_option("-n", "--namespace", type="str",
|
||||
- help=SUPPRESS_HELP, default=None)
|
||||
|
||||
sys.argv = args_to_unicode(sys.argv)
|
||||
|
||||
@@ -300,7 +298,7 @@ if __name__ == "__main__":
|
||||
if (not options.skip_dependencies and pom_path
|
||||
and not is_it_ivy_file(pom_path)):
|
||||
deps = []
|
||||
- mvn_deps = gather_dependencies(pom_path, scl=options.namespace)
|
||||
+ mvn_deps = gather_dependencies(pom_path)
|
||||
for d in mvn_deps:
|
||||
deps.append(MetadataDependency.from_mvn_dependency(d))
|
||||
if deps:
|
||||
diff --git a/macros.d/macros.xmvn b/macros.d/macros.xmvn
|
||||
index 1a587fb..e7a6dda 100644
|
||||
--- a/macros.d/macros.xmvn
|
||||
+++ b/macros.d/macros.xmvn
|
||||
@@ -118,7 +118,7 @@
|
||||
#
|
||||
# Usage: %mvn_artifact <pom> [<artifact-file>]
|
||||
#
|
||||
-%mvn_artifact %{pyinterpreter} %{javadir}-utils/mvn_artifact.py %{?scl:-n %{?scl}}
|
||||
+%mvn_artifact %{pyinterpreter} %{javadir}-utils/mvn_artifact.py
|
||||
|
||||
|
||||
# %mvn_build - build Maven project
|
||||
--
|
||||
2.1.0
|
||||
|
@ -1,112 +0,0 @@
|
||||
From 6886cb1f4c0b70d83eb19c706701f83643cfd5ba Mon Sep 17 00:00:00 2001
|
||||
From: Michal Srb <msrb@redhat.com>
|
||||
Date: Wed, 14 Jan 2015 10:07:49 +0100
|
||||
Subject: [PATCH 2/3] Replace all dashes with dots in versioned provides and
|
||||
requires
|
||||
|
||||
e.g.:
|
||||
mvn(org.codehaus.plexus:plexus-interactivity-api) = 1.0-alpha-6
|
||||
will become:
|
||||
mvn(org.codehaus.plexus:plexus-interactivity-api) = 1.0.alpha.6
|
||||
|
||||
This should prevent triggering of following error:
|
||||
Error: Package: plexus-interactivity-jline-1.0-0.14.alpha6.10.fc22.noarch
|
||||
Requires: mvn(org.codehaus.plexus:plexus-interactivity-api) = 1.0-alpha-6
|
||||
Removing: plexus-interactivity-api-1.0-0.14.alpha6.9.fc22.noarch
|
||||
mvn(org.codehaus.plexus:plexus-interactivity-api) = 1.0-alpha-6
|
||||
Updated By: plexus-interactivity-api-1.0-0.14.alpha6.10.fc22.noarch
|
||||
mvn(org.codehaus.plexus:plexus-interactivity-api) = 1.0-alpha-6
|
||||
---
|
||||
python/javapackages/common/osgi.py | 30 +++++++++++++++++++-----------
|
||||
python/javapackages/common/util.py | 4 ++++
|
||||
python/javapackages/maven/printer.py | 3 +++
|
||||
3 files changed, 26 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/python/javapackages/common/osgi.py b/python/javapackages/common/osgi.py
|
||||
index 832ae72..35c4f34 100644
|
||||
--- a/python/javapackages/common/osgi.py
|
||||
+++ b/python/javapackages/common/osgi.py
|
||||
@@ -35,6 +35,21 @@
|
||||
import re
|
||||
|
||||
from javapackages.common.manifest import Manifest
|
||||
+from javapackages.common.util import sanitize_version
|
||||
+
|
||||
+
|
||||
+class OSGiUtils(object):
|
||||
+
|
||||
+ @staticmethod
|
||||
+ def get_rpm_str(bundle, version="", namespace=""):
|
||||
+ ns = namespace
|
||||
+ if version:
|
||||
+ version = sanitize_version(version)
|
||||
+ return "{ns}{d}osgi({bundle}){eq}{version}".format(ns=ns,
|
||||
+ d="-" if ns else "",
|
||||
+ bundle=bundle,
|
||||
+ eq=" = " if version else "",
|
||||
+ version=version)
|
||||
|
||||
|
||||
class OSGiRequire(object):
|
||||
@@ -75,13 +90,7 @@ class OSGiRequire(object):
|
||||
|
||||
def get_rpm_str(self, version="", namespace=""):
|
||||
ns = namespace or self.namespace
|
||||
- verstr = ""
|
||||
- if version:
|
||||
- verstr = " = {ver}".format(ver=version)
|
||||
- return "{ns}{d}osgi({bundle}){verstr}".format(ns=ns,
|
||||
- d="-" if ns else "",
|
||||
- bundle=self.bundle,
|
||||
- verstr=verstr)
|
||||
+ return OSGiUtils.get_rpm_str(self.bundle, version=version, namespace=ns)
|
||||
|
||||
|
||||
class OSGiBundle(object):
|
||||
@@ -166,7 +175,6 @@ class OSGiBundle(object):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def get_rpm_str(self, version="", namespace=""):
|
||||
- return "{ns}{d}osgi({bundle}) = {version}".format(ns=namespace or self.namespace,
|
||||
- d="-" if self.namespace else "",
|
||||
- bundle=self.bundle,
|
||||
- version=version or self.version)
|
||||
+ ver = version or self.version
|
||||
+ ns = namespace or self.namespace
|
||||
+ return OSGiUtils.get_rpm_str(self.bundle, version=ver, namespace=ns)
|
||||
diff --git a/python/javapackages/common/util.py b/python/javapackages/common/util.py
|
||||
index f893cc4..e373984 100644
|
||||
--- a/python/javapackages/common/util.py
|
||||
+++ b/python/javapackages/common/util.py
|
||||
@@ -128,3 +128,7 @@ def get_logger(name):
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
return logger
|
||||
+
|
||||
+
|
||||
+def sanitize_version(version):
|
||||
+ return version.replace("-", ".")
|
||||
diff --git a/python/javapackages/maven/printer.py b/python/javapackages/maven/printer.py
|
||||
index 095da99..4933bfc 100644
|
||||
--- a/python/javapackages/maven/printer.py
|
||||
+++ b/python/javapackages/maven/printer.py
|
||||
@@ -31,6 +31,8 @@
|
||||
#
|
||||
# Authors: Michal Srb <msrb@redhat.com>
|
||||
|
||||
+from javapackages.common.util import sanitize_version
|
||||
+
|
||||
class Printer(object):
|
||||
@staticmethod
|
||||
def get_mvn_str(gid, aid, ext="", cla="", ver=""):
|
||||
@@ -66,6 +68,7 @@ class Printer(object):
|
||||
rpmstr = "{ns}-{rpmstr}".format(ns=namespace, rpmstr=rpmstr)
|
||||
|
||||
if pkgver is not None:
|
||||
+ pkgver = sanitize_version(pkgver)
|
||||
rpmstr = "{rpmstr} = {ver}".format(rpmstr=rpmstr, ver=pkgver)
|
||||
|
||||
return rpmstr
|
||||
--
|
||||
2.1.0
|
||||
|
@ -1,37 +0,0 @@
|
||||
From aa56a70c74eae5508972c7d25d43da26fc9b071c Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Mon, 19 Jan 2015 05:46:46 +0100
|
||||
Subject: [PATCH 3/3] Add compatibility with lua 5.3.0
|
||||
|
||||
---
|
||||
depgenerators/fileattrs/maven.attr | 4 ++--
|
||||
depgenerators/fileattrs/osgi.attr | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/depgenerators/fileattrs/maven.attr b/depgenerators/fileattrs/maven.attr
|
||||
index 5bead99..2ed0971 100644
|
||||
--- a/depgenerators/fileattrs/maven.attr
|
||||
+++ b/depgenerators/fileattrs/maven.attr
|
||||
@@ -1,5 +1,5 @@
|
||||
%__maven_provides %{_rpmconfigdir}/maven.prov
|
||||
-%__maven_provides_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(posix.getprocessid("pid"))} %{?scl:--scl %{?scl}}
|
||||
+%__maven_provides_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))} %{?scl:--scl %{?scl}}
|
||||
%__maven_requires %{_rpmconfigdir}/maven.req
|
||||
-%__maven_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(posix.getprocessid("pid"))} %{?scl:--scl %{?scl}}
|
||||
+%__maven_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))} %{?scl:--scl %{?scl}}
|
||||
%__maven_path ^%{_datadir}/maven-metadata/.*
|
||||
diff --git a/depgenerators/fileattrs/osgi.attr b/depgenerators/fileattrs/osgi.attr
|
||||
index 73a8b00..b33b2e1 100644
|
||||
--- a/depgenerators/fileattrs/osgi.attr
|
||||
+++ b/depgenerators/fileattrs/osgi.attr
|
||||
@@ -1,5 +1,5 @@
|
||||
%__osgi_provides %{_rpmconfigdir}/osgi.prov
|
||||
-%__osgi_provides_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(posix.getprocessid("pid"))} %{?scl:--scl %{?scl}}
|
||||
+%__osgi_provides_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))} %{?scl:--scl %{?scl}}
|
||||
%__osgi_requires %{!?scl:%{_rpmconfigdir}/osgi.req}%{?scl:%{_root_bindir}/true}
|
||||
-%__osgi_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(posix.getprocessid("pid"))} %{?scl:--scl %{?scl}}
|
||||
+%__osgi_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))} %{?scl:--scl %{?scl}}
|
||||
%__osgi_path ^(.*\\.jar|((%{_prefix}/lib(64)?|%{_datadir})/.*/META-INF/MANIFEST.MF))$
|
||||
--
|
||||
2.1.0
|
||||
|
@ -8,20 +8,14 @@
|
||||
%endif
|
||||
|
||||
Name: javapackages-tools
|
||||
Version: 4.3.2
|
||||
Release: 6%{?dist}
|
||||
Version: 4.4.0
|
||||
Release: 0%{?dist}
|
||||
|
||||
Summary: Macros and scripts for Java packaging support
|
||||
|
||||
License: BSD
|
||||
URL: https://git.fedorahosted.org/git/javapackages.git
|
||||
Source0: https://fedorahosted.org/released/javapackages/javapackages-%{version}.tar.xz
|
||||
Patch0: 0001-mvn_artifact-Fix-TypeError-process_raw_request-got-a.patch
|
||||
Patch1: 0002-Replace-all-dashes-with-dots-in-versioned-provides-a.patch
|
||||
Patch2: 0003-Add-compatibility-with-lua-5.3.0.patch
|
||||
# XXX temporary workaround
|
||||
Patch3: 0001-Workaround-for-XMvn-version-bump-rhbz-1191657.patch
|
||||
Patch4: 0001-maven_depmap-Open-existing-metadata-in-binary-mode.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -180,12 +174,6 @@ This package provides non-essential macros and scripts to support Java packaging
|
||||
%prep
|
||||
%setup -q -n javapackages-%{version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
%if 0%{?with_python3}
|
||||
%configure --pyinterpreter=%{__python3}
|
||||
|
Loading…
Reference in New Issue
Block a user