Update to 0.8.1; Fixes: RHBZ#1983186

epel9
Davide Cavalca 4 years ago
parent 773a2202ef
commit f02d851334

1
.gitignore vendored

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

@ -0,0 +1,78 @@
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(())

@ -1,10 +1,10 @@
# Generated by rust2rpm 17
# Generated by rust2rpm 18
%bcond_without check
%global crate libbpf-cargo
Name: rust-%{crate}
Version: 0.7.2
Version: 0.8.1
Release: %autorelease
Summary: Cargo plugin to build bpf programs
@ -12,6 +12,8 @@ Summary: Cargo plugin to build bpf programs
License: LGPLv2 or BSD
URL: https://crates.io/crates/libbpf-cargo
Source: %{crates_source}
# PR#125: libbpf-rs, libbpf-cargo: Support novendor feature
Patch0: libbpf-cargo-novendor.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
@ -69,6 +71,18 @@ which use "default" feature of "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%package -n %{name}+novendor-devel
Summary: %{summary}
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.
%files -n %{name}+novendor-devel
%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
%cargo_prep

@ -1 +1 @@
SHA512 (libbpf-cargo-0.7.2.crate) = e074ce8039f6a4ca5b9f821048f7b9f0bbc20b86009f8c6c88eeb2af7436eb7063c4a62a11ce055a15e2bb7639338206593775ef12bd6d602cf2781d2877c8ba
SHA512 (libbpf-cargo-0.8.1.crate) = 2eedf493e650aadfc4946fab1103dbc6491141d2a548cbaac328b61c9fae5dd46ca689ef8ee12d8848a996510fed7ed9bc22b0a34a21f2951a893003d17e12d6

Loading…
Cancel
Save