Update to 0.9.2; Fixes: RHBZ#1989691

epel9
Davide Cavalca 3 years ago
parent f02d851334
commit aef6523e15

1
.gitignore vendored

@ -1,3 +1,4 @@
/libbpf-cargo-0.7.1.crate /libbpf-cargo-0.7.1.crate
/libbpf-cargo-0.7.2.crate /libbpf-cargo-0.7.2.crate
/libbpf-cargo-0.8.1.crate /libbpf-cargo-0.8.1.crate
/libbpf-cargo-0.9.2.crate

@ -0,0 +1,10 @@
--- libbpf-cargo-0.9.2/Cargo.toml 1970-01-01T00:00:01+00:00
+++ libbpf-cargo-0.9.2/Cargo.toml 2021-10-14T20:31:08.630116+00:00
@@ -74,6 +74,7 @@
version = "0.2"
[features]
+default = ["novendor"]
novendor = ["libbpf-sys/novendor"]
[badges.maintenance]
status = "actively-developed"

@ -1,78 +0,0 @@
diff -Naur a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml 1969-12-31 16:00:00.000000000 -0800
+++ b/Cargo.toml 2021-07-29 14:53:18.250244180 -0700
@@ -26,6 +26,10 @@
[lib]
path = "src/lib.rs"
+[features]
+default = ["novendor"]
+novendor = ["libbpf-sys/novendor"]
+
[[bin]]
name = "cargo-libbpf"
path = "src/main.rs"
diff -Naur a/src/build.rs b/src/build.rs
--- a/src/build.rs 1969-12-31 16:00:00.000000000 -0800
+++ b/src/build.rs 2021-07-29 14:52:48.099107574 -0700
@@ -1,7 +1,5 @@
use std::collections::HashSet;
use std::fs;
-use std::fs::OpenOptions;
-use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::Command;
@@ -47,7 +45,11 @@
/// Extract vendored libbpf header files to a temporary directory.
///
/// Directory and enclosed contents will be removed when return object is dropped.
-fn extract_libbpf_headers_to_disk() -> Result<TempDir> {
+#[cfg(not(feature = "novendor"))]
+fn extract_libbpf_headers_to_disk() -> Result<Option<TempDir>> {
+ use std::fs::OpenOptions;
+ use std::io::Write;
+
let tempdir = TempDir::new()?;
let dir = tempdir.path().join("bpf");
fs::create_dir_all(&dir)?;
@@ -57,7 +59,12 @@
file.write_all(contents.as_bytes())?;
}
- Ok(tempdir)
+ Ok(Some(tempdir))
+}
+
+#[cfg(feature = "novendor")]
+fn extract_libbpf_headers_to_disk() -> Result<Option<TempDir>> {
+ return Ok(None);
}
fn check_clang(debug: bool, clang: &Path, skip_version_checks: bool) -> Result<()> {
@@ -148,7 +155,11 @@
fn compile(debug: bool, objs: &[UnprocessedObj], clang: &Path) -> Result<()> {
let header_dir = extract_libbpf_headers_to_disk()?;
- let compiler_options = format!("-I{}", header_dir.path().to_str().unwrap());
+ let compiler_options = if let Some(dir) = &header_dir {
+ format!("-I{}", dir.path().to_str().unwrap())
+ } else {
+ "".to_string()
+ };
for obj in objs {
let dest_name = if let Some(f) = obj.path.file_stem() {
@@ -222,7 +233,11 @@
let clang = extract_clang_or_default(clang);
check_clang(debug, &clang, skip_clang_version_checks)?;
let header_dir = extract_libbpf_headers_to_disk()?;
- let compiler_options = format!("{} -I{}", options, header_dir.path().to_str().unwrap());
+ let compiler_options = if let Some(dir) = &header_dir {
+ format!("{} -I{}", options, dir.path().to_str().unwrap())
+ } else {
+ options.to_string()
+ };
compile_one(debug, source, out, &clang, &compiler_options)?;
Ok(())

@ -4,7 +4,7 @@
%global crate libbpf-cargo %global crate libbpf-cargo
Name: rust-%{crate} Name: rust-%{crate}
Version: 0.8.1 Version: 0.9.2
Release: %autorelease Release: %autorelease
Summary: Cargo plugin to build bpf programs Summary: Cargo plugin to build bpf programs
@ -12,8 +12,8 @@ Summary: Cargo plugin to build bpf programs
License: LGPLv2 or BSD License: LGPLv2 or BSD
URL: https://crates.io/crates/libbpf-cargo URL: https://crates.io/crates/libbpf-cargo
Source: %{crates_source} Source: %{crates_source}
# PR#125: libbpf-rs, libbpf-cargo: Support novendor feature # Turn on the novendor feature by default
Patch0: libbpf-cargo-novendor.patch Patch0: libbpf-cargo-fix-metadata.diff
ExclusiveArch: %{rust_arches} ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build} %if %{__cargo_skip_build}

@ -1 +1 @@
SHA512 (libbpf-cargo-0.8.1.crate) = 2eedf493e650aadfc4946fab1103dbc6491141d2a548cbaac328b61c9fae5dd46ca689ef8ee12d8848a996510fed7ed9bc22b0a34a21f2951a893003d17e12d6 SHA512 (libbpf-cargo-0.9.2.crate) = 7ab7c4b46a8c44f5f69eb3779af8cbabb17a8dfc50fe6c226420b8fc7ba6a7f36ddc70e65fbeb9be4e51efc32abb8f01bf7a9343814b407f3a0737fedd06cce9

Loading…
Cancel
Save