mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-19 18:48:46 +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;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
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")
|
let status = Command::new("cargo")
|
||||||
.args(&["build-bpf", "--release"])
|
.args(&["build-bpf", "--release"])
|
||||||
.status()
|
.status();
|
||||||
.expect("Failed to execute cargo build-bpf");
|
|
||||||
|
|
||||||
if !status.success() {
|
match status {
|
||||||
panic!("Failed to build eBPF program");
|
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