diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fb64f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/rcgen-0.13.1.crate diff --git a/0001-fix-compilation-failure-of-OpenSSL-tests-on-32-bit-a.patch b/0001-fix-compilation-failure-of-OpenSSL-tests-on-32-bit-a.patch new file mode 100644 index 0000000..ea68434 --- /dev/null +++ b/0001-fix-compilation-failure-of-OpenSSL-tests-on-32-bit-a.patch @@ -0,0 +1,29 @@ +From bab763ebedbf03d7f4cc6c139fce4d1005fcb1e8 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Fri, 13 Sep 2024 17:31:15 +0200 +Subject: [PATCH] fix compilation failure of OpenSSL tests on 32-bit arches + +--- + tests/openssl.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/openssl.rs b/tests/openssl.rs +index 478f565..bf7c756 100644 +--- a/tests/openssl.rs ++++ b/tests/openssl.rs +@@ -423,10 +423,10 @@ fn test_openssl_crl_parse() { + // The properties of the CRL should match expected. + let openssl_issuer = X509::from_der(issuer.der()).unwrap(); + let expected_last_update = +- Asn1Time::from_unix(crl.params().this_update.unix_timestamp()).unwrap(); ++ Asn1Time::from_unix(crl.params().this_update.unix_timestamp().try_into().unwrap()).unwrap(); + assert!(openssl_crl.last_update().eq(&expected_last_update)); + let expected_next_update = +- Asn1Time::from_unix(crl.params().next_update.unix_timestamp()).unwrap(); ++ Asn1Time::from_unix(crl.params().next_update.unix_timestamp().try_into().unwrap()).unwrap(); + assert!(openssl_crl.next_update().unwrap().eq(&expected_next_update)); + assert!(matches!( + openssl_crl +-- +2.46.0 + diff --git a/README.md b/README.md deleted file mode 100644 index 7c6f6c2..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rust-rcgen - -The rust-rcgen package diff --git a/rcgen-fix-metadata.diff b/rcgen-fix-metadata.diff new file mode 100644 index 0000000..3a9ccf7 --- /dev/null +++ b/rcgen-fix-metadata.diff @@ -0,0 +1,74 @@ +--- rcgen-0.13.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ rcgen-0.13.1/Cargo.toml 2024-09-13T15:16:18.687118+00:00 +@@ -43,22 +43,11 @@ + required-features = ["pem"] + + [[example]] +-name = "sign-leaf-with-ca" +-required-features = [ +- "pem", +- "x509-parser", +-] +- +-[[example]] + name = "simple" + required-features = [ + "crypto", + "pem", + ] +- +-[dependencies.aws-lc-rs] +-version = "1.6.0" +-optional = true + + [dependencies.pem] + version = "3.0.2" +@@ -76,11 +65,6 @@ + version = "0.3.6" + default-features = false + +-[dependencies.x509-parser] +-version = "0.16" +-features = ["verify"] +-optional = true +- + [dependencies.yasna] + version = "0.5.2" + features = [ +@@ -91,10 +75,6 @@ + [dependencies.zeroize] + version = "1.2" + optional = true +- +-[dev-dependencies.botan] +-version = "0.10" +-features = ["vendored"] + + [dev-dependencies.openssl] + version = "0.10" +@@ -116,25 +96,13 @@ + version = "0.102" + features = ["std"] + +-[dev-dependencies.x509-parser] +-version = "0.16" +-features = ["verify"] +- + [features] +-aws_lc_rs = [ +- "crypto", +- "dep:aws-lc-rs", +-] + crypto = [] + default = [ + "crypto", + "pem", + "ring", + ] +-fips = [ +- "aws_lc_rs", +- "aws-lc-rs?/fips", +-] + ring = [ + "crypto", + "dep:ring", diff --git a/rust-rcgen.spec b/rust-rcgen.spec new file mode 100644 index 0000000..5ea877d --- /dev/null +++ b/rust-rcgen.spec @@ -0,0 +1,126 @@ +# Generated by rust2rpm 26 +%bcond_without check +%global debug_package %{nil} + +%global crate rcgen + +Name: rust-rcgen +Version: 0.13.1 +Release: %autorelease +Summary: Rust X.509 certificate generator + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/rcgen +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# * drop unused support for the aws-lc-rs crypto backend +# * drop unused x509-parser support +# * drop botan dev-dependency (Rust bindings for botan are not packaged) +Patch: rcgen-fix-metadata.diff +# * https://github.com/rustls/rcgen/pull/290 +Patch: 0001-fix-compilation-failure-of-OpenSSL-tests-on-32-bit-a.patch + +BuildRequires: cargo-rpm-macros >= 24 + +%global _description %{expand: +Rust X.509 certificate generator.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/CHANGELOG.md +%doc %{crate_instdir}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+crypto-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+crypto-devel %{_description} + +This package contains library source intended for building other packages which +use the "crypto" feature of the "%{crate}" crate. + +%files -n %{name}+crypto-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pem-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+pem-devel %{_description} + +This package contains library source intended for building other packages which +use the "pem" feature of the "%{crate}" crate. + +%files -n %{name}+pem-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ring-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+ring-devel %{_description} + +This package contains library source intended for building other packages which +use the "ring" feature of the "%{crate}" crate. + +%files -n %{name}+ring-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zeroize-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+zeroize-devel %{_description} + +This package contains library source intended for building other packages which +use the "zeroize" feature of the "%{crate}" crate. + +%files -n %{name}+zeroize-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep +# drop example that depends on x509-parser support +rm examples/sign-leaf-with-ca.rs + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..cdf73f8 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,13 @@ +[package] +cargo-toml-patch-comments = [ + "drop unused support for the aws-lc-rs crypto backend", + "drop unused x509-parser support", + "drop botan dev-dependency (Rust bindings for botan are not packaged)", +] + +[scripts] +prep.post = [ + "# drop example that depends on x509-parser support", + "rm examples/sign-leaf-with-ca.rs", +] + diff --git a/sources b/sources new file mode 100644 index 0000000..ec31b5a --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (rcgen-0.13.1.crate) = f4d8ba116e907bd4e6a7f261c8b8325909ca619380d048325e456b037570ce3ca01d0d2b68577d085606250796e97129f86db383e20d7ece62a603baeb45f703