diff --git a/.gitignore b/.gitignore index ec9dee5..728c321 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /libbpf-rs-0.11.2.crate /libbpf-rs-0.13.0.crate /libbpf-rs-0.14.0.crate +/libbpf-rs-0.16.0.crate diff --git a/libbpf-rs-downgrade-libbpf-sys-050.patch b/libbpf-rs-downgrade-libbpf-sys-050.patch new file mode 100644 index 0000000..cf26193 --- /dev/null +++ b/libbpf-rs-downgrade-libbpf-sys-050.patch @@ -0,0 +1,38 @@ +diff -ruN libbpf-rs-0.16.0/Cargo.toml libbpf-rs-0.16.0-downgrade-to-0.5.0/Cargo.toml +--- libbpf-rs-0.16.0/Cargo.toml 1969-12-31 16:00:01.000000000 -0800 ++++ libbpf-rs-0.16.0-downgrade-to-0.5.0/Cargo.toml 2022-02-15 15:44:14.990476446 -0800 +@@ -27,7 +27,7 @@ + version = "1.4" + + [dependencies.libbpf-sys] +-version = "0.6.0-1" ++version = "0.5.0-2" + + [dependencies.nix] + version = "0.22" +diff -ruN libbpf-rs-0.16.0/src/perf_buffer.rs libbpf-rs-0.16.0-downgrade-to-0.5.0/src/perf_buffer.rs +--- libbpf-rs-0.16.0/src/perf_buffer.rs 1973-11-29 13:33:09.000000000 -0800 ++++ libbpf-rs-0.16.0-downgrade-to-0.5.0/src/perf_buffer.rs 2022-02-15 15:43:29.766306029 -0800 +@@ -106,15 +106,14 @@ + lost_cb: self.lost_cb, + })); + ++ let opts = libbpf_sys::perf_buffer_opts { ++ sample_cb: c_sample_cb, ++ lost_cb: c_lost_cb, ++ ctx: callback_struct_ptr as *mut _, ++ }; ++ + let ptr = unsafe { +- libbpf_sys::perf_buffer__new( +- self.map.fd(), +- self.pages as libbpf_sys::size_t, +- c_sample_cb, +- c_lost_cb, +- callback_struct_ptr as *mut _, +- std::ptr::null(), +- ) ++ libbpf_sys::perf_buffer__new(self.map.fd(), self.pages as libbpf_sys::size_t, &opts) + }; + let err = unsafe { libbpf_sys::libbpf_get_error(ptr as *const _) }; + if err != 0 { diff --git a/libbpf-rs-fix-metadata.diff b/libbpf-rs-fix-metadata.diff index cc12c7a..37d5a8f 100644 --- a/libbpf-rs-fix-metadata.diff +++ b/libbpf-rs-fix-metadata.diff @@ -1,7 +1,7 @@ ---- libbpf-rs-0.14.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libbpf-rs-0.14.0/Cargo.toml 2021-11-11T15:36:19.239207+00:00 -@@ -50,6 +50,7 @@ - version = "1.1" +--- libbpf-rs-0.16.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libbpf-rs-0.16.0/Cargo.toml 2022-02-15T19:34:00.245553+00:00 +@@ -59,6 +59,7 @@ + version = "0.5" [features] +default = ["novendor"] diff --git a/rust-libbpf-rs.spec b/rust-libbpf-rs.spec index d65d358..515e173 100644 --- a/rust-libbpf-rs.spec +++ b/rust-libbpf-rs.spec @@ -1,12 +1,11 @@ -# Generated by rust2rpm 18 -# Tests don't work in mock at the moment -%bcond_with check +# Generated by rust2rpm 20 +%bcond_without check %global debug_package %{nil} %global crate libbpf-rs Name: rust-%{crate} -Version: 0.14.0 +Version: 0.16.0 Release: %autorelease Summary: Safe, idiomatic, and opinionated wrapper around libbpf-sys @@ -19,11 +18,10 @@ Patch0: libbpf-rs-fix-metadata.diff # Downgrade libbpf-sys to 0.4.0-2; this patch is meant for Fedora 35 and lower # where libbpf is still at 0.4.0 Patch1: libbpf-rs-downgrade-libbpf-sys.patch +# Downgrade libbpf-sys to 0.5.0-2 (for Fedora 36) +Patch2: libbpf-rs-downgrade-libbpf-sys-050.patch ExclusiveArch: %{rust_arches} -%if %{__cargo_skip_build} -BuildArch: noarch -%endif BuildRequires: rust-packaging @@ -38,8 +36,8 @@ BuildArch: noarch %description devel %{_description} -This package contains library source intended for building other packages -which use "%{crate}" crate. +This package contains library source intended for building other packages which +use the "%{crate}" crate. %files devel %license LICENSE LICENSE.BSD-2-Clause LICENSE.LPGL-2.1 @@ -52,8 +50,8 @@ BuildArch: noarch %description -n %{name}+default-devel %{_description} -This package contains library source intended for building other packages -which use "default" feature of "%{crate}" crate. +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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml @@ -64,8 +62,8 @@ BuildArch: noarch %description -n %{name}+novendor-devel %{_description} -This package contains library source intended for building other packages -which use "novendor" feature of "%{crate}" crate. +This package contains library source intended for building other packages which +use the "novendor" feature of the "%{crate}" crate. %files -n %{name}+novendor-devel %ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml @@ -75,6 +73,12 @@ which use "novendor" feature of "%{crate}" crate. %patch0 -p1 %if 0%{?fedora} < 36 %patch1 -p1 +%else +%if 0%{?fc36} +%patch2 -p1 +%else +sed -i -e 's/version = "0.6.0-1"/version = "0.6.1-2"/' Cargo.toml +%endif %endif %cargo_prep @@ -89,6 +93,8 @@ which use "novendor" feature of "%{crate}" crate. %if %{with check} %check +# most of these tests fail, RLIMIT_MEMLOCK does not work in mock +rm tests/test.rs %cargo_test %endif diff --git a/sources b/sources index 70245d8..34bf409 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libbpf-rs-0.14.0.crate) = a1400f76939c17a608396ddd3bd9c565df16e0515fc397f1b7e6f72c6145eae7b239bd3b06c0e3803ee815666f9ad546ff53ca718892fc25132ec87292df0358 +SHA512 (libbpf-rs-0.16.0.crate) = df3f928dbe0e9e7272ada339eec55080e6b32f01f9dc6552b59b02e2f0b46c4a23ae84ffca4e48e4d3d69325d4d0f1d4c3e0442e48922edf42baa482c4dfe102