Hello community,

here is the log from the commit of package rust-packaging for openSUSE:Factory 
checked in at 2019-12-05 17:33:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rust-packaging (Old)
 and      /work/SRC/openSUSE:Factory/.rust-packaging.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rust-packaging"

Thu Dec  5 17:33:46 2019 rev:8 rq:754086 version:11

Changes:
--------
--- /work/SRC/openSUSE:Factory/rust-packaging/rust-packaging.changes    
2019-10-31 22:26:08.472388226 +0100
+++ /work/SRC/openSUSE:Factory/.rust-packaging.new.4691/rust-packaging.changes  
2019-12-05 17:33:48.217452727 +0100
@@ -1,0 +2,18 @@
+Wed Dec  4 15:06:39 UTC 2019 - Igor Gnatenko <[email protected]>
+
+- Remove downstream patches
+  + 0001-Ignore-Cargo.lock.patch
+  + 0001-macros-Remove-Cargo.toml.orig.patch
+  + 0001-metadata-normalize-version-via-CargoSemVer.patch
+  + 0001-metadata-replace-semantic-version-with-a-custom-pars.patch
+- Update to 11
+  + When dynamic BuildRequires are turned on, propagate arguments to %cargo_*
+  + Few improvements in algorithm of description splitting into a summary
+  + Ignore Cargo.lock for installation (publish lockfile feature in Cargo 
1.37+)
+  + Replace semantic_version dependency by custom parser
+  + Add MPL-2.0-or-later and 0BSD into a Fedora SPDX mapping
+  + Pass --cap-lints=warn into the RUSTFLAGS to prevent FTBFS after
+    dependency and/or compiler updates
+  + Enable dynamic BuildRequires by default for Fedora target
+
+-------------------------------------------------------------------
--- /work/SRC/openSUSE:Factory/rust-packaging/rust-srpm-macros.changes  
2019-08-30 14:41:42.105419128 +0200
+++ 
/work/SRC/openSUSE:Factory/.rust-packaging.new.4691/rust-srpm-macros.changes    
    2019-12-05 17:33:48.269452719 +0100
@@ -1,0 +2,5 @@
+Wed Dec  4 15:06:39 UTC 2019 - Igor Gnatenko <[email protected]>
+
+- Update to 11
+
+-------------------------------------------------------------------

Old:
----
  0001-Ignore-Cargo.lock.patch
  0001-macros-Remove-Cargo.toml.orig.patch
  0001-metadata-normalize-version-via-CargoSemVer.patch
  0001-metadata-replace-semantic-version-with-a-custom-pars.patch
  rust2rpm-10.tar.xz

New:
----
  rust2rpm-11.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rust-packaging.spec ++++++
--- /var/tmp/diff_new_pack.gqg2Ty/_old  2019-12-05 17:33:48.913452628 +0100
+++ /var/tmp/diff_new_pack.gqg2Ty/_new  2019-12-05 17:33:48.913452628 +0100
@@ -22,21 +22,13 @@
 %bcond_without check
 
 Name:           rust-packaging
-Version:        10
+Version:        11
 Release:        0
 Summary:        RPM macros for building Rust packages on various architectures
 License:        MIT
 Group:          Development/Languages/Rust
 URL:            https://pagure.io/fedora-rust/rust2rpm
 Source0:        
https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz
-# PATCH-FIX-OPENSUSE 0001-macros-Remove-Cargo.toml.orig.patch -- Remove 
Cargo.toml.orig
-Patch0001:      0001-macros-Remove-Cargo.toml.orig.patch
-# PATCH-FIX-UPSTREAM 0001-Ignore-Cargo.lock.patch -- 
https://pagure.io/fedora-rust/rust2rpm/c/b5e2db003fe02d689d9e724a1d649d2c6d2919dd?branch=master
-Patch0002:      0001-Ignore-Cargo.lock.patch
-# PATCH-FIX-UPSTREAM 
0001-metadata-replace-semantic-version-with-a-custom-pars.patch -- 
https://pagure.io/fedora-rust/rust2rpm/c/fcbf95a78efdb310f918363e69706e1a98d93a9f
-Patch0003:      0001-metadata-replace-semantic-version-with-a-custom-pars.patch
-# PATCH-FIX-UPSTREAM 0001-metadata-normalize-version-via-CargoSemVer.patch -- 
https://pagure.io/fedora-rust/rust2rpm/c/23e807d8ce571da4500f66075e08bfa412177972
-Patch0004:      0001-metadata-normalize-version-via-CargoSemVer.patch
 BuildArch:      noarch
 ExclusiveArch:  %{rust_arches} noarch
 

