Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2735ec0
build: re-introduce default-members into workspace
daniel-noland Dec 8, 2025
1c127fe
build(hardware): remove unused dependency on sysroot
daniel-noland Dec 8, 2025
f3046b4
build(sysfs): remove unused dependency on sysroot
daniel-noland Dec 8, 2025
fdd021a
refactor(dpdk-sysroot-helper): drop unused get_project_root function
daniel-noland Dec 8, 2025
4c6d91d
refactor(dpdk-sysroot-helper): drop unused get_compile_env functon
daniel-noland Dec 8, 2025
56a313f
feat(dpdk-sysroot-helper): intro use_sysroot function
daniel-noland Dec 8, 2025
dc7a114
refactor(cli): invoke use_sysroot to de-duplicate code
daniel-noland Dec 8, 2025
8dbe745
refactor(init): invoke use_sysroot to de-duplicate code
daniel-noland Dec 8, 2025
cc4ed20
refactor(dpdk): invoke use_sysroot to de-duplicate code
daniel-noland Dec 8, 2025
84ae24f
refactor(dataplane): invoke use_sysroot to de-duplicate code
daniel-noland Dec 8, 2025
ef7962b
build(cli): make sysroot optional
daniel-noland Dec 8, 2025
d2c417a
build(init): make sysroot optional
daniel-noland Dec 8, 2025
e0bea6f
build: remove init from default-members list
daniel-noland Dec 8, 2025
0f5f007
build: remove dpdk and friends from default-members list
daniel-noland Dec 8, 2025
5516c51
build: remove hardware from default-members list
daniel-noland Dec 8, 2025
f3af00d
build(dataplane): make sysroot and dpdk optional for dataplane
daniel-noland Dec 8, 2025
d2df4ea
build: drop most of config.toml
daniel-noland Dec 8, 2025
4621fc4
ci: only use sysroot on sterile builds
daniel-noland Dec 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[env]
COMPILE_ENV = { value = "compile-env", relative = true, force = false }
PATH = { value = "compile-env/bin", relative = true, force = true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will now break all compiles on machines that don't have the tool chain installed locally unless they manually put compile-env on the path. Is there any way to avoid breaking this? Perhaps by just adding compile-env to path and using it if it is there?

This will certainly break my dev environment in ways I would be unhappy with.

LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true }
PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true }

[build]
target = "x86_64-unknown-linux-gnu"
rustc = "compile-env/bin/rustc"
rustflags = ["--cfg", "tokio_unstable"]

[target.x86_64-unknown-linux-gnu]
Expand Down
63 changes: 49 additions & 14 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ jobs:
sudo apt-get update
sudo apt-get install --yes --no-install-recommends just

- name: "install rust from upstream"
if: ${{ matrix.profile.sterile != 'sterile' }}
uses: dtolnay/rust-toolchain@stable
with:
components: "clippy,rustfmt"

- name: "set up build environment"
run: |
REQUIRED_HUGEPAGES=512
Expand All @@ -149,14 +155,17 @@ jobs:
docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH"
docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH"
docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9"
just --yes \
debug_justfile="${{matrix.debug_justfile}}" \
profile=${{matrix.profile.name}} \
registry="${{env.CACHE_REGISTRY}}" \
refresh-compile-env
just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix
if [ "${{matrix.profile.sterile}}" = "sterile" ]; then
just --yes \
debug_justfile="${{matrix.debug_justfile}}" \
profile=${{matrix.profile.name}} \
registry="${{env.CACHE_REGISTRY}}" \
refresh-compile-env
just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix
fi

- name: "cargo deny check"
if: ${{ matrix.profile.sterile == 'sterile' }}
run: |
just \
debug_justfile="${{matrix.debug_justfile}}" \
Expand Down Expand Up @@ -202,6 +211,16 @@ jobs:
target=x86_64-unknown-linux-gnu \
print-container-tags

- name: Install cargo-binstall
if: ${{ matrix.profile.sterile != 'sterile' }}
uses: cargo-bins/cargo-binstall@main

