From ec8dcf58d07a3ee37e67026a568643644ed3afe1 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 6 Oct 2023 22:18:15 +0200 Subject: [PATCH] generator: fix adding Requires defined in config to feature subpackages --- rust2rpm/generator.py | 3 ++- rust2rpm/tests/samples/glib-sys-0.17.2.fedora.spec | 9 +++++++++ rust2rpm/tests/samples/glib-sys-0.17.2.mageia.spec | 9 +++++++++ rust2rpm/tests/samples/glib-sys-0.17.2.opensuse.spec | 9 +++++++++ rust2rpm/tests/samples/glib-sys-0.17.2.plain.spec | 9 +++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/rust2rpm/generator.py b/rust2rpm/generator.py index 49958f2..c6c68c0 100644 --- a/rust2rpm/generator.py +++ b/rust2rpm/generator.py @@ -185,7 +185,8 @@ def spec_render_crate( conf_key = f"lib+{feature}" if requires_features := tomlconf.requires_features: conf_lib_requires[conf_key] = requires_features.get(feature) or list() - conf_lib_requires[conf_key] = list() + else: + conf_lib_requires[conf_key] = list() if features_hide := tomlconf.features_hide: for feature in features_hide: diff --git a/rust2rpm/tests/samples/glib-sys-0.17.2.fedora.spec b/rust2rpm/tests/samples/glib-sys-0.17.2.fedora.spec index 4ec80a9..bcd10f7 100644 --- a/rust2rpm/tests/samples/glib-sys-0.17.2.fedora.spec +++ b/rust2rpm/tests/samples/glib-sys-0.17.2.fedora.spec @@ -70,6 +70,7 @@ use the "dox" feature of the "%{crate}" crate. %package -n %{name}+v2_58-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.58 %description -n %{name}+v2_58-devel %{_description} @@ -82,6 +83,7 @@ use the "v2_58" feature of the "%{crate}" crate. %package -n %{name}+v2_60-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.60 %description -n %{name}+v2_60-devel %{_description} @@ -94,6 +96,7 @@ use the "v2_60" feature of the "%{crate}" crate. %package -n %{name}+v2_62-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.62 %description -n %{name}+v2_62-devel %{_description} @@ -106,6 +109,7 @@ use the "v2_62" feature of the "%{crate}" crate. %package -n %{name}+v2_64-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.64 %description -n %{name}+v2_64-devel %{_description} @@ -118,6 +122,7 @@ use the "v2_64" feature of the "%{crate}" crate. %package -n %{name}+v2_66-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.66 %description -n %{name}+v2_66-devel %{_description} @@ -130,6 +135,7 @@ use the "v2_66" feature of the "%{crate}" crate. %package -n %{name}+v2_68-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.68 %description -n %{name}+v2_68-devel %{_description} @@ -142,6 +148,7 @@ use the "v2_68" feature of the "%{crate}" crate. %package -n %{name}+v2_70-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.70 %description -n %{name}+v2_70-devel %{_description} @@ -154,6 +161,7 @@ use the "v2_70" feature of the "%{crate}" crate. %package -n %{name}+v2_72-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.72 %description -n %{name}+v2_72-devel %{_description} @@ -166,6 +174,7 @@ use the "v2_72" feature of the "%{crate}" crate. %package -n %{name}+v2_74-devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.74 %description -n %{name}+v2_74-devel %{_description} diff --git a/rust2rpm/tests/samples/glib-sys-0.17.2.mageia.spec b/rust2rpm/tests/samples/glib-sys-0.17.2.mageia.spec index ea71ffc..6468cd8 100644 --- a/rust2rpm/tests/samples/glib-sys-0.17.2.mageia.spec +++ b/rust2rpm/tests/samples/glib-sys-0.17.2.mageia.spec @@ -85,6 +85,7 @@ use the "dox" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.58 %description -n %{name}+v2_58-devel %{_description} @@ -98,6 +99,7 @@ use the "v2_58" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.60 %description -n %{name}+v2_60-devel %{_description} @@ -111,6 +113,7 @@ use the "v2_60" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.62 %description -n %{name}+v2_62-devel %{_description} @@ -124,6 +127,7 @@ use the "v2_62" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.64 %description -n %{name}+v2_64-devel %{_description} @@ -137,6 +141,7 @@ use the "v2_64" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.66 %description -n %{name}+v2_66-devel %{_description} @@ -150,6 +155,7 @@ use the "v2_66" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.68 %description -n %{name}+v2_68-devel %{_description} @@ -163,6 +169,7 @@ use the "v2_68" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.70 %description -n %{name}+v2_70-devel %{_description} @@ -176,6 +183,7 @@ use the "v2_70" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.72 %description -n %{name}+v2_72-devel %{_description} @@ -189,6 +197,7 @@ use the "v2_72" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.74 %description -n %{name}+v2_74-devel %{_description} diff --git a/rust2rpm/tests/samples/glib-sys-0.17.2.opensuse.spec b/rust2rpm/tests/samples/glib-sys-0.17.2.opensuse.spec index ec909e8..924f785 100644 --- a/rust2rpm/tests/samples/glib-sys-0.17.2.opensuse.spec +++ b/rust2rpm/tests/samples/glib-sys-0.17.2.opensuse.spec @@ -102,6 +102,7 @@ use the "dox" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.58 %description -n %{name}+v2_58-devel %{_description} @@ -115,6 +116,7 @@ use the "v2_58" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.60 %description -n %{name}+v2_60-devel %{_description} @@ -128,6 +130,7 @@ use the "v2_60" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.62 %description -n %{name}+v2_62-devel %{_description} @@ -141,6 +144,7 @@ use the "v2_62" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.64 %description -n %{name}+v2_64-devel %{_description} @@ -154,6 +158,7 @@ use the "v2_64" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.66 %description -n %{name}+v2_66-devel %{_description} @@ -167,6 +172,7 @@ use the "v2_66" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.68 %description -n %{name}+v2_68-devel %{_description} @@ -180,6 +186,7 @@ use the "v2_68" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.70 %description -n %{name}+v2_70-devel %{_description} @@ -193,6 +200,7 @@ use the "v2_70" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.72 %description -n %{name}+v2_72-devel %{_description} @@ -206,6 +214,7 @@ use the "v2_72" feature of the "%{crate}" crate. Summary: %{summary} Group: Development/Libraries/Rust BuildArch: noarch +Requires: pkgconfig(glib-2.0) >= 2.74 %description -n %{name}+v2_74-devel %{_description} diff --git a/rust2rpm/tests/samples/glib-sys-0.17.2.plain.spec b/rust2rpm/tests/samples/glib-sys-0.17.2.plain.spec index 3122321..54054fa 100644 --- a/rust2rpm/tests/samples/glib-sys-0.17.2.plain.spec +++ b/rust2rpm/tests/samples/glib-sys-0.17.2.plain.spec @@ -94,6 +94,7 @@ BuildArch: noarch Provides: crate(glib-sys/v2_58) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.58 %description -n %{name}+v2_58-devel %{_description} @@ -110,6 +111,7 @@ Provides: crate(glib-sys/v2_60) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_58) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.60 %description -n %{name}+v2_60-devel %{_description} @@ -126,6 +128,7 @@ Provides: crate(glib-sys/v2_62) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_60) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.62 %description -n %{name}+v2_62-devel %{_description} @@ -142,6 +145,7 @@ Provides: crate(glib-sys/v2_64) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_62) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.64 %description -n %{name}+v2_64-devel %{_description} @@ -158,6 +162,7 @@ Provides: crate(glib-sys/v2_66) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_64) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.66 %description -n %{name}+v2_66-devel %{_description} @@ -174,6 +179,7 @@ Provides: crate(glib-sys/v2_68) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_66) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.68 %description -n %{name}+v2_68-devel %{_description} @@ -190,6 +196,7 @@ Provides: crate(glib-sys/v2_70) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_68) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.70 %description -n %{name}+v2_70-devel %{_description} @@ -206,6 +213,7 @@ Provides: crate(glib-sys/v2_72) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_70) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.72 %description -n %{name}+v2_72-devel %{_description} @@ -222,6 +230,7 @@ Provides: crate(glib-sys/v2_74) = 0.17.2 Requires: cargo Requires: crate(glib-sys) = 0.17.2 Requires: crate(glib-sys/v2_72) = 0.17.2 +Requires: pkgconfig(glib-2.0) >= 2.74 %description -n %{name}+v2_74-devel %{_description}