++++++ rust-srpm-macros.spec ++++++
--- /var/tmp/diff_new_pack.gqg2Ty/_old  2019-12-05 17:33:48.937452625 +0100
+++ /var/tmp/diff_new_pack.gqg2Ty/_new  2019-12-05 17:33:48.937452625 +0100
@@ -20,7 +20,7 @@
 
 
 Name:           rust-srpm-macros
-Version:        10
+Version:        11
 Release:        0
 Summary:        RPM macros for building Rust source packages
 License:        MIT

++++++ rust2rpm-10.tar.xz -> rust2rpm-11.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/data/macros.cargo 
new/rust2rpm-11/data/macros.cargo
--- old/rust2rpm-10/data/macros.cargo   2019-06-16 17:14:52.000000000 +0200
+++ new/rust2rpm-11/data/macros.cargo   2019-12-04 07:56:50.000000000 +0100
@@ -90,7 +90,7 @@
 # so that cargo doesn't fail resolving dependencies:                \
 # https://github.com/rust-lang/cargo/pull/6729                      \
   %{__awk} -i inplace -v INPLACE_SUFFIX=.deps 
'/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; 
!f' Cargo.toml \
-  %{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \
+  %{__cargo} package -l | grep -w -v Cargo.lock | xargs -d '\\\n' %{__cp} 
--parents -a -t $REG_DIR \
   %{__mv} Cargo.toml{.deps,}                                        \
   %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml                         \
   %{__rm} -f $REG_DIR/Cargo.toml.{orig,deps}                        \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/data/macros.rust 
new/rust2rpm-11/data/macros.rust
--- old/rust2rpm-10/data/macros.rust    2019-06-16 17:14:52.000000000 +0200
+++ new/rust2rpm-11/data/macros.rust    2019-12-04 07:56:50.000000000 +0100
@@ -7,6 +7,7 @@
   -Cdebuginfo=2
   -Clink-arg=-Wl,-z,relro,-z,now
   -Ccodegen-units=1
+  --cap-lints=warn
 }
 
 %__global_rustflags %{build_rustflags}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/requirements.txt 
new/rust2rpm-11/requirements.txt
--- old/rust2rpm-10/requirements.txt    2019-06-16 17:14:52.000000000 +0200
+++ new/rust2rpm-11/requirements.txt    2019-12-04 07:56:50.000000000 +0100
@@ -1,4 +1,3 @@
 jinja2
 requests
-semantic_version
 tqdm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/rust2rpm/__init__.py 
new/rust2rpm-11/rust2rpm/__init__.py
--- old/rust2rpm-10/rust2rpm/__init__.py        2019-06-16 17:14:52.000000000 
+0200
+++ new/rust2rpm-11/rust2rpm/__init__.py        2019-12-04 07:56:50.000000000 
+0100
@@ -1,4 +1,4 @@
 from .metadata import *
 from . import licensing
 
-__version__ = '10'
+__version__ = '11'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/rust2rpm/__main__.py 
new/rust2rpm-11/rust2rpm/__main__.py
--- old/rust2rpm-10/rust2rpm/__main__.py        2019-06-16 17:14:52.000000000 
+0200
+++ new/rust2rpm-11/rust2rpm/__main__.py        2019-12-04 07:56:50.000000000 
+0100
@@ -239,6 +239,8 @@
                         help="Activate all available features")
     parser.add_argument("--dynamic-buildrequires", action="store_true",
                         help="Use dynamic BuildRequires feature")
