From ff99beaf9defd972a98c6442f4d2ec076e67a185 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 14 Apr 2023 16:16:55 +0200 Subject: [PATCH] Expose features for crypto backends without setting a default --- rust-sequoia-policy-config.spec | 38 ++++++++++++++++---- rust2rpm.conf | 3 ++ sequoia-policy-config-fix-metadata-auto.diff | 2 +- sequoia-policy-config-fix-metadata.diff | 25 ++++++------- 4 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 rust2rpm.conf diff --git a/rust-sequoia-policy-config.spec b/rust-sequoia-policy-config.spec index 394f39f..2a32e6e 100644 --- a/rust-sequoia-policy-config.spec +++ b/rust-sequoia-policy-config.spec @@ -14,7 +14,7 @@ Source: %{crates_source} # Automatically generated patch to strip foreign dependencies Patch: sequoia-policy-config-fix-metadata-auto.diff # Manually created patch for downstream crate metadata changes -# * default to the OpenSSL crypto backend of sequoia-openpgp +# * expose features for crypto backends without setting a default Patch: sequoia-policy-config-fix-metadata.diff BuildRequires: rust-packaging >= 23 @@ -73,24 +73,48 @@ use the "default" feature of the "%{crate}" crate. %files -n %{name}+default-devel %ghost %{crate_instdir}/Cargo.toml +%package -n %{name}+crypto-nettle-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+crypto-nettle-devel %{_description} + +This package contains library source intended for building other packages which +use the "crypto-nettle" feature of the "%{crate}" crate. + +%files -n %{name}+crypto-nettle-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+crypto-openssl-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+crypto-openssl-devel %{_description} + +This package contains library source intended for building other packages which +use the "crypto-openssl" feature of the "%{crate}" crate. + +%files -n %{name}+crypto-openssl-devel +%ghost %{crate_instdir}/Cargo.toml + %prep %autosetup -n %{crate}-%{version_no_tilde} -p1 %cargo_prep %generate_buildrequires -%cargo_generate_buildrequires +%cargo_generate_buildrequires -f crypto-openssl %build -%cargo_build -%cargo_license_summary -%{cargo_license} > LICENSE.dependencies +%cargo_build -f crypto-openssl +%cargo_license_summary -f crypto-openssl +%{cargo_license -f crypto-openssl} > LICENSE.dependencies %install -%cargo_install +%cargo_install -f crypto-openssl %if %{with check} %check -%cargo_test +%cargo_test -f crypto-openssl %endif %changelog diff --git a/rust2rpm.conf b/rust2rpm.conf new file mode 100644 index 0000000..3d6fb3b --- /dev/null +++ b/rust2rpm.conf @@ -0,0 +1,3 @@ +[DEFAULT] +enabled-features = + crypto-openssl diff --git a/sequoia-policy-config-fix-metadata-auto.diff b/sequoia-policy-config-fix-metadata-auto.diff index 946486d..116c018 100644 --- a/sequoia-policy-config-fix-metadata-auto.diff +++ b/sequoia-policy-config-fix-metadata-auto.diff @@ -1,5 +1,5 @@ --- sequoia-policy-config-0.6.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ sequoia-policy-config-0.6.0/Cargo.toml 2023-03-06T18:28:15.678853+00:00 ++++ sequoia-policy-config-0.6.0/Cargo.toml 2023-04-14T14:25:27.053943+00:00 @@ -67,10 +67,5 @@ features = ["crypto-nettle"] default-features = false diff --git a/sequoia-policy-config-fix-metadata.diff b/sequoia-policy-config-fix-metadata.diff index 3211b88..c718d82 100644 --- a/sequoia-policy-config-fix-metadata.diff +++ b/sequoia-policy-config-fix-metadata.diff @@ -1,19 +1,16 @@ --- sequoia-policy-config-0.6.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ sequoia-policy-config-0.6.0/Cargo.toml 2023-03-06T18:28:37.885896+00:00 -@@ -45,6 +45,7 @@ ++++ sequoia-policy-config-0.6.0/Cargo.toml 2023-04-14T14:26:00.154080+00:00 +@@ -62,10 +62,9 @@ + [dev-dependencies.lazy_static] + version = "1.4.0" - [dependencies.sequoia-openpgp] - version = "1.11" -+features = ["crypto-openssl"] - default-features = false - - [dependencies.serde] -@@ -64,7 +65,7 @@ - - [target."cfg(not(windows))".dev-dependencies.sequoia-openpgp] - version = "1.11" +-[target."cfg(not(windows))".dev-dependencies.sequoia-openpgp] +-version = "1.11" -features = ["crypto-nettle"] -+features = ["crypto-openssl"] - default-features = false +-default-features = false ++[features] ++crypto-nettle = ["sequoia-openpgp/crypto-nettle"] ++crypto-openssl = ["sequoia-openpgp/crypto-openssl"] [badges.maintenance] + status = "actively-developed"