Blame 0001-Always-require-upper-bound-dependency-with-sign.patch

b042dac
From 617d4b9140b35f4f74def98b87a69a84943a33de Mon Sep 17 00:00:00 2001
b042dac
From: Igor Raits <igor.raits@gmail.com>
b042dac
Date: Mon, 28 Dec 2020 12:44:52 +0100
b042dac
Subject: [PATCH] Always require upper-bound dependency with ~ sign
b042dac
b042dac
Proper fix is quite complex and given we do not package pre-release
b042dac
versions very often (and esp. not multiple versions of them), this is
b042dac
good enough (not nice though).
b042dac
b042dac
References: https://pagure.io/fedora-rust/rust2rpm/issue/70
b042dac
Signed-off-by: Igor Raits <igor.raits@gmail.com>
b042dac
---
b042dac
 rust2rpm/metadata.py |  2 +-
b042dac
 test.py              | 40 ++++++++++++++++++++--------------------
b042dac
 2 files changed, 21 insertions(+), 21 deletions(-)
b042dac
b042dac
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
b042dac
index b29e7b5..4636cc5 100644
b042dac
--- a/rust2rpm/metadata.py
b042dac
+++ b/rust2rpm/metadata.py
b042dac
@@ -197,7 +197,7 @@ class Dependency:
b042dac
         if not reqs:
b042dac
             return cap
b042dac
         deps = ' with '.join(
b042dac
-            f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}'
b042dac
+            f'{cap} {op} {CargoSemVer.unparse_version(version, sep="~")}{"~" if op == CargoSemVer.KIND_LT else ""}'
b042dac
             for op, version in reqs)
b042dac
         if len(reqs) > 1:
b042dac
             return f"({deps})"
b042dac
diff --git a/test.py b/test.py
b042dac
index ccda3b5..7623be0 100644
b042dac
--- a/test.py
b042dac
+++ b/test.py
b042dac
@@ -6,53 +6,53 @@ from rust2rpm.metadata import Version
b042dac
 
b042dac
 @pytest.mark.parametrize("req, rpmdep", [
b042dac
     ("^1.2.3",
b042dac
-     "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.2.3 with crate(test) < 2.0.0~)"),
b042dac
     ("^1.2",
b042dac
-     "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.2.0 with crate(test) < 2.0.0~)"),
b042dac
     ("^1",
b042dac
-     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"),
b042dac
     ("^0.2.3",
b042dac
-     "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"),
b042dac
+     "(crate(test) >= 0.2.3 with crate(test) < 0.3.0~)"),
b042dac
     ("^0.2",
b042dac
-     "(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"),
b042dac
+     "(crate(test) >= 0.2.0 with crate(test) < 0.3.0~)"),
b042dac
     ("^0.0.3",
b042dac
-     "(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"),
b042dac
+     "(crate(test) >= 0.0.3 with crate(test) < 0.0.4~)"),
b042dac
     ("^0.0",
b042dac
-     "(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"),
b042dac
+     "(crate(test) >= 0.0.0 with crate(test) < 0.1.0~)"),
b042dac
     ("^0",
b042dac
-     "(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"),
b042dac
+     "(crate(test) >= 0.0.0 with crate(test) < 1.0.0~)"),
b042dac
     ("~1.2.3",
b042dac
-     "(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"),
b042dac
+     "(crate(test) >= 1.2.3 with crate(test) < 1.3.0~)"),
b042dac
     ("~1.2",
b042dac
-     "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"),
b042dac
+     "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"),
b042dac
     ("~1",
b042dac
-     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"),
b042dac
     ("*",
b042dac
      "crate(test) >= 0.0.0"),
b042dac
     ("1.*",
b042dac
-     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"),
b042dac
     ("1.2.*",
b042dac
-     "(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"),
b042dac
+     "(crate(test) >= 1.2.0 with crate(test) < 1.3.0~)"),
b042dac
     ("1.*.*",
b042dac
-     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"),
b042dac
     (">= 1.2.0",
b042dac
      "crate(test) >= 1.2.0"),
b042dac
     ("> 1",
b042dac
      "crate(test) > 1.0.0"),
b042dac
     ("< 2",
b042dac
-     "crate(test) < 2.0.0"),
b042dac
+     "crate(test) < 2.0.0~"),
b042dac
     ("= 1.2.3",
b042dac
      "crate(test) = 1.2.3"),
b042dac
     (">= 1.2, < 1.5",
b042dac
-     "(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"),
b042dac
+     "(crate(test) >= 1.2.0 with crate(test) < 1.5.0~)"),
b042dac
     ("^1.0.0-alpha.6",
b042dac
-     "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0)"),
b042dac
+     "(crate(test) >= 1.0.0~alpha.6 with crate(test) < 2.0.0~)"),
b042dac
     ("^0.1.0-alpha.6",
b042dac
-     "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0)"),
b042dac
+     "(crate(test) >= 0.1.0~alpha.6 with crate(test) < 0.2.0~)"),
b042dac
     ("^0.0.1-alpha.6",
b042dac
-     "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2)"),
b042dac
+     "(crate(test) >= 0.0.1~alpha.6 with crate(test) < 0.0.2~)"),
b042dac
     ("^0.0.0-alpha.6",
b042dac
-     "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1)"),
b042dac
+     "(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1~)"),
b042dac
 ])
b042dac
 def test_dependency(req, rpmdep):
b042dac
     dep = rust2rpm.Dependency("test", req)
b042dac
-- 
b042dac
2.30.0.rc2
b042dac