+    parser.add_argument("--no-dynamic-buildrequires", action="store_true",
+                        help="Do not use dynamic BuildRequires feature")
     parser.add_argument("--suffix", action="store",
                         help="Package suffix")
     parser.add_argument("crate", help="crates.io name\n"
@@ -319,6 +321,9 @@
     else:
         kwargs["pkg_release"] = "1%{?dist}"
 
+    if args.target == "fedora" and not args.no_dynamic_buildrequires:
+        args.dynamic_buildrequires = True
+
     kwargs["generate_buildrequires"] = args.dynamic_buildrequires
 
     if args.target in {"opensuse", "fedora"}:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/rust2rpm/metadata.py 
new/rust2rpm-11/rust2rpm/metadata.py
--- old/rust2rpm-10/rust2rpm/metadata.py        2019-06-16 17:14:52.000000000 
+0200
+++ new/rust2rpm-11/rust2rpm/metadata.py        2019-12-04 07:56:50.000000000 
+0100
@@ -6,7 +6,162 @@
 import re
 import subprocess
 
-import semantic_version as semver
+
+Requirement = collections.namedtuple('Requirement', ('kind',
+                                                     'version'))
+
+
+Version = collections.namedtuple('Version', ('major', 'minor',
+                                             'patch', 'pre_release',
+                                             'build'))
+
+
+class CargoSemVer:
+    """Cargo semantic versioning parser"""
+    KIND_ANY = '*'
+    KIND_LT = '<'
+    KIND_LTE = '<='
+    KIND_SHORTEQ = '='
+    KIND_EQUAL = '=='
+    KIND_EMPTY = ''
+    KIND_GTE = '>='
+    KIND_GT = '>'
+    KIND_NEQ = '!='
+    KIND_CARET = '^'
+    KIND_TILDE = '~'
+    KIND_COMPATIBLE = '~='
+
+    def __init__(self, requirement):
+        requirements = requirement.replace(' ', '').split(',')
+        self.requirements = [self.parse(i) for i in requirements]
+        self.normalized = [j for i in self.requirements
+                           for j in self.normalize(i)]
+
+    @staticmethod
+    def parse(requirement):
+        if not requirement:
+            raise ValueError(f'Invalid empty requirement '
+                             f'specification: {requirement}')
+
+        match = re.match(
+            r'^(?:([\d.]*\*))$|^(?:(<|<=|=|==|>=|>||!=|\^|~|~=)(\d.*))$',
+            requirement)
+        if not match:
+            raise ValueError(f'Invalid requirement '
+                             f'specification: {requirement}')
+
+        wildcard, kind, version = match.groups()
+        if wildcard:
+            version = wildcard.replace('.*', '').replace('*', '')
+            kind = CargoSemVer.KIND_ANY
+        return Requirement(kind, CargoSemVer.parse_version(version))
+
+    @staticmethod
+    def parse_version(version):
+        match = re.match(
+            r'^(\d+)?(?:\.(\d+))?(?:\.(\d+))?(?:-([\w.-]+))?(?:\+([\w.-]+))?$',
+            version)
+        if not match:
+            raise ValueError(f'Invalid version string: {version}')
+
+        major, minor, patch, pre_release, build = match.groups()
+        major = int(major) if major else major
+        minor = int(minor) if minor else minor
+        patch = int(patch) if patch else patch
+        return Version(major, minor, patch, pre_release, build)
+
+    @staticmethod
+    def unparse_version(version, sep='-'):
+        version_str = f'{version.major}.{version.minor or 0}' \
+            f'.{version.patch or 0}'
+        if version.pre_release:
+            version_str = f'{version_str}{sep}{version.pre_release}'
+        if version.build:
+            version_str = f'{version_str}+{version.build}'
+        return version_str
+
+    @staticmethod
+    def coerce(version):
+        return Version(version.major or 0,
+                       version.minor or 0,
+                       version.patch or 0,
+                       version.pre_release,
+                       version.build)
+
+    @staticmethod
+    def next_major(version):
+        major, minor, patch, pre_release, _ = version
+        if pre_release and not minor and not patch:
+            return Version(major, minor or 0, patch or 0, None, None)
+        return Version((major or 0) + 1, 0, 0, None, None)
+
+    @staticmethod
+    def next_minor(version):
+        major, minor, patch, pre_release, _ = version
+        if pre_release and not patch:
+            return Version(major, minor or 0, patch or 0, None, None)
+        return Version(major, (minor or 0) + 1, 0, None, None)
+
+    @staticmethod
+    def next_patch(version):
+        major, minor, patch, pre_release, _ = version
+        if pre_release:
+            return Version(major, minor or 0, patch or 0, None, None)
+        return Version(major, minor or 0, (patch or 0) + 1, None, None)
+
+    @staticmethod
+    def normalize(requirement):
+        normalized = []
+        kind, version = requirement
+        if kind == CargoSemVer.KIND_NEQ:
+            raise ValueError(f'Kind not supported: {requirement}')
+
+        if kind == CargoSemVer.KIND_EQUAL:
+            kind = CargoSemVer.KIND_SHORTEQ
+
+        coerced_version = CargoSemVer.coerce(version)
+        if version.pre_release:
+            version = CargoSemVer.next_patch(version)
+
+        if kind == CargoSemVer.KIND_ANY:
+            normalized.append((CargoSemVer.KIND_GTE,
+                               CargoSemVer.coerce(version)))
+            if version.major:
+                if version.minor is not None:
+                    upper_version = CargoSemVer.next_minor(version)
+                else:
+                    upper_version = CargoSemVer.next_major(version)
+                normalized.append((CargoSemVer.KIND_LT, upper_version))
+        elif kind in (CargoSemVer.KIND_SHORTEQ,
+                      CargoSemVer.KIND_GT, CargoSemVer.KIND_GTE,
+                      CargoSemVer.KIND_LT, CargoSemVer.KIND_LTE):
+            normalized.append((kind, coerced_version))
+        elif kind in (CargoSemVer.KIND_CARET,
+                      CargoSemVer.KIND_COMPATIBLE,
+                      CargoSemVer.KIND_EMPTY):
+            if version.major == 0:
+                if version.minor is not None:
+                    if version.minor != 0 or version.patch is None:
+                        upper_version = CargoSemVer.next_minor(version)
+                    else:
+                        upper_version = CargoSemVer.next_patch(version)
+                else:
+                    upper_version = CargoSemVer.next_major(version)
+            else:
+                upper_version = CargoSemVer.next_major(version)
+            normalized.append((CargoSemVer.KIND_GTE, coerced_version))
+            normalized.append((CargoSemVer.KIND_LT, upper_version))
+        elif kind == CargoSemVer.KIND_TILDE:
+            if version.minor is None:
+                upper_version = CargoSemVer.next_major(version)
+            else:
+                upper_version = CargoSemVer.next_minor(version)
+            normalized.append((CargoSemVer.KIND_GTE, coerced_version))
+            normalized.append((CargoSemVer.KIND_LT, upper_version))
+        else:
+            raise ValueError(f'Found unhandled kind: {requirement}')
+        return normalized
+
 
 class Target:
     def __init__(self, name, kind):
@@ -16,6 +171,7 @@
     def __repr__(self):
         return f"<Target {self.name} ({self.kind})>"
 
+
 class Dependency:
     def __init__(self, name, req=None, features=(), optional=False):
         self.name = name
@@ -35,69 +191,22 @@
         return cls(**kwargs)
 
     @staticmethod
-    def _normalize_req(req):
-        if "*" in req and req != "*":
-            raise NotImplementedError(f"'*' is not supported: {req}")
-        spec = semver.Spec(req.replace(" ", ""))
-        reqs = []
-        for req in spec.specs:
-            if req.kind == req.KIND_ANY:
-                # Any means any
-                continue
-            ver = req.spec
-            if req.kind in {req.KIND_NEQ, req.KIND_EMPTY}:
-                raise NotImplementedError(f"'!=' and empty kinds are not 
supported: {req}")
-            coerced = str(semver.Version.coerce(str(ver)))
-            if ver.prerelease:
-                coerced = coerced.replace("-", "~")
-                # This will advance us to closest stable version (2.0.0-beta.6 
→ 2.0.0)
-                ver = ver.next_patch()
-            if req.kind == req.KIND_EQUAL:
-                req.kind = req.KIND_SHORTEQ
-            if req.kind in {req.KIND_CARET, req.KIND_COMPATIBLE}:
-                if ver.major == 0:
-                    if ver.minor is not None:
-                        if ver.minor != 0 or ver.patch is None:
-                            upper = ver.next_minor()
-                        else:
-                            upper = ver.next_patch()
-                    else:
-                        upper = ver.next_major()
-                else:
-                    upper = ver.next_major()
-                reqs.append((">=", coerced))
-                reqs.append(("<", upper))
-            elif req.kind == req.KIND_TILDE:
-                if ver.minor is None:
-                    upper = ver.next_major()
-                else:
-                    upper = ver.next_minor()
-                reqs.append((">=", coerced))
-                reqs.append(("<", upper))
-            elif req.kind in {req.KIND_SHORTEQ,
-                              req.KIND_GT,
-                              req.KIND_GTE,
-                              req.KIND_LT,
-                              req.KIND_LTE}:
-                reqs.append((str(req.kind), coerced))
-            else:
-                raise AssertionError(f"Found unhandled kind: {req.kind}")
-        return reqs
-
-    @staticmethod
     def _apply_reqs(name, reqs, feature=None):
         fstr = f"/{feature}" if feature is not None else ""
         cap = f"crate({name}{fstr})"
         if not reqs:
             return cap
-        deps = " with ".join(f"{cap} {op} {version}" for op, version in reqs)
+        deps = ' with '.join(
+            f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}'
+            for op, version in reqs)
         if len(reqs) > 1:
             return f"({deps})"
         else:
             return deps
 
     def normalize(self):
