Replace all dashes with dots in versioned provides and requires

This commit is contained in:
Mikolaj Izdebski 2015-01-15 07:51:53 +01:00
parent 6f229910fd
commit 7cf7997344
3 changed files with 122 additions and 5 deletions

View File

@ -1,8 +1,8 @@
From 20e013184330fa3b02340266dbe46d2660298978 Mon Sep 17 00:00:00 2001
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] [mvn_artifact] Fix "TypeError: process_raw_request() got an
unexpected keyword argument 'scl'"
Subject: [PATCH 1/2] [mvn_artifact] Fix "TypeError: process_raw_request() got
an unexpected keyword argument 'scl'"
---
java-utils/mvn_artifact.py | 12 +++++-------
@ -10,7 +10,7 @@ Subject: [PATCH] [mvn_artifact] Fix "TypeError: process_raw_request() got an
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/java-utils/mvn_artifact.py b/java-utils/mvn_artifact.py
index 0bd97e0..52d6dac 100644
index 424252b..eb27a82 100644
--- a/java-utils/mvn_artifact.py
+++ b/java-utils/mvn_artifact.py
@@ -88,7 +88,7 @@ class UnknownVersion(Exception):

View File

@ -0,0 +1,112 @@
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/2] 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

View File

@ -7,7 +7,7 @@
Name: javapackages-tools
Version: 4.3.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Macros and scripts for Java packaging support
@ -15,6 +15,7 @@ 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
BuildArch: noarch
@ -162,6 +163,7 @@ This package provides non-essential macros and scripts to support Java packaging
%setup -q -n javapackages-%{version}
%patch0 -p1
%patch1 -p1
%build
%if 0%{?with_python3}
@ -212,6 +214,9 @@ popd
%doc LICENSE
%changelog
* Thu Jan 15 2015 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.3.2-2
- Replace all dashes with dots in versioned provides and requires
* Mon Jan 05 2015 Michal Srb <msrb@redhat.com> - 4.3.2-1
- Update to upstream version 4.3.2
- Fix TypeError in mvn_artifact