From 57ce51169f4cd8d6f92ed4af23e3b66465906b2d Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Wed, 18 Oct 2023 22:55:58 +0200 Subject: [PATCH] Initial import (#2241633) --- .gitignore | 1 + ...ests-that-can-only-be-run-on-Windows.patch | 34 ++++++ README.md | 3 - rust-widestring.spec | 102 ++++++++++++++++++ sources | 1 + widestring-fix-metadata.diff | 13 +++ 6 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 0001-drop-doctests-that-can-only-be-run-on-Windows.patch delete mode 100644 README.md create mode 100644 rust-widestring.spec create mode 100644 sources create mode 100644 widestring-fix-metadata.diff diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecf9981 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/widestring-1.0.2.crate diff --git a/0001-drop-doctests-that-can-only-be-run-on-Windows.patch b/0001-drop-doctests-that-can-only-be-run-on-Windows.patch new file mode 100644 index 0000000..0589107 --- /dev/null +++ b/0001-drop-doctests-that-can-only-be-run-on-Windows.patch @@ -0,0 +1,34 @@ +From dc351ced4049f1349d9eb183bbc24e33d0cceb40 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Sun, 1 Oct 2023 15:57:10 +0200 +Subject: [PATCH] drop doctests that can only be run on Windows + +--- + src/lib.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index e211e24..3d41bc8 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -122,7 +122,7 @@ + //! returns a string length for us and we don't need to pass error messages into other FFI + //! functions so we don't need to worry about nul values. + //! +-//! ```rust ++//! ```rust,ignore + //! # #[cfg(any(not(windows), not(feature = "alloc")))] + //! # fn main() {} + //! # extern crate winapi; +@@ -166,7 +166,7 @@ + //! + //! The following example is the functionally the same, only using [`U16CString`] instead. + //! +-//! ```rust ++//! ```rust,ignore + //! # #[cfg(any(not(windows), not(feature = "alloc")))] + //! # fn main() {} + //! # extern crate winapi; +-- +2.41.0 + diff --git a/README.md b/README.md deleted file mode 100644 index c6f0938..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rust-widestring - -The rust-widestring package diff --git a/rust-widestring.spec b/rust-widestring.spec new file mode 100644 index 0000000..561498c --- /dev/null +++ b/rust-widestring.spec @@ -0,0 +1,102 @@ +# Generated by rust2rpm 24 +%bcond_without check +%global debug_package %{nil} + +%global crate widestring + +Name: rust-widestring +Version: 1.0.2 +Release: %autorelease +Summary: Converting to and from wide strings (UTF-16 and UTF-32) + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/widestring +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# * drop Windows-specific dev-dependency +Patch: widestring-fix-metadata.diff +# * drop tests that can only be run on windows +Patch: 0001-drop-doctests-that-can-only-be-run-on-Windows.patch + +BuildRequires: rust-packaging >= 21 + +%global _description %{expand: +A wide string Rust library for converting to and from wide strings, such +as those often used in Windows API or other FFI libaries. Both `u16` and +`u32` string types are provided, including support for UTF-16 and +UTF-32, malformed encoding, C-style strings, etc.} + +%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}/LICENSES/Apache-2.0.txt +%license %{crate_instdir}/LICENSES/MIT.txt +%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}+alloc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+alloc-devel %{_description} + +This package contains library source intended for building other packages which +use the "alloc" feature of the "%{crate}" crate. + +%files -n %{name}+alloc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+std-devel %{_description} + +This package contains library source intended for building other packages which +use the "std" feature of the "%{crate}" crate. + +%files -n %{name}+std-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..1c38a19 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (widestring-1.0.2.crate) = cbebac37d87808e791d7839ad69e0b86af49b0e8a354a22e11797915c719937ed5b0cb638e5afc9d710cd1e073eaa9f7db76cd3ca1ec35a71b565f0b8f55407b diff --git a/widestring-fix-metadata.diff b/widestring-fix-metadata.diff new file mode 100644 index 0000000..be7d95f --- /dev/null +++ b/widestring-fix-metadata.diff @@ -0,0 +1,13 @@ +--- widestring-1.0.2/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ widestring-1.0.2/Cargo.toml 2023-10-01T13:57:33.483751+00:00 +@@ -43,10 +43,6 @@ + "docsrs", + ] + +-[dev-dependencies.winapi] +-version = "0.3" +-features = ["winbase"] +- + [features] + alloc = [] + default = ["std"]