-        return [self._apply_reqs(self.name, self._normalize_req(self.req), 
feature)
+        semver = CargoSemVer(self.req)
+        return [self._apply_reqs(self.name, semver.normalized, feature)
                 for feature in self.features or (None,)]
 
     def __repr__(self):
@@ -106,14 +215,15 @@
     def __str__(self):
         return "\n".join(self.normalize())
 
+
 class Metadata:
     def __init__(self, name, version):
         self.name = name
         self._version = version
-        version_normalized = Dependency._normalize_req(f"={self._version}")
-        if len(version_normalized) != 1:
-            raise Exception(f"Incorrect version: {self._version}")
-        self.version = version_normalized[0][1]
+        version_normalized = CargoSemVer.unparse_version(
+            CargoSemVer.coerce(
+                CargoSemVer.parse_version(self._version)))
+        self.version = version_normalized
         self.license = None
         self.license_file = None
         self.readme = None
@@ -146,6 +256,14 @@
             description = f'{description}.'
 
         p1 = description.find('.')
+        p2 = description.find('.\n')
+        if p2 != -1:
+            p1 = max(p1, p2)
+        else:
+            p1 = len(description) - 1
+        p2 = description.find('. ')
+        if p2 != -1:
+            p1 = min(p1, p2)
         p2 = description.find('\n')
         if p2 != -1:
             p = min(p1, p2)
@@ -250,5 +368,6 @@
                         for feature in features)
             return fdeps | deps
 