- name: Install nextest and kopium
if: ${{ matrix.profile.sterile != 'sterile' }}
run: |
cargo binstall cargo-nextest --secure
cargo binstall kopium --secure

- id: "test"
name: "test"
run: |
Expand All @@ -220,7 +239,7 @@ jobs:
--status-level=none \
--final-status-level=skip \
--message-format=libtest-json-plus > ./results.json
else
elif [ "${{ matrix.profile.sterile }}" = "sterile" ]; then
echo "::notice::Running regular tests"
just \
debug_justfile="${{matrix.debug_justfile}}" \
Expand Down Expand Up @@ -254,6 +273,13 @@ jobs:
--features shuttle \
shuttle \
>> ./results.json
else
declare -rx NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1
cargo nextest run \
--status-level=none \
--final-status-level=skip \
--message-format=libtest-json-plus \
> ./results.json
fi
# look for any flakes (flakes have a #\\d+ match in their name field)
jq \
Expand Down Expand Up @@ -339,17 +365,26 @@ jobs:
- id: "clippy"
name: "run clippy"
run: |
just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \
${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings
if [ "${{matrix.profile.sterile}}" != "sterile" ]; then
# you can't really get away with --all-features here since that enables dpdk
cargo clippy --all-targets -- -D warnings
else
just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \
${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings
fi

- id: "docs"
name: "run rustdoc"
run: |
RUSTDOCFLAGS="-D warnings" just \
debug_justfile="${{matrix.debug_justfile}}" \
profile=${{matrix.profile.name}} \
target=x86_64-unknown-linux-gnu \
${{matrix.profile.sterile}} cargo doc --no-deps
if [ "${{matrix.profile.sterile}}" != "sterile" ]; then
cargo doc --no-deps
else
RUSTDOCFLAGS="-D warnings" just \
debug_justfile="${{matrix.debug_justfile}}" \
profile=${{matrix.profile.name}} \
target=x86_64-unknown-linux-gnu \
${{matrix.profile.sterile}} cargo doc --no-deps
fi

- name: "Setup tmate session for debug"
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
Expand Down
14 changes: 6 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
[workspace]

default-members = [
"args",
"cli",
"concurrency",
"concurrency-macros",
"config",
"dataplane",
"errno",
"flow-info",
"id",
"interface-manager",
"k8s-intf",
"left-right-tlcache",
"mgmt",
"nat",
"net",
"pipeline",
"pkt-meta",
"rekon",
"routing",
"stats",
"sysfs",
"test-utils",
"tracectl",
"vpcmap",
]

members = [
"args",
"cli",
Expand Down
6 changes: 5 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ license = "Apache-2.0"
name = "cli"
path = "bin/main.rs"

[features]
default = []
sysroot = ["dep:dpdk-sysroot-helper"]

[dependencies]
clap = { workspace = true, features = ["derive", "std", "usage"] }
colored = "3.0.0"
Expand All @@ -21,6 +25,6 @@ thiserror = { workspace = true }

[build-dependencies]
# internal
dpdk-sysroot-helper = { workspace = true }
dpdk-sysroot-helper = { workspace = true, optional = true }

# external
5 changes: 2 additions & 3 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright Open Network Fabric Authors

fn main() {
let sysroot = dpdk_sysroot_helper::get_sysroot();
println!("cargo:rustc-link-search=all={sysroot}/lib");
println!("cargo:rustc-link-arg=--sysroot={sysroot}");
#[cfg(feature = "sysroot")]
dpdk_sysroot_helper::use_sysroot();
}
9 changes: 7 additions & 2 deletions dataplane/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ edition = "2024"
publish = false
license = "Apache-2.0"

[features]
default = []
sysroot = ["dep:dpdk-sysroot-helper"]
dpdk = ["sysroot", "dep:dpdk"]

[dependencies]
afpacket = { workspace = true, features = ["async-tokio"] }
args = { workspace = true }
Expand All @@ -13,7 +18,7 @@ axum = { workspace = true, features = ["http1", "tokio"] }
axum-server = { workspace = true }
concurrency = { workspace = true }
ctrlc = { workspace = true, features = ["termination"] }
dpdk = { workspace = true }
dpdk = { workspace = true, optional = true }
dyn-iter = { workspace = true }
futures = { workspace = true }
hyper = { workspace = true }
Expand Down Expand Up @@ -59,7 +64,7 @@ tracing-subscriber = { workspace = true }

[build-dependencies]
# internal
dpdk-sysroot-helper = { workspace = true }
dpdk-sysroot-helper = { workspace = true, optional = true }

# external

Expand Down
5 changes: 2 additions & 3 deletions dataplane/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright Open Network Fabric Authors

fn main() {
let sysroot = dpdk_sysroot_helper::get_sysroot();
println!("cargo:rustc-link-search=all={sysroot}/lib");
println!("cargo:rustc-link-arg=--sysroot={sysroot}");
#[cfg(feature = "sysroot")]
dpdk_sysroot_helper::use_sysroot();
}
1 change: 1 addition & 0 deletions dataplane/src/drivers/dpdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

//! DPDK dataplane driver

#![cfg(feature = "dpdk")]
#![allow(unused)]

use dpdk::dev::{Dev, TxOffloadConfig};
Expand Down
16 changes: 6 additions & 10 deletions dpdk-sysroot-helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ pub fn get_target_name() -> String {
.to_string()
}

#[must_use]
pub fn get_project_root() -> String {
env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set")
}

#[must_use]
pub fn get_compile_env() -> String {
env::var("COMPILE_ENV").expect("COMPILE_ENV not set")
}

#[must_use]
pub fn get_sysroot() -> String {
let compile_env = env::var("COMPILE_ENV").expect("COMPILE_ENV not set");
Expand All @@ -53,3 +43,9 @@ pub fn get_sysroot() -> String {
panic!("sysroot not found at {expected_sysroot}")
}
}

pub fn use_sysroot() {
let sysroot = get_sysroot();
println!("cargo:rustc-link-search=all={sysroot}/lib");
println!("cargo:rustc-link-arg=--sysroot={sysroot}");
}
4 changes: 1 addition & 3 deletions dpdk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
// Copyright Open Network Fabric Authors

fn main() {
let sysroot = dpdk_sysroot_helper::get_sysroot();
println!("cargo:rustc-link-search=all={sysroot}/lib");
println!("cargo:rustc-link-arg=--sysroot={sysroot}");
dpdk_sysroot_helper::use_sysroot();
}
3 changes: 0 additions & 3 deletions hardware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ serde = { workspace = true, features = ["std"] }
serde_yaml_ng = { workspace = true, features = [] }
tokio = { workspace = true }
tracing-subscriber = { workspace = true }

[build-dependencies]
dpdk-sysroot-helper = { workspace = true }
8 changes: 0 additions & 8 deletions hardware/build.rs

This file was deleted.

6 changes: 5 additions & 1 deletion init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ edition = "2024"
publish = false
license = "Apache-2.0"

[features]
default = []
sysroot = ["dep:dpdk-sysroot-helper"]

[dependencies]
# internal
hardware = { workspace = true, features = ["serde", "scan"] }
Expand All @@ -27,6 +31,6 @@ tracing-subscriber = { workspace = true, features = ["fmt"] }

[build-dependencies]
# internal
dpdk-sysroot-helper = { workspace = true }
dpdk-sysroot-helper = { workspace = true, optional = true }

# external
5 changes: 2 additions & 3 deletions init/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright Open Network Fabric Authors

fn main() {
let sysroot = dpdk_sysroot_helper::get_sysroot();
println!("cargo:rustc-link-search=all={sysroot}/lib");
println!("cargo:rustc-link-arg=--sysroot={sysroot}");
#[cfg(feature = "sysroot")]
dpdk_sysroot_helper::use_sysroot();
}
1 change: 0 additions & 1 deletion sysfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ n-vm = { workspace = true }

[build-dependencies]
# internal
dpdk-sysroot-helper = { workspace = true }

# external
8 changes: 0 additions & 8 deletions sysfs/build.rs

This file was deleted.

Loading