mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-19 19:34:25 +00:00
refactor: Make eBPF build optional in packet-gateway build script
- Change eBPF build from required to optional with graceful fallback - Add match statement to handle build success, failure, and missing cargo-build-bpf cases - Add cargo warnings when eBPF build fails or cargo-build-bpf is not installed - Remove panic on build failure to allow compilation without eBPF toolchain
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
// Build the eBPF program
|
||||
// Try to build the eBPF program, but skip if cargo-build-bpf is not installed
|
||||
let status = Command::new("cargo")
|
||||
.args(&["build-bpf", "--release"])
|
||||
.status()
|
||||
.expect("Failed to execute cargo build-bpf");
|
||||
.status();
|
||||
|
||||
if !status.success() {
|
||||
panic!("Failed to build eBPF program");
|
||||
match status {
|
||||
Ok(status) if status.success() => {
|
||||
// eBPF build succeeded
|
||||
}
|
||||
Ok(_) => {
|
||||
// eBPF build failed, but continue without it
|
||||
println!("cargo:warning=Failed to build eBPF program, continuing without it");
|
||||
}
|
||||
Err(_) => {
|
||||
// cargo-build-bpf not installed, skip eBPF build
|
||||
println!("cargo:warning=cargo-build-bpf not installed, skipping eBPF build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user