+
 def normalize_deps(deps):
     return set().union(*(d.normalize() for d in deps))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/rust2rpm/spdx_to_fedora.csv 
new/rust2rpm-11/rust2rpm/spdx_to_fedora.csv
--- old/rust2rpm-10/rust2rpm/spdx_to_fedora.csv 2019-06-16 17:14:52.000000000 
+0200
+++ new/rust2rpm-11/rust2rpm/spdx_to_fedora.csv 2019-12-04 07:56:50.000000000 
+0100
@@ -42,6 +42,7 @@
 BitTorrent Open Source License v1.1,BitTorrent-1.1,BitTorrent,BitTorrent 
License,,
 Boost Software License 1.0,BSL-1.0,Boost,Boost Software License,,
 Borceux license,Borceux,Borceux,,,
+BSD-2-Clause Plus Patent License,BSD-2-Clause-Patent,BSD-2-Clause-Patent,BSD + 
Patent,,
 "BSD 2-clause ""Simplified"" License",BSD-2-Clause,BSD,BSD License (two 
clause),,Cryptix General License
 BSD 2-clause FreeBSD License,BSD-2-Clause-FreeBSD,,,not on Fedora list,
 BSD 2-clause NetBSD License,BSD-2-Clause-NetBSD,,,not on Fedora list,
@@ -192,6 +193,7 @@
 Mozilla Public License 1.0,MPL-1.0,MPLv1.0,Mozilla Public License v1.0,,
 Mozilla Public License 1.1,MPL-1.1,MPLv1.1,Mozilla Public License v1.1,,
 Mozilla Public License 2.0,MPL-2.0,MPLv2.0,Mozilla Public License v2.0,,
+Mozilla Public License 2.0,MPL-2.0-or-later,MPLv2.0,Mozilla Public License 
v2.0,,
 Mozilla Public License 2.0 (no copyleft 
exception),MPL-2.0-no-copyleft-exception,,,This variant not included on Fedora 
list (confirm this is correct statement),
 mpich2 License,mpich2,MIT,,,
 Multics License,Multics,,,not on Fedora list,
@@ -310,7 +312,7 @@
 Zope Public License 1.1,ZPL-1.1,,,This specific version not on Fedora list,
 Zope Public License 2.0,ZPL-2.0,ZPLv2.0,,,
 Zope Public License 2.1,ZPL-2.1,ZPLv2.1,,,
-BSD Zero Clause License,0BSD,,,"added to SPDX-LLv2.2, so was not part of 
comparison to Fedora list",
+Zero-Clause BSD,0BSD,0BSD,,,
 CeCILL Free Software License Agreement v2.1,CECILL-2.1,,,"added to 
SPDX-LLv2.2, so was not part of comparison to Fedora list",
 CrystalStacker License,CrystalStacker,,,"added to SPDX-LLv2.2, so was not part 
