|
|
@ -1,14 +1,45 @@
|
|
|
|
From 29a3c1b84e0971fc0c2edf483ae3b04139c19b32 Mon Sep 17 00:00:00 2001
|
|
|
|
From 769506caf08edb5ea2342d9add22e4db1b347375 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Date: Sat, 26 Jan 2019 08:33:37 +0100
|
|
|
|
Date: Sat, 26 Jan 2019 08:33:37 +0100
|
|
|
|
Subject: [PATCH 14/14] Add support for prerelease versions
|
|
|
|
Subject: [PATCH 14/14] Add support for prerelease versions
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
---
|
|
|
|
---
|
|
|
|
|
|
|
|
data/macros.rust-srpm | 23 +++++++++++++++++++++++
|
|
|
|
rust2rpm/metadata.py | 18 ++++++++++++------
|
|
|
|
rust2rpm/metadata.py | 18 ++++++++++++------
|
|
|
|
|
|
|
|
rust2rpm/templates/main.spec | 6 +-----
|
|
|
|
test.py | 8 ++++++++
|
|
|
|
test.py | 8 ++++++++
|
|
|
|
2 files changed, 20 insertions(+), 6 deletions(-)
|
|
|
|
4 files changed, 44 insertions(+), 11 deletions(-)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm
|
|
|
|
|
|
|
|
index f2bae9d..bd21cb5 100644
|
|
|
|
|
|
|
|
--- a/data/macros.rust-srpm
|
|
|
|
|
|
|
|
+++ b/data/macros.rust-srpm
|
|
|
|
|
|
|
|
@@ -1 +1,24 @@
|
|
|
|
|
|
|
|
%rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
|
|
|
|
|
|
|
|
+%__crates_url https://crates.io/api/v1/crates/
|
|
|
|
|
|
|
|
+%crates_source %{lua:
|
|
|
|
|
|
|
|
+ local crate = rpm.expand('%1')
|
|
|
|
|
|
|
|
+ local version = rpm.expand('%2')
|
|
|
|
|
|
|
|
+ local url = rpm.expand('%__crates_url')
|
|
|
|
|
|
|
|
+\
|
|
|
|
|
|
|
|
+ if crate == '%1' then
|
|
|
|
|
|
|
|
+ crate = rpm.expand('%real_crate')
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+ if crate == '%real_crate' then
|
|
|
|
|
|
|
|
+ crate = rpm.expand('%crate')
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+ if crate == '%crate' then
|
|
|
|
|
|
|
|
+ crate = rpm.expand('%name')
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+\
|
|
|
|
|
|
|
|
+ if version == '%2' then
|
|
|
|
|
|
|
|
+ version = rpm.expand('%version')
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+ version = version:gsub('~', '-')
|
|
|
|
|
|
|
|
+\
|
|
|
|
|
|
|
|
+ print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate')
|
|
|
|
|
|
|
|
+}
|
|
|
|
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
|
|
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
|
|
index 328b67a..f0718d5 100644
|
|
|
|
index 328b67a..f0718d5 100644
|
|
|
|
--- a/rust2rpm/metadata.py
|
|
|
|
--- a/rust2rpm/metadata.py
|
|
|
@ -61,6 +92,23 @@ index 328b67a..f0718d5 100644
|
|
|
|
for feature in features)
|
|
|
|
for feature in features)
|
|
|
|
return fdeps | deps
|
|
|
|
return fdeps | deps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
|
|
|
|
|
|
index 84bd97d..f67e023 100644
|
|
|
|
|
|
|
|
--- a/rust2rpm/templates/main.spec
|
|
|
|
|
|
|
|
+++ b/rust2rpm/templates/main.spec
|
|
|
|
|
|
|
|
@@ -31,11 +31,7 @@ License: {{ license|default("# FIXME") }}
|
|
|
|
|
|
|
|
{{ license_comments }}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
URL: https://crates.io/crates/{{ crate }}
|
|
|
|
|
|
|
|
-{% if md.name != crate %}
|
|
|
|
|
|
|
|
-Source0: https://crates.io/api/v1/crates/%{real_crate}/%{version}/download#/%{crate}-%{version}.crate
|
|
|
|
|
|
|
|
-{% else %}
|
|
|
|
|
|
|
|
-Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
|
|
|
|
|
|
|
|
-{% endif %}
|
|
|
|
|
|
|
|
+Source: %{crates_source}
|
|
|
|
|
|
|
|
{% if patch_file is not none %}
|
|
|
|
|
|
|
|
{% if target == "opensuse" %}
|
|
|
|
|
|
|
|
# PATCH-FIX-OPENSUSE {{ patch_file }} -- Initial patched metadata
|
|
|
|
diff --git a/test.py b/test.py
|
|
|
|
diff --git a/test.py b/test.py
|
|
|
|
index 30263b4..035df79 100644
|
|
|
|
index 30263b4..035df79 100644
|
|
|
|
--- a/test.py
|
|
|
|
--- a/test.py
|
|
|
|