Band-aid clap pre-release version

Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
epel9
Igor Raits 4 years ago
parent d936b970ca
commit b042dacc38
No known key found for this signature in database
GPG Key ID: 115D5AB89C5C1E1E

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

@ -4,13 +4,15 @@
Name: rust-packaging Name: rust-packaging
Version: 17 Version: 17
Release: 1%{?dist} Release: 2%{?dist}
Summary: RPM macros for building Rust packages on various architectures Summary: RPM macros for building Rust packages on various architectures
License: MIT License: MIT
URL: https://pagure.io/fedora-rust/rust2rpm URL: https://pagure.io/fedora-rust/rust2rpm
Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz
# https://pagure.io/fedora-rust/rust2rpm/issue/70
Patch0001: 0001-Always-require-upper-bound-dependency-with-sign.patch
ExclusiveArch: %{rust_arches} ExclusiveArch: %{rust_arches}
# gawk is needed for stripping dev-deps in macro # gawk is needed for stripping dev-deps in macro
@ -69,6 +71,9 @@ py.test-%{python3_version} -vv test.py
%{python3_sitelib}/rust2rpm/ %{python3_sitelib}/rust2rpm/
%changelog %changelog
* Mon Dec 28 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 17-2
- Band-aid clap pre-release version
* Sat Dec 26 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 17-1 * Sat Dec 26 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 17-1
- Update to 17 - Update to 17

Loading…
Cancel
Save