diff --git a/libbpf-cargo-default-to-novendor.diff b/libbpf-cargo-default-to-novendor.diff new file mode 100644 index 0000000..410731c --- /dev/null +++ b/libbpf-cargo-default-to-novendor.diff @@ -0,0 +1,10 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -76,6 +76,7 @@ version = "1.0" + version = "0.5" + + [features] ++default = ["novendor"] + novendor = ["libbpf-sys/novendor"] + [badges.maintenance] + status = "actively-developed" diff --git a/libbpf-cargo-fix-metadata.diff b/libbpf-cargo-fix-metadata.diff index 9caee74..d045228 100644 --- a/libbpf-cargo-fix-metadata.diff +++ b/libbpf-cargo-fix-metadata.diff @@ -1,5 +1,5 @@ --- libbpf-cargo-0.13.1/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libbpf-cargo-0.13.1/Cargo.toml 2022-12-12T18:44:06.726590+00:00 ++++ libbpf-cargo-0.13.1/Cargo.toml 2023-01-30T20:36:09.129229+00:00 @@ -32,7 +32,7 @@ version = "1.0" @@ -9,7 +9,7 @@ [dependencies.clap] version = "3.1" -@@ -73,9 +73,10 @@ +@@ -73,7 +73,7 @@ [dependencies.thiserror] version = "1.0" [dev-dependencies.goblin] @@ -17,7 +17,4 @@ +version = "0.5" [features] -+default = ["novendor"] novendor = ["libbpf-sys/novendor"] - [badges.maintenance] - status = "actively-developed" diff --git a/rust-libbpf-cargo.spec b/rust-libbpf-cargo.spec index ebb6cc0..5d58b3d 100644 --- a/rust-libbpf-cargo.spec +++ b/rust-libbpf-cargo.spec @@ -3,6 +3,14 @@ %global crate libbpf-cargo +%if 0%{?fedora} == 38 +# Fedora 38's libbpf is new enough +# currently: 1.1.0 +%bcond_without novendor +%else +%bcond_with novendor +%endif + Name: rust-libbpf-cargo Version: 0.13.1 Release: %autorelease @@ -14,11 +22,12 @@ Source: %{crates_source} # Manually created patch for downstream crate metadata changes # - bump cargo_metadata to 0.15 # - bump goblin to 0.5 -# - use libbpf-sys/novendor by default Patch: libbpf-cargo-fix-metadata.diff # by default, test.rs expects libbpf-rs to be in the same checkout # fix to point to /usr/share/cargo/registry Patch: libbpf-cargo-fix-finding-libbpf-rs.diff +# Conditional patch for defaulting to novendor +Patch101: libbpf-cargo-default-to-novendor.diff BuildRequires: rust-packaging >= 21 @@ -69,6 +78,7 @@ use the "default" feature of the "%{crate}" crate. %files -n %{name}+default-devel %ghost %{crate_instdir}/Cargo.toml +%if %{with novendor} %package -n %{name}+novendor-devel Summary: %{summary} BuildArch: noarch @@ -80,9 +90,14 @@ use the "novendor" feature of the "%{crate}" crate. %files -n %{name}+novendor-devel %ghost %{crate_instdir}/Cargo.toml +%endif %prep -%autosetup -n %{crate}-%{version_no_tilde} -p1 +%autosetup -n %{crate}-%{version_no_tilde} -N +%autopatch -p1 -M 100 +%if %{with novendor} +%autopatch -p1 -m 101 +%endif %cargo_prep %generate_buildrequires