Browse Source

xtask: corrected bpf to ebpf for path to aya-ebpf-bindings in codegen

Currently, when running `cargo +nightly xtask codegen` locally and in
the codegen GHA workflow, an error occurs with only "Error: bindgen
failed" displayed.

This was due to a path using "bpf/..." instead of "ebpf/...". It is now
corrected to "ebpf", and bindgen fails should now display a more direct
message on why it failed.

Fixes: #914
tyrone-wu 11 months ago
parent
commit
b23973dd9c
2 changed files with 4 additions and 4 deletions
  1. 2 2
      xtask/src/codegen/aya.rs
  2. 2 2
      xtask/src/codegen/aya_ebpf_bindings.rs

+ 2 - 2
xtask/src/codegen/aya.rs

@@ -42,7 +42,7 @@ fn codegen_internal_btf_bindings(libbpf_dir: &Path) -> Result<(), anyhow::Error>
 
     let bindings = bindgen
         .generate()
-        .map_err(|_| anyhow!("bindgen failed"))?
+        .map_err(|op| anyhow!("bindgen failed - {op}"))?
         .to_string();
 
     // write the bindings, with the original helpers removed
@@ -216,7 +216,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyh
 
         let bindings = bindgen
             .generate()
-            .map_err(|_| anyhow!("bindgen failed"))?
+            .map_err(|op| anyhow!("bindgen failed - {op}"))?
             .to_string();
 
         // write the bindings, with the original helpers removed

+ 2 - 2
xtask/src/codegen/aya_ebpf_bindings.rs

@@ -19,7 +19,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
         riscv64_sysroot,
     } = opts;
 
-    let dir = PathBuf::from("bpf/aya-ebpf-bindings");
+    let dir = PathBuf::from("ebpf/aya-ebpf-bindings");
 
     let builder = || {
         let mut bindgen = bindgen::bpf_builder()
@@ -95,7 +95,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
 
         let bindings = bindgen
             .generate()
-            .map_err(|_| anyhow!("bindgen failed"))?
+            .map_err(|op| anyhow!("bindgen failed - {op}"))?
             .to_string();
 
         let mut tree = parse_str::<syn::File>(&bindings).unwrap();