diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77253f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/openssl-0.9.21.crate diff --git a/0001-Upgrade-foreign-types.patch b/0001-Upgrade-foreign-types.patch new file mode 100644 index 0000000..0b04eba --- /dev/null +++ b/0001-Upgrade-foreign-types.patch @@ -0,0 +1,105 @@ +From e9ad9f1afd0429dd56af8e59ec9ad74020ca15e3 Mon Sep 17 00:00:00 2001 +From: Steven Fackler +Date: Sun, 26 Nov 2017 17:07:24 -0700 +Subject: [PATCH] Upgrade foreign-types + +foreign-types 0.3 and 0.2 now share the same types and traits, so this +is backwards compatible. +--- + openssl/src/bn.rs | 6 ------ + openssl/src/ssl/mod.rs | 10 +--------- + openssl/src/x509/mod.rs | 13 ------------- + 3 files changed, 1 insertion(+), 28 deletions(-) + +diff --git a/openssl/src/bn.rs b/openssl/src/bn.rs +index fc6e0bb8..82ec38b6 100644 +--- a/openssl/src/bn.rs ++++ b/openssl/src/bn.rs +@@ -1090,12 +1090,6 @@ impl BigNum { + } + } + +-impl AsRef for BigNum { +- fn as_ref(&self) -> &BigNumRef { +- self.deref() +- } +-} +- + impl fmt::Debug for BigNumRef { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.to_dec_str() { +diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs +index 176863d6..e135535a 100644 +--- a/openssl/src/ssl/mod.rs ++++ b/openssl/src/ssl/mod.rs +@@ -76,7 +76,6 @@ use libc::{c_int, c_long, c_ulong, c_void}; + use libc::{c_uchar, c_uint}; + use std::any::Any; + use std::any::TypeId; +-use std::borrow::Borrow; + use std::cmp; + use std::collections::HashMap; + use std::ffi::{CStr, CString}; +@@ -777,8 +776,7 @@ impl SslContextBuilder { + #[cfg(not(osslconf = "OPENSSL_NO_PSK"))] + pub fn set_psk_callback(&mut self, callback: F) + where +- F: Fn(&mut SslRef, Option<&[u8]>, &mut [u8], &mut [u8]) +- -> Result ++ F: Fn(&mut SslRef, Option<&[u8]>, &mut [u8], &mut [u8]) -> Result + + Any + + 'static + + Sync +@@ -1026,12 +1024,6 @@ impl Clone for SslSession { + } + } + +-impl Borrow for SslSession { +- fn borrow(&self) -> &SslSessionRef { +- &self +- } +-} +- + impl ToOwned for SslSessionRef { + type Owned = SslSession; + +diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs +index db61262c..dff65222 100644 +--- a/openssl/src/x509/mod.rs ++++ b/openssl/src/x509/mod.rs +@@ -2,7 +2,6 @@ + use libc::{c_int, c_long}; + use ffi; + use foreign_types::{ForeignType, ForeignTypeRef}; +-use std::borrow::Borrow; + use std::collections::HashMap; + use std::error::Error; + use std::ffi::{CStr, CString}; +@@ -620,24 +619,12 @@ impl Clone for X509 { + } + } + +-impl AsRef for X509 { +- fn as_ref(&self) -> &X509Ref { +- &*self +- } +-} +- + impl AsRef for X509Ref { + fn as_ref(&self) -> &X509Ref { + self + } + } + +-impl Borrow for X509 { +- fn borrow(&self) -> &X509Ref { +- &*self +- } +-} +- + impl Stackable for X509 { + type StackType = ffi::stack_st_X509; + } +-- +2.15.0 + diff --git a/openssl-0.9.21-fix-metadata.diff b/openssl-0.9.21-fix-metadata.diff new file mode 100644 index 0000000..daa114d --- /dev/null +++ b/openssl-0.9.21-fix-metadata.diff @@ -0,0 +1,25 @@ +--- openssl-0.9.21/Cargo.toml 1970-01-01T01:00:00+01:00 ++++ openssl-0.9.21/Cargo.toml 2017-11-28T23:11:48.449895+01:00 +@@ -33,11 +33,9 @@ + version = "0.2" + + [dependencies.foreign-types] +-version = "0.2" ++version = "0.3.1" + + [dependencies.lazy_static] +-version = "0.2" +-[dev-dependencies.winapi] + version = "0.2" + + [dev-dependencies.data-encoding] +@@ -49,9 +47,6 @@ + [dev-dependencies.hex] + version = "0.2" + +-[dev-dependencies.ws2_32-sys] +-version = "0.2" +- + [features] + v102 = [] + v110 = [] diff --git a/rust-openssl.spec b/rust-openssl.spec new file mode 100644 index 0000000..a97b555 --- /dev/null +++ b/rust-openssl.spec @@ -0,0 +1,85 @@ +# Generated by rust2rpm +# Tests require internet connection +%bcond_with check +%global debug_package %{nil} + +%global crate openssl + +Name: rust-%{crate} +Version: 0.9.21 +Release: 1%{?dist} +Summary: OpenSSL bindings + +License: ASL 2.0 +URL: https://crates.io/crates/openssl +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * No windows +# * Bump foreign-types to 0.3, https://github.com/sfackler/rust-openssl/commit/e9ad9f1afd0429dd56af8e59ec9ad74020ca15e3 +Patch0: openssl-0.9.21-fix-metadata.diff +# Make it work with foreign-types v0.3 +Patch1: 0001-Upgrade-foreign-types.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(bitflags) >= 0.9.0 with crate(bitflags) < 0.10.0) +BuildRequires: (crate(foreign-types) >= 0.3.1 with crate(foreign-types) < 0.4.0) +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) +BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0) +BuildRequires: (crate(openssl-sys) >= 0.9.21 with crate(openssl-sys) < 0.10.0) +%if %{with check} +# [dev-dependencies] +BuildRequires: (crate(data-encoding) >= 2.0.0 with crate(data-encoding) < 3.0.0) +BuildRequires: (crate(hex) >= 0.2.0 with crate(hex) < 0.3.0) +BuildRequires: (crate(tempdir) >= 0.3.0 with crate(tempdir) < 0.4.0) +%endif + +%description +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +OpenSSL bindings. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -N +%patch0 -p1 +%patch1 -p2 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files devel +%license LICENSE +%doc README.md +%{cargo_registry}/%{crate}-%{version}/ + +%changelog +* Tue Nov 21 2017 Igor Gnatenko - 0.9.21-1 +- Update to 0.9.21 + +* Thu Jun 15 2017 Igor Gnatenko - 0.9.14-1 +- Update to 0.9.14 + +* Wed Jun 14 2017 Igor Gnatenko - 0.9.10-2 +- Port to use rust-packaging + +* Mon Apr 03 2017 Igor Gnatenko - 0.9.10-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..6645aed --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (openssl-0.9.21.crate) = 9758eb2956961add36b667ddb590a6cb9b9fc225e22917e3e8f2392e0bf10569affeb726d4e575e0581cdc3ad6daee484737602fb6871ed267836c88f9ce7d43