generator: raise minimum rust-packaging version to 24 for Fedora target
This commit is contained in:
parent
8525474cda
commit
78299d18cc
11 changed files with 50 additions and 26 deletions
|
@ -16,6 +16,33 @@ from rust2rpm.licensing import translate_license
|
|||
from rust2rpm.metadata import package_uses_rust_1_60_feature_syntax, get_required_features_for_binaries
|
||||
|
||||
|
||||
RUST_PACKAGING_DEPS: dict[int, str] = {
|
||||
21: "rust-packaging >= 21",
|
||||
23: "rust-packaging >= 23",
|
||||
24: "cargo-rpm-macros >= 24",
|
||||
25: "cargo-rpm-macros >= 25",
|
||||
}
|
||||
|
||||
|
||||
RUST_PACKAGING_TARGET_MIN: dict[str, int] = {
|
||||
"fedora": 24,
|
||||
"mageia": 21,
|
||||
"opensuse": 21,
|
||||
"plain": 21,
|
||||
}
|
||||
|
||||
|
||||
def min_rust_packaging_dep(package: Package, target: str, is_bin: bool, is_cdylib: bool) -> int:
|
||||
if package_uses_rust_1_60_feature_syntax(package.features):
|
||||
min_dep = 24
|
||||
elif is_bin or is_cdylib:
|
||||
min_dep = 23
|
||||
else:
|
||||
min_dep = 21
|
||||
|
||||
return max((min_dep, RUST_PACKAGING_TARGET_MIN[target]))
|
||||
|
||||
|
||||
def spec_file_template(filename: str):
|
||||
env = jinja2.Environment(
|
||||
loader=jinja2.ChoiceLoader([jinja2.FileSystemLoader(["/"]), jinja2.PackageLoader("rust2rpm", "templates")]),
|
||||
|
@ -192,12 +219,7 @@ def spec_render_crate(
|
|||
for feature in features_hide:
|
||||
features.remove(feature)
|
||||
|
||||
if package_uses_rust_1_60_feature_syntax(package.features):
|
||||
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
||||
elif is_bin or is_cdylib:
|
||||
rust_packaging_dep = "rust-packaging >= 23"
|
||||
else:
|
||||
rust_packaging_dep = "rust-packaging >= 21"
|
||||
rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib)]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
cargo_args = " -a"
|
||||
|
@ -362,12 +384,7 @@ def spec_render_project(
|
|||
rpm_buildrequires = list(sorted(buildrequires))
|
||||
rpm_test_requires = list(sorted(test_requires))
|
||||
|
||||
if package_uses_rust_1_60_feature_syntax(package.features):
|
||||
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
||||
elif is_bin or is_cdylib:
|
||||
rust_packaging_dep = "rust-packaging >= 23"
|
||||
else:
|
||||
rust_packaging_dep = "rust-packaging >= 21"
|
||||
rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib)]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
cargo_args = " -a"
|
||||
|
@ -527,10 +544,17 @@ def spec_render_workspace(
|
|||
rpm_buildrequires = list(sorted(buildrequires))
|
||||
rpm_test_requires = list(sorted(test_requires))
|
||||
|
||||
if any(package_uses_rust_1_60_feature_syntax(package.features) for package in metadata.packages):
|
||||
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
||||
else:
|
||||
rust_packaging_dep = "rust-packaging >= 21"
|
||||
rust_packaging_dep = RUST_PACKAGING_DEPS[
|
||||
max(
|
||||
(
|
||||
24,
|
||||
max(
|
||||
min_rust_packaging_dep(package, target, package.is_bin(), package.is_cdylib())
|
||||
for package in metadata.packages
|
||||
),
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
cargo_args = " -a"
|
||||
|
|
|
@ -17,7 +17,7 @@ Patch: cxx-build-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: cxx-build-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
C++ code generator for integrating `cxx` crate into a Cargo build.}
|
||||
|
|
|
@ -16,7 +16,7 @@ Patch: dotenvy-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: dotenvy-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 23
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
A well-maintained fork of the dotenv crate.}
|
||||
|
|
|
@ -19,7 +19,7 @@ Patch: glib-sys-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: glib-sys-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
FFI bindings to libglib-2.0.}
|
||||
|
|
|
@ -18,7 +18,7 @@ Patch: nix-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: nix-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
Rust friendly bindings to *nix APIs.}
|
||||
|
|
|
@ -23,7 +23,7 @@ Patch: rust2rpm-helper-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: rust2rpm-helper-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 23
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
Helper program for rust2rpm.}
|
||||
|
|
|
@ -17,7 +17,7 @@ Patch: tokio-patch1.diff
|
|||
# Manually created patch for downstream crate metadata changes
|
||||
Patch: tokio-patch2.diff
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
An event-driven, non-blocking I/O platform for writing asynchronous I/O
|
||||
|
|
|
@ -14,7 +14,7 @@ License: # FIXME
|
|||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
|
||||
%global _description %{expand:
|
||||
A fast static site generator with everything built-in.}
|
||||
|
|
|
@ -17,7 +17,7 @@ Source: # FIXME
|
|||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
|
|
|
@ -34,7 +34,7 @@ Source: # FIXME
|
|||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
|
|
|
@ -16,7 +16,7 @@ Source: # FIXME
|
|||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
|
|
Loading…
Reference in a new issue