mirror of https://github.com/aya-rs/aya
xtask: ensure libbpf submodule is initialized
Libbpf is used by xtasks, in the command, ensure that the submodules are initialized. This eases the user-experience so that users don't need to think about the submodule, while retaining all the benefits of using a submodule vs forcing the user to manually check out libbpf and stick it in some pre-defined place. We use the symbol pointing to libbpf in xtask in the build script to avoid repeating this constant. Also, we install git in the vm so that we can init the submodule when we build in the vm.pull/664/head
parent
4306b222d8
commit
15b3c459ae
@ -0,0 +1,17 @@
|
|||||||
|
use anyhow::{anyhow, Context as _, Result};
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
pub fn exec(cmd: &mut Command) -> Result<()> {
|
||||||
|
let status = cmd
|
||||||
|
.status()
|
||||||
|
.with_context(|| format!("failed to run {cmd:?}"))?;
|
||||||
|
match status.code() {
|
||||||
|
Some(code) => match code {
|
||||||
|
0 => Ok(()),
|
||||||
|
code => Err(anyhow!("{cmd:?} exited with code {code}")),
|
||||||
|
},
|
||||||
|
None => Err(anyhow!("{cmd:?} terminated by signal")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const LIBBPF_DIR: &str = "libbpf";
|
Loading…
Reference in New Issue