of comparison to Fedora list",
 Interbase Public License v1.0,Interbase-1.0,,,"added to SPDX-LLv2.2, so was 
not part of comparison to Fedora list",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/rust2rpm/templates/main.spec 
new/rust2rpm-11/rust2rpm/templates/main.spec
--- old/rust2rpm-10/rust2rpm/templates/main.spec        2019-06-16 
17:14:52.000000000 +0200
+++ new/rust2rpm-11/rust2rpm/templates/main.spec        2019-12-04 
07:56:50.000000000 +0100
@@ -50,12 +50,14 @@
 {% endif %}
 
 BuildRequires:  rust-packaging
+{% if all_features %}
+  {% set cargo_args = " -a" %}
+{% endif %}
 {% if not generate_buildrequires %}
   {% if not all_features %}
     {% set buildrequires = normalize_deps(md.requires("default", 
resolve=True))|sort %}
   {% else %}
     {% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
-    {% set cargo_args = " -a" %}
   {% endif %}
   {% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
   {% set has_buildrequires = (buildrequires + testrequires)|length > 0 %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/setup.py new/rust2rpm-11/setup.py
--- old/rust2rpm-10/setup.py    2019-06-16 17:14:52.000000000 +0200
+++ new/rust2rpm-11/setup.py    2019-12-04 07:56:50.000000000 +0100
@@ -31,9 +31,6 @@
         ],
     },
     install_requires=[
-        # Metadata parser
-        "semantic_version",
-
         # CLI tool
         "jinja2",
         "requests",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rust2rpm-10/test.py new/rust2rpm-11/test.py
--- old/rust2rpm-10/test.py     2019-06-16 17:14:52.000000000 +0200
+++ new/rust2rpm-11/test.py     2019-12-04 07:56:50.000000000 +0100
@@ -1,6 +1,8 @@
 import pytest
 
 import rust2rpm
+from rust2rpm.metadata import Version
+
 
 @pytest.mark.parametrize("req, rpmdep", [
     ("^1.2.3",
@@ -26,7 +28,11 @@
     ("~1",
      "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
     ("*",
-     "crate(test)"),
+     "crate(test) >= 0.0.0"),
+    ("1.*",
+     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
+    ("1.2*",
+     "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"),
     (">= 1.2.0",
      "crate(test) >= 1.2.0"),
     ("> 1",
@@ -37,8 +43,8 @@
      "crate(test) = 1.2.3"),
     (">= 1.2, < 1.5",
      "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"),
-    ("^2.0.0-alpha.6",
-     "(crate(test) >= 2.0.0~alpha.6 with crate(test) < 3.0.0)"),
+    ("^1.0.0-alpha.6",
+     "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0)"),
     ("^0.1.0-alpha.6",
      "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"),
     ("^0.0.1-alpha.6",
@@ -49,3 +55,190 @@
 def test_dependency(req, rpmdep):
     dep = rust2rpm.Dependency("test", req)
     assert str(dep) == rpmdep
+
+
[email protected]('version, parsed_version', [
+    ('', (None, None, None, None, None)),
+    ('0', (0, None, None, None, None)),
+    ('1.0', (1, 0, None, None, None)),
+    ('2.1.0', (2, 1, 0, None, None)),
+    ('2.1.0+build1', (2, 1, 0, None, 'build1')),
+    ('2.1.0-alpha1', (2, 1, 0, 'alpha1', None)),
+    ('2.1.0-alpha1+build1', (2, 1, 0, 'alpha1', 'build1')),
+])
+def test_parse_version(version, parsed_version):
+    result = rust2rpm.metadata.CargoSemVer.parse_version(version)
+    assert result == parsed_version
+
+
[email protected]('parsed_version, version', [
+    (Version(0, None, None, None, None), '0.0.0'),
+    (Version(1, 0, None, None, None), '1.0.0'),
+    (Version(2, 1, 0, None, None), '2.1.0'),
+    (Version(2, 1, 0, None, 'build1'), '2.1.0+build1'),
+    (Version(2, 1, 0, 'alpha1', None), '2.1.0-alpha1'),
+    (Version(2, 1, 0, 'alpha1', 'build1'), '2.1.0-alpha1+build1'),
+])
+def test_unparse_version(parsed_version, version):
+    result = rust2rpm.metadata.CargoSemVer.unparse_version(parsed_version)
+    assert result == version
+
+
[email protected]('parsed_version, version', [
+    (Version(2, 1, 0, None, None), '2.1.0'),
+    (Version(2, 1, 0, None, 'build1'), '2.1.0+build1'),
+    (Version(2, 1, 0, 'alpha1', None), '2.1.0~alpha1'),
+    (Version(2, 1, 0, 'alpha1', 'build1'), '2.1.0~alpha1+build1'),
+])
+def test_unparse_version_sep(parsed_version, version):
+    result = rust2rpm.metadata.CargoSemVer.unparse_version(
+        parsed_version, sep='~')
+    assert result == version
+
+
[email protected]('requirement, parsed_requirement', [
+    ('*', ('*', (None, None, None, None, None))),
+    ('0.*', ('*', (0, None, None, None, None))),
+    ('0.1.*', ('*', (0, 1, None, None, None))),
+    ('<0', ('<', (0, None, None, None, None))),
+    ('<0.1', ('<', (0, 1, None, None, None))),
+    ('<0.1.2', ('<', (0, 1, 2, None, None))),
+    ('<0.1.2-alpha1', ('<', (0, 1, 2, 'alpha1', None))),
+    ('<=0.1.2', ('<=', (0, 1, 2, None, None))),
+    ('=0.1.2', ('=', (0, 1, 2, None, None))),
+    ('==0.1.2', ('==', (0, 1, 2, None, None))),
+    ('>=0.1.2', ('>=', (0, 1, 2, None, None))),
+    ('>0.1.2', ('>', (0, 1, 2, None, None))),
+    ('0.1.2', ('', (0, 1, 2, None, None))),
+    ('!=0.1.2', ('!=', (0, 1, 2, None, None))),
+    ('^0.1.2', ('^', (0, 1, 2, None, None))),
+    ('~0.1.2', ('~', (0, 1, 2, None, None))),
+    ('~=0.1.2', ('~=', (0, 1, 2, None, None))),
+])
+def test_parse(requirement, parsed_requirement):
+    result = rust2rpm.metadata.CargoSemVer.parse(requirement)
+    assert result == parsed_requirement
+
+
[email protected]('version, coerced_version', [
+    (Version(0, None, None, None, None),
+     (0, 0, 0, None, None)),
+    (Version(1, 0, None, None, None),
+     (1, 0, 0, None, None)),
+    (Version(2, 1, 0, None, None),
+     (2, 1, 0, None, None)),
+    (Version(2, 1, 0, None, 'build1'),
+     (2, 1, 0, None, 'build1')),
+    (Version(2, 1, 0, 'alpha1', None),
+     (2, 1, 0, 'alpha1', None)),
+    (Version(2, 1, 0, 'alpha1', 'build1'),
+     (2, 1, 0, 'alpha1', 'build1')),
+])
+def test_coerce(version, coerced_version):
+    result = rust2rpm.metadata.CargoSemVer.coerce(version)
+    assert result == coerced_version
+
+
[email protected]('version, next_version', [
+    ((0, None, None, None, None), (1, 0, 0, None, None)),
+    ((1, 0, None, None, None), (2, 0, 0, None, None)),
+    ((2, 1, 0, None, None), (3, 0, 0, None, None)),
+    ((2, 0, 0, None, 'build1'), (3, 0, 0, None, None)),
+    ((2, None, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, 0, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 1, None, 'alpha1', None), (3, 0, 0, None, None)),
+    ((2, 1, 0, 'alpha1', None), (3, 0, 0, None, None)),
+    ((2, 1, 1, 'alpha1', None), (3, 0, 0, None, None)),
+    ((2, 0, 1, 'alpha1', 'build1'), (3, 0, 0, None, None)),
+])
+def test_next_major(version, next_version):
+    result = rust2rpm.metadata.CargoSemVer.next_major(version)
+    assert result == next_version
+
+
[email protected]('version, next_version', [
+    ((0, None, None, None, None), (0, 1, 0, None, None)),
+    ((1, 0, None, None, None), (1, 1, 0, None, None)),
+    ((2, 1, 0, None, None), (2, 2, 0, None, None)),
+    ((2, 1, 0, None, 'build1'), (2, 2, 0, None, None)),
+    ((2, None, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, 0, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 1, None, 'alpha1', None), (2, 1, 0, None, None)),
+    ((2, 1, 0, 'alpha1', None), (2, 1, 0, None, None)),
+    ((2, 1, 1, 'alpha1', None), (2, 2, 0, None, None)),
+    ((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
+])
+def test_next_minor(version, next_version):
+    result = rust2rpm.metadata.CargoSemVer.next_minor(version)
+    assert result == next_version
+
+
[email protected]('version, next_version', [
+    ((0, None, None, None, None), (0, 0, 1, None, None)),
+    ((1, 0, None, None, None), (1, 0, 1, None, None)),
+    ((2, 1, 0, None, None), (2, 1, 1, None, None)),
+    ((2, 1, 0, None, 'build1'), (2, 1, 1, None, None)),
+    ((2, None, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, None, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 0, 0, 'alpha1', None), (2, 0, 0, None, None)),
+    ((2, 1, None, 'alpha1', None), (2, 1, 0, None, None)),
+    ((2, 1, 0, 'alpha1', None), (2, 1, 0, None, None)),
+    ((2, 1, 1, 'alpha1', None), (2, 1, 1, None, None)),
+    ((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
+])
+def test_next_patch(version, next_version):
+    result = rust2rpm.metadata.CargoSemVer.next_patch(version)
+    assert result == next_version
+
+
[email protected]("requirement, normalized_requirement", [
+    (('^', Version(1, 2, 3, None, None)),
+     [('>=', (1, 2, 3, None, None)), ('<', (2, 0, 0, None, None))]),
+    (('^', Version(1, 2, None, None, None)),
+     [('>=', (1, 2, 0, None, None)), ('<', (2, 0, 0, None, None))]),
+    (('^', Version(1, None, None, None, None)),
+     [('>=', (1, 0, 0, None, None)), ('<', (2, 0, 0, None, None))]),
+    (('^', Version(0, 2, 3, None, None)),
+     [('>=', (0, 2, 3, None, None)), ('<', (0, 3, 0, None, None))]),
+    (('^', Version(0, 2, None, None, None)),
+     [('>=', (0, 2, 0, None, None)), ('<', (0, 3, 0, None, None))]),
+    (('^', Version(0, 0, 3, None, None)),
+     [('>=', (0, 0, 3, None, None)), ('<', (0, 0, 4, None, None))]),
+    (('^', Version(0, 0, None, None, None)),
+     [('>=', (0, 0, 0, None, None)), ('<', (0, 1, 0, None, None))]),
+    (('^', Version(0, None, None, None, None)),
+     [('>=', (0, 0, 0, None, None)), ('<', (1, 0, 0, None, None))]),
+    (('~', Version(1, 2, 3, None, None)),
+     [('>=', (1, 2, 3, None, None)), ('<', (1, 3, 0, None, None))]),
+    (('~', Version(1, 2, None, None, None)),
+     [('>=', (1, 2, 0, None, None)), ('<', (1, 3, 0, None, None))]),
+    (('~', Version(1, None, None, None, None)),
+     [('>=', (1, 0, 0, None, None)), ('<', (2, 0, 0, None, None))]),
+    (('*', Version(None, None, None, None, None)),
+     [('>=', (0, 0, 0, None, None))]),
+    (('*', Version(1, None, None, None, None)),
+     [('>=', (1, 0, 0, None, None)), ('<', (2, 0, 0, None, None))]),
+    (('*', Version(1, 2, None, None, None)),
+     [('>=', (1, 2, 0, None, None)), ('<', (1, 3, 0, None, None))]),
+    (('>=', Version(1, 2, 0, None, None)),
+     [('>=', (1, 2, 0, None, None))]),
+    (('>', Version(1, None, None, None, None)),
+     [('>', (1, 0, 0, None, None))]),
+    (('<', Version(2, None, None, None, None)),
+     [('<', (2, 0, 0, None, None))]),
+    (('=', Version(1, 2, 3, None, None)),
+     [('=', (1, 2, 3, None, None))]),
+    (('^', Version(1, 0, 0, 'alpha.6', None)),
+     [('>=', (1, 0, 0, 'alpha.6', None)), ('<', (2, 0, 0, None, None))]),
+    (('^', Version(0, 1, 0, 'alpha.6', None)),
+     [('>=', (0, 1, 0, 'alpha.6', None)), ('<', (0, 2, 0, None, None))]),
+    (('^', Version(0, 0, 1, 'alpha.6', None)),
+     [('>=', (0, 0, 1, 'alpha.6', None)), ('<', (0, 0, 2, None, None))]),
+    (('^', Version(0, 0, 0, 'alpha.6', None)),
+     [('>=', (0, 0, 0, 'alpha.6', None)), ('<', (0, 0, 1, None, None))]),
+])
+def test_normalize(requirement, normalized_requirement):
+    result = rust2rpm.metadata.CargoSemVer.normalize(requirement)
+    assert result == normalized_requirement


Reply via email to