From dec2498bd51e0eaecd71ba199bf414b430ef5394 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Wed, 16 Feb 2022 14:05:14 -0800 Subject: [PATCH] Update to 0.10.0 (resolves: rhbz#2028951) Signed-off-by: Michel Alexandre Salim --- .gitignore | 5 +-- .rust2rpm.conf | 7 ++++ libbpf-cargo-fix-finding-libbpf-rs.patch | 15 ++++++++ libbpf-cargo-fix-metadata.diff | 4 +- rust-libbpf-cargo.spec | 48 +++++++++++------------- sources | 2 +- 6 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 .rust2rpm.conf create mode 100644 libbpf-cargo-fix-finding-libbpf-rs.patch diff --git a/.gitignore b/.gitignore index 62e79b2..f691761 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -/libbpf-cargo-0.7.1.crate -/libbpf-cargo-0.7.2.crate -/libbpf-cargo-0.8.1.crate -/libbpf-cargo-0.9.2.crate /libbpf-cargo-0.9.3.crate +/libbpf-cargo-0.10.0.crate diff --git a/.rust2rpm.conf b/.rust2rpm.conf new file mode 100644 index 0000000..7e2b391 --- /dev/null +++ b/.rust2rpm.conf @@ -0,0 +1,7 @@ +[DEFAULT] +buildrequires = + clang + rustfmt +lib.requires = + clang + rustfmt diff --git a/libbpf-cargo-fix-finding-libbpf-rs.patch b/libbpf-cargo-fix-finding-libbpf-rs.patch new file mode 100644 index 0000000..c1e2627 --- /dev/null +++ b/libbpf-cargo-fix-finding-libbpf-rs.patch @@ -0,0 +1,15 @@ +diff '--color=auto' -ruN libbpf-cargo-0.10.0/src/test.rs libbpf-cargo-0.10.0-fix-finding-libbpf-rs/src/test.rs +--- libbpf-cargo-0.10.0/src/test.rs 1973-11-29 13:33:09.000000000 -0800 ++++ libbpf-cargo-0.10.0-fix-finding-libbpf-rs/src/test.rs 2022-02-16 15:36:05.637528820 -0800 +@@ -102,10 +102,7 @@ + fn get_libbpf_rs_path() -> PathBuf { + let cwd = std::env::current_dir().expect("failed to get cwd"); + +- Path::new(&cwd) +- .parent() +- .expect("failed to get parent of cwd") +- .join("libbpf-rs") ++ Path::new("/usr/share/cargo/registry/libbpf-rs-0.16.0") + .canonicalize() + .expect("failed to canonicalize libbpf-rs") + } diff --git a/libbpf-cargo-fix-metadata.diff b/libbpf-cargo-fix-metadata.diff index 60cbb9a..0aa7f96 100644 --- a/libbpf-cargo-fix-metadata.diff +++ b/libbpf-cargo-fix-metadata.diff @@ -1,5 +1,5 @@ ---- libbpf-cargo-0.9.3/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libbpf-cargo-0.9.3/Cargo.toml 2021-11-11T15:45:25.590082+00:00 +--- libbpf-cargo-0.10.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libbpf-cargo-0.10.0/Cargo.toml 2022-02-16T21:59:17.437128+00:00 @@ -74,6 +74,7 @@ version = "0.2" diff --git a/rust-libbpf-cargo.spec b/rust-libbpf-cargo.spec index dcc5040..1a3d957 100644 --- a/rust-libbpf-cargo.spec +++ b/rust-libbpf-cargo.spec @@ -1,10 +1,10 @@ -# Generated by rust2rpm 18 +# Generated by rust2rpm 20 %bcond_without check %global crate libbpf-cargo Name: rust-%{crate} -Version: 0.9.3 +Version: 0.10.0 Release: %autorelease Summary: Cargo plugin to build bpf programs @@ -14,27 +14,18 @@ URL: https://crates.io/crates/libbpf-cargo Source: %{crates_source} # Turn on the novendor feature by default Patch0: libbpf-cargo-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-cargo-downgrade-libbpf-sys.patch +# Fix finding libbpf-rs +Patch1: libbpf-cargo-fix-finding-libbpf-rs.patch ExclusiveArch: %{rust_arches} -%if %{__cargo_skip_build} -BuildArch: noarch -%endif BuildRequires: rust-packaging -%if %{with check} -BuildRequires: clang -BuildRequires: rustfmt -%endif %global _description %{expand: Cargo plugin to build bpf programs.} %description %{_description} -%if ! %{__cargo_skip_build} %package -n %{crate} Summary: %{summary} @@ -44,7 +35,6 @@ Summary: %{summary} %license LICENSE LICENSE.BSD-2-Clause LICENSE.LPGL-2.1 %doc README.md %{_bindir}/cargo-libbpf -%endif %package devel Summary: %{summary} @@ -54,8 +44,8 @@ Requires: rustfmt %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 @@ -68,8 +58,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 @@ -80,22 +70,30 @@ 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 %prep -%setup -q -n %{crate}-%{version_no_tilde} -%patch0 -p1 +%autosetup -n %{crate}-%{version_no_tilde} -p1 %if 0%{?fedora} < 36 -%patch1 -p1 +sed -i -e 's/version = "0.6.0-1"/version = "0.4.0-2"/' Cargo.toml +%else +%if 0%{?fc36} +sed -i -e 's/version = "0.6.0-1"/version = "0.5.0-2"/' Cargo.toml +%else +sed -i -e 's/version = "0.6.0-1"/version = "0.6.1-2"/' Cargo.toml +%endif %endif %cargo_prep %generate_buildrequires %cargo_generate_buildrequires +echo 'clang' +echo 'rust-libbpf-rs-devel' +echo 'rustfmt' %build %cargo_build @@ -105,9 +103,7 @@ which use "novendor" feature of "%{crate}" crate. %if %{with check} %check -# These tests don't work when run outside of the git repo -# https://github.com/libbpf/libbpf-rs/issues/107 -%cargo_test -- -- --skip test_skeleton_basic --skip test_skeleton_builder_basic --skip test_skeleton_datasec --skip test_skeleton_empty_source +%cargo_test %endif %changelog diff --git a/sources b/sources index 4e323d6..d440e81 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libbpf-cargo-0.9.3.crate) = 21586f94ed63901dae8d742c3bda3c9cc123b7ccc3533f80fbbceff8683733ff852813322393183f3c0c37d7f961b8c15df124f1379de95a099cbf4c7c3b343d +SHA512 (libbpf-cargo-0.10.0.crate) = 60533b247928b0d1c3d8136abedb1d0309d69bf96bf4b95a122082295a1da6af0ff73a44fd3498979990d002f33a1ff8152df46b58167c5278fc6ce4bdf5ac0c