|
|
@ -1,4 +1,4 @@
|
|
|
|
From 5471c1916a5e947ba1b21343b70abd6d4aaf97de Mon Sep 17 00:00:00 2001
|
|
|
|
From 2cac5e5ad5ff5472923ce333bef59679612bbaa2 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Date: Fri, 26 Oct 2018 11:20:13 +0200
|
|
|
|
Date: Fri, 26 Oct 2018 11:20:13 +0200
|
|
|
|
Subject: [PATCH 07/10] split features into subpackages
|
|
|
|
Subject: [PATCH 07/10] split features into subpackages
|
|
|
@ -7,12 +7,13 @@ References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-desi
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
---
|
|
|
|
---
|
|
|
|
data/cargo.attr | 4 +-
|
|
|
|
data/cargo.attr | 4 +-
|
|
|
|
data/macros.cargo | 10 ++
|
|
|
|
data/macros.cargo | 10 +
|
|
|
|
rust2rpm/__main__.py | 11 +-
|
|
|
|
rust2rpm/__main__.py | 11 +-
|
|
|
|
rust2rpm/inspector.py | 22 ++-
|
|
|
|
rust2rpm/inspector.py | 22 ++-
|
|
|
|
rust2rpm/metadata.py | 315 +++++++++++++++++------------------
|
|
|
|
rust2rpm/metadata.py | 317 ++++++++++++++++----------------
|
|
|
|
rust2rpm/templates/main.spec | 142 ++++++++--------
|
|
|
|
rust2rpm/templates/main.spec | 142 +++++++-------
|
|
|
|
6 files changed, 260 insertions(+), 244 deletions(-)
|
|
|
|
test.py | 347 ++++-------------------------------
|
|
|
|
|
|
|
|
7 files changed, 298 insertions(+), 555 deletions(-)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/data/cargo.attr b/data/cargo.attr
|
|
|
|
diff --git a/data/cargo.attr b/data/cargo.attr
|
|
|
|
index 392a72b..4910b5c 100644
|
|
|
|
index 392a72b..4910b5c 100644
|
|
|
@ -143,10 +144,10 @@ index 2d488b2..9e79e88 100644
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
|
|
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
|
|
index 5adeb65..119dea5 100644
|
|
|
|
index 5adeb65..4929cdd 100644
|
|
|
|
--- a/rust2rpm/metadata.py
|
|
|
|
--- a/rust2rpm/metadata.py
|
|
|
|
+++ b/rust2rpm/metadata.py
|
|
|
|
+++ b/rust2rpm/metadata.py
|
|
|
|
@@ -1,208 +1,205 @@
|
|
|
|
@@ -1,208 +1,207 @@
|
|
|
|
__all__ = ["Dependency", "Metadata"]
|
|
|
|
__all__ = ["Dependency", "Metadata"]
|
|
|
|
|
|
|
|
|
|
|
|
-import itertools
|
|
|
|
-import itertools
|
|
|
@ -260,8 +261,8 @@ index 5adeb65..119dea5 100644
|
|
|
|
- spec = semver.Spec(s.replace(" ", ""))
|
|
|
|
- spec = semver.Spec(s.replace(" ", ""))
|
|
|
|
- parsed = []
|
|
|
|
- parsed = []
|
|
|
|
+ def _normalize_req(req):
|
|
|
|
+ def _normalize_req(req):
|
|
|
|
+ if "*" in req:
|
|
|
|
+ if "*" in req and req != "*":
|
|
|
|
+ return NotImplemented
|
|
|
|
+ raise NotImplementedError(f"'*' is not supported: {req}")
|
|
|
|
+ spec = semver.Spec(req.replace(" ", ""))
|
|
|
|
+ spec = semver.Spec(req.replace(" ", ""))
|
|
|
|
+ reqs = []
|
|
|
|
+ reqs = []
|
|
|
|
for req in spec.specs:
|
|
|
|
for req in spec.specs:
|
|
|
@ -271,8 +272,10 @@ index 5adeb65..119dea5 100644
|
|
|
|
+ # Any means any
|
|
|
|
+ # Any means any
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
+ ver = req.spec
|
|
|
|
+ ver = req.spec
|
|
|
|
+ if ver.prerelease or req.kind in (req.KIND_NEQ, req.KIND_EMPTY):
|
|
|
|
+ if ver.prerelease:
|
|
|
|
+ return NotImplemented
|
|
|
|
+ raise NotImplementedError(f"Pre-release requirement is not supported: {ver}")
|
|
|
|
|
|
|
|
+ if req.kind in (req.KIND_NEQ, req.KIND_EMPTY):
|
|
|
|
|
|
|
|
+ raise NotImplementedError(f"'!=' and empty kinds are not supported: {req}")
|
|
|
|
coerced = semver.Version.coerce(str(ver))
|
|
|
|
coerced = semver.Version.coerce(str(ver))
|
|
|
|
- if req.kind in (req.KIND_CARET, req.KIND_TILDE):
|
|
|
|
- if req.kind in (req.KIND_CARET, req.KIND_TILDE):
|
|
|
|
- if ver.prerelease:
|
|
|
|
- if ver.prerelease:
|
|
|
@ -697,6 +700,365 @@ index 7dbcc3f..0d9a80b 100644
|
|
|
|
-{% endif %}
|
|
|
|
-{% endif %}
|
|
|
|
%changelog
|
|
|
|
%changelog
|
|
|
|
{% include target ~ "-changelog.spec.inc" %}
|
|
|
|
{% include target ~ "-changelog.spec.inc" %}
|
|
|
|
|
|
|
|
diff --git a/test.py b/test.py
|
|
|
|
|
|
|
|
index b856fdd..30263b4 100644
|
|
|
|
|
|
|
|
--- a/test.py
|
|
|
|
|
|
|
|
+++ b/test.py
|
|
|
|
|
|
|
|
@@ -1,318 +1,43 @@
|
|
|
|
|
|
|
|
-import os
|
|
|
|
|
|
|
|
-import shutil
|
|
|
|
|
|
|
|
-import subprocess
|
|
|
|
|
|
|
|
-import sys
|
|
|
|
|
|
|
|
-import tempfile
|
|
|
|
|
|
|
|
-import textwrap
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import rust2rpm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-DUMMY_LIB = """
|
|
|
|
|
|
|
|
-pub fn say_hello() {
|
|
|
|
|
|
|
|
- println!("Hello, World!");
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
-"""
|
|
|
|
|
|
|
|
-DEPGEN = os.path.join(os.path.dirname(__file__), "cargodeps.py")
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
-@pytest.mark.parametrize("req, features, rpmdep", [
|
|
|
|
|
|
|
|
- ("=1.0.0", [],
|
|
|
|
|
|
|
|
- "crate(test) = 1.0.0"),
|
|
|
|
|
|
|
|
- ("=1.0.0", ["feature"],
|
|
|
|
|
|
|
|
- "(crate(test) = 1.0.0 with crate(test/feature))"),
|
|
|
|
|
|
|
|
- (">=1.0.0,<2.0.0", [],
|
|
|
|
|
|
|
|
+@pytest.mark.parametrize("req, rpmdep", [
|
|
|
|
|
|
|
|
+ ("^1.2.3",
|
|
|
|
|
|
|
|
+ "(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"),
|
|
|
|
|
|
|
|
+ ("^1.2",
|
|
|
|
|
|
|
|
+ "(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"),
|
|
|
|
|
|
|
|
+ ("^1",
|
|
|
|
|
|
|
|
"(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
|
|
|
|
|
|
|
|
- (">=1.0.0,<2.0.0", ["feature"],
|
|
|
|
|
|
|
|
- "((crate(test) >= 1.0.0 with crate(test) < 2.0.0) with crate(test/feature))"),
|
|
|
|
|
|
|
|
+ ("^0.2.3",
|
|
|
|
|
|
|
|
+ "(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"),
|
|
|
|
|
|
|
|
+ ("^0.2",
|
|
|
|
|
|
|
|
+ "(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)"),
|
|
|
|
|
|
|
|
+ ("^0.0",
|
|
|
|
|
|
|
|
+ "(crate(test) >= 0.0.0 with crate(test) < 0.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)"),
|
|
|
|
|
|
|
|
+ ("~1.2",
|
|
|
|
|
|
|
|
+ "(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.2.0",
|
|
|
|
|
|
|
|
+ "crate(test) >= 1.2.0"),
|
|
|
|
|
|
|
|
+ ("> 1",
|
|
|
|
|
|
|
|
+ "crate(test) > 1.0.0"),
|
|
|
|
|
|
|
|
+ ("< 2",
|
|
|
|
|
|
|
|
+ "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)"),
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
-def test_dependency(req, features, rpmdep):
|
|
|
|
|
|
|
|
- dep = rust2rpm.Dependency("test", req, features)
|
|
|
|
|
|
|
|
+def test_dependency(req, rpmdep):
|
|
|
|
|
|
|
|
+ dep = rust2rpm.Dependency("test", req)
|
|
|
|
|
|
|
|
assert str(dep) == rpmdep
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
-@pytest.fixture
|
|
|
|
|
|
|
|
-def cargo_toml(request):
|
|
|
|
|
|
|
|
- def make_cargo_toml(contents):
|
|
|
|
|
|
|
|
- toml = os.path.join(tmpdir, "Cargo.toml")
|
|
|
|
|
|
|
|
- with open(toml, "w") as fobj:
|
|
|
|
|
|
|
|
- fobj.write(textwrap.dedent(contents))
|
|
|
|
|
|
|
|
- return toml
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- tmpdir = tempfile.mkdtemp(prefix="cargo-deps-")
|
|
|
|
|
|
|
|
- srcdir = os.path.join(tmpdir, "src")
|
|
|
|
|
|
|
|
- os.mkdir(srcdir)
|
|
|
|
|
|
|
|
- with open(os.path.join(srcdir, "lib.rs"), "w") as fobj:
|
|
|
|
|
|
|
|
- fobj.write(DUMMY_LIB)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- def finalize():
|
|
|
|
|
|
|
|
- shutil.rmtree(tmpdir)
|
|
|
|
|
|
|
|
- request.addfinalizer(finalize)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- return make_cargo_toml
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
-@pytest.mark.parametrize("toml, provides, requires", [
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Basic provides
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- []),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Basic provides for feature
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "1.2.3"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [features]
|
|
|
|
|
|
|
|
- color = []
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 1.2.3",
|
|
|
|
|
|
|
|
- "crate(hello/color) = 1.2.3"],
|
|
|
|
|
|
|
|
- []),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Provides for optional dependencies
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "1.2.3"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- non_optional = "1"
|
|
|
|
|
|
|
|
- serde = { version = "1", optional = true }
|
|
|
|
|
|
|
|
- rand = { version = "0.4", optional = true }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [features]
|
|
|
|
|
|
|
|
- std = []
|
|
|
|
|
|
|
|
- v1 = ["rand"]
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 1.2.3",
|
|
|
|
|
|
|
|
- "crate(hello/rand) = 1.2.3",
|
|
|
|
|
|
|
|
- "crate(hello/serde) = 1.2.3",
|
|
|
|
|
|
|
|
- "crate(hello/std) = 1.2.3",
|
|
|
|
|
|
|
|
- "crate(hello/v1) = 1.2.3"],
|
|
|
|
|
|
|
|
- ["(crate(non_optional) >= 1.0.0 with crate(non_optional) < 2.0.0)",
|
|
|
|
|
|
|
|
- "(crate(rand) >= 0.4.0 with crate(rand) < 0.5.0)",
|
|
|
|
|
|
|
|
- "(crate(serde) >= 1.0.0 with crate(serde) < 2.0.0)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Caret requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^0"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 0.0.0 with crate(libc) < 1.0.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^0.0"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 0.0.0 with crate(libc) < 0.1.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^0.0.3"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 0.0.3 with crate(libc) < 0.0.4)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^0.2.3"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 0.2.3 with crate(libc) < 0.3.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^1"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^1.2"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.0 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "^1.2.3"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.3 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Tilde requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "~1"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "~1.2"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "~1.2.3"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.3 with crate(libc) < 1.3.0)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Wildcard requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "*"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["crate(libc)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "1.*"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "1.2.*"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "1.*.*"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Inequality requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = ">= 1.2.0"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["crate(libc) >= 1.2.0"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "> 1"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["crate(libc) > 1.0.0"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "< 2"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["crate(libc) < 2.0.0"]),
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = "= 1.2.3"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["crate(libc) = 1.2.3"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Multiple requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- libc = ">= 1.2, < 1.5"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0"],
|
|
|
|
|
|
|
|
- ["(crate(libc) >= 1.2.0 with crate(libc) < 1.5.0)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- # Pre-release requirements
|
|
|
|
|
|
|
|
- ("""
|
|
|
|
|
|
|
|
- [package]
|
|
|
|
|
|
|
|
- name = "hello"
|
|
|
|
|
|
|
|
- version = "0.0.0-alpha"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
- [dependencies]
|
|
|
|
|
|
|
|
- foo-bar = "1.2.3-beta"
|
|
|
|
|
|
|
|
- """,
|
|
|
|
|
|
|
|
- ["crate(hello) = 0.0.0~alpha"],
|
|
|
|
|
|
|
|
- ["(crate(foo-bar) >= 1.2.3~beta with crate(foo-bar) < 1.2.3)"]),
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
-])
|
|
|
|
|
|
|
|
-def test_depgen(toml, provides, requires, cargo_toml):
|
|
|
|
|
|
|
|
- md = rust2rpm.Metadata.from_file(cargo_toml(toml))
|
|
|
|
|
|
|
|
- assert [str(x) for x in md.provides] == provides
|
|
|
|
|
|
|
|
- assert [str(x) for x in md.requires] == requires
|
|
|
|
--
|
|
|
|
--
|
|
|
|
2.19.1
|
|
|
|
2.19.1
|
|
|
|
|
|
|
|
|
|
|
|