From 51c46d5d48507ae44f565bcfc5a7ae9de5169078 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Feb 01 2022 01:45:38 +0000 Subject: Rework patches Signed-off-by: Michel Alexandre Salim --- diff --git a/pipewire-0.4.1-cast-on-32bit.patch b/pipewire-0.4.1-cast-on-32bit.patch index ff5f19f..c48133d 100644 --- a/pipewire-0.4.1-cast-on-32bit.patch +++ b/pipewire-0.4.1-cast-on-32bit.patch @@ -1,12 +1,38 @@ diff -ruN pipewire-0.4.1/src/loop_.rs pipewire-0.4.1-cast-on-32bit/src/loop_.rs --- pipewire-0.4.1/src/loop_.rs 1973-11-29 13:33:09.000000000 -0800 -+++ pipewire-0.4.1-cast-on-32bit/src/loop_.rs 2022-01-31 16:03:11.772091123 -0800 -@@ -411,7 +411,7 @@ ++++ pipewire-0.4.1-cast-on-32bit/src/loop_.rs 2022-01-31 18:10:51.007062309 -0800 +@@ -408,12 +408,34 @@ + /// # Panics + /// The provided durations seconds must fit in an i64. Otherwise, this function will panic. + pub fn update_timer(&self, value: Option, interval: Option) -> SpaResult { ++ #[cfg(target_pointer_width = "64")] fn duration_to_timespec(duration: Duration) -> spa_sys::timespec { spa_sys::timespec { tv_sec: duration.as_secs().try_into().expect("Duration too long"), -- tv_nsec: duration.subsec_nanos().into(), -+ tv_nsec: (duration.subsec_nanos() as i32).into(), + tv_nsec: duration.subsec_nanos().into(), } } ++ // fix for this error on 32-bit architectures ++ // error[E0277]: the trait bound `i32: From` is not satisfied ++ // --> src/loop_.rs:414:50 ++ // | ++ // 414 | tv_nsec: duration.subsec_nanos().into(), ++ // | ^^^^ the trait `From` is not implemented for `i32` ++ // | ++ // = help: the following implementations were found: ++ // > ++ // > ++ // > ++ // > ++ // and 3 others ++ // = note: required because of the requirements on the impl of `Into` for `u32` ++ #[cfg(target_pointer_width = "32")] ++ fn duration_to_timespec(duration: Duration) -> spa_sys::timespec { ++ spa_sys::timespec { ++ tv_sec: duration.as_secs().try_into().expect("Duration too long"), ++ tv_nsec: (duration.subsec_nanos() as i32).into(), ++ } ++ } + let value = duration_to_timespec(value.unwrap_or_default()); + let interval = duration_to_timespec(interval.unwrap_or_default()); diff --git a/pipewire-0.4.1-gate-x86-tests.patch b/pipewire-0.4.1-gate-x86-tests.patch new file mode 100644 index 0000000..106d5d7 --- /dev/null +++ b/pipewire-0.4.1-gate-x86-tests.patch @@ -0,0 +1,23 @@ +diff -ruN pipewire-0.4.1/src/properties.rs pipewire-0.4.1-gate-x86-tests/src/properties.rs +--- pipewire-0.4.1/src/properties.rs 1973-11-29 13:33:09.000000000 -0800 ++++ pipewire-0.4.1-gate-x86-tests/src/properties.rs 2022-01-31 17:34:53.086613397 -0800 +@@ -262,6 +262,19 @@ + assert_eq!(Some("V1"), props2.get("K1")); + } + ++ // fails outside x86* arches with: ++ // error[E0308]: mismatched types ++ // --> src/properties.rs:270:24 ++ // | ++ // 270 | let dict = static_dict! { "K0" => "V0" }; ++ // | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8` ++ // | ++ // = note: expected raw pointer `*const u8` ++ // found raw pointer `*const i8` ++ // = note: this error originates in the macro `static_dict` (in Nightly builds, run with -Z macro-backtrace for more info) ++ // ++ // For more information about this error, try `rustc --explain E0308`. ++ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn from_dict() { + use spa::static_dict; diff --git a/rust-pipewire.spec b/rust-pipewire.spec index 33b8314..57bb737 100644 --- a/rust-pipewire.spec +++ b/rust-pipewire.spec @@ -1,12 +1,5 @@ # Generated by rust2rpm 20 -%ifarch %{ix86} x86_64 %bcond_without check -%else -# armv7hl, aarch64, ppc64le, s390: -# the test using static_dict! is failing with E0308 -# expected *const u8, got *const i8 -%bcond_without check -%endif %global debug_package %{nil} %global crate pipewire @@ -20,20 +13,11 @@ Summary: Rust bindings for PipeWire License: MIT URL: https://crates.io/crates/pipewire Source: %{crates_source} -# error[E0277]: the trait bound `i32: From` is not satisfied -# --> src/loop_.rs:414:50 -# | -# 414 | tv_nsec: duration.subsec_nanos().into(), -# | ^^^^ the trait `From` is not implemented for `i32` -# | -# = help: the following implementations were found: -# > -# > -# > -# > -# and 3 others -# = note: required because of the requirements on the impl of `Into` for `u32` +# duration.subsec_nanos() is u32 on 32-bit, needs casting Patch0: %{crate}-0.4.1-cast-on-32bit.patch +# the test using static_dict! is failing with E0308 +# expected *const u8, got *const i8 +Patch1: %{crate}-0.4.1-gate-x86-tests.patch ExclusiveArch: %{rust_arches} @@ -70,10 +54,7 @@ use the "default" feature of the "%{crate}" crate. %ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %prep -%setup -n %{crate}-%{version_no_tilde} -q -%ifarch %{arm} %{ix86} -%patch0 -p1 -%endif +%autosetup -n %{crate}-%{version_no_tilde} -p1 %cargo_prep %generate_buildrequires