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). Signed-off-by: Igor Raits <igor.raits@gmail.com> Fixes https://pagure.io/fedora-rust/rust2rpm/issue/70.
This commit is contained in:
parent
af4e3714eb
commit
ea59cb27d1
2 changed files with 21 additions and 21 deletions
|
@ -232,7 +232,7 @@ class Dependency:
|
||||||
if not reqs:
|
if not reqs:
|
||||||
return cap
|
return cap
|
||||||
deps = ' with '.join(
|
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)
|
for op, version in reqs)
|
||||||
if len(reqs) > 1:
|
if len(reqs) > 1:
|
||||||
return f"({deps})"
|
return f"({deps})"
|
||||||
|
|
40
test.py
40
test.py
|
@ -6,53 +6,53 @@ from rust2rpm.metadata import Version
|
||||||
|
|
||||||
@pytest.mark.parametrize("req, rpmdep", [
|
@pytest.mark.parametrize("req, rpmdep", [
|
||||||
("^1.2.3",
|
("^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",
|
("^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",
|
("^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",
|
("^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",
|
("^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",
|
("^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",
|
("^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",
|
("^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",
|
("~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",
|
("~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",
|
("~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"),
|
"crate(test) >= 0.0.0"),
|
||||||
("1.*",
|
("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.*",
|
("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.*.*",
|
("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",
|
(">= 1.2.0",
|
||||||
"crate(test) >= 1.2.0"),
|
"crate(test) >= 1.2.0"),
|
||||||
("> 1",
|
("> 1",
|
||||||
"crate(test) > 1.0.0"),
|
"crate(test) > 1.0.0"),
|
||||||
("< 2",
|
("< 2",
|
||||||
"crate(test) < 2.0.0"),
|
"crate(test) < 2.0.0~"),
|
||||||
("= 1.2.3",
|
("= 1.2.3",
|
||||||
"crate(test) = 1.2.3"),
|
"crate(test) = 1.2.3"),
|
||||||
(">= 1.2, < 1.5",
|
(">= 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",
|
("^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",
|
("^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",
|
("^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",
|
("^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):
|
def test_dependency(req, rpmdep):
|
||||||
dep = rust2rpm.Dependency("test", req)
|
dep = rust2rpm.Dependency("test", req)
|
||||||
|
|
Loading…
Reference in a new issue