-
Notifications
You must be signed in to change notification settings - Fork 169
xtask: Add local-rust-deps command for auto-detecting path dependencies #1942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new "cargo xtask local-rust-deps" command to automatically detect and configure bind mounts for local path dependencies, significantly improving the local development workflow. However, the current implementation is vulnerable to command and argument injection due to unsafe interpolation in the Justfile and improper escaping of file paths in the xtask tool. Additionally, there are suggestions to improve debuggability and code clarity, such as avoiding error message swallowing in the Justfile and refactoring podman argument generation in the Rust code.
ec33e5a to
952588e
Compare
f8c931e to
23fcacd
Compare
I want to be able to write build rules in Rust that may be invoked from outside of a container build, but in the default GHA runners Rust is installed via `rustup` which lives just in the `runner` user's homedir. When using `sudo` it resets `$PATH` so we lose access to it. Fix this by passing `$PATH` in. Assisted-by: OpenCode (claude-sonnet-4-20250514) Signed-off-by: Colin Walters <walters@verbum.org>
Tests with equal numbers were getting unstable sorting, causing the generated file to flap. Signed-off-by: Colin Walters <walters@verbum.org>
Add `cargo xtask local-rust-deps` which uses `cargo metadata` to find local path dependencies outside the workspace (e.g., from [patch] sections) and outputs podman bind mount arguments. This enables a cleaner workflow for local development against modified dependencies like composefs-rs: 1. Add a [patch] section to Cargo.toml with real local paths 2. Run `just build` - the Justfile auto-detects and bind-mounts them Benefits over the previous BOOTC_extra_src approach: - No manual env var needed - Paths work for both local `cargo build` and container builds - No /run/extra-src indirection or Cargo.toml path munging required - Auto-detection means it Just Works™ The Justfile's build target now calls `cargo xtask local-rust-deps` to get bind mount args, falling back gracefully if there are no external deps. The old BOOTC_extra_src mechanism is still supported for backwards compat. Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
23fcacd to
a88a97d
Compare
|
Not sure what's up with the CI failure Doesn't seem like that should be related to anything in this, but with this touching cargo... maybe? |
jeckersb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mildly suspicious of CI but otherwise LGTM
| test: | ||
| - /tmt/tests/tests/test-22-logically-bound-install | ||
|
|
||
| /plan-23-usroverlay: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this but I'll do a follow-up to dedupe these 23 tests, or otherwise figure out why the sort order isn't stable and we keep getting these diffs showing up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix was in this PR cf4efa3
Sorry I forgot to edit the PR description after adding that commit.
What I really want is for github to default to showing a list of commit messages and the PR description is like an optional extra...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah perfect, I (obviously) didn't look through commit-by-commit and just looked at the big diff so I missed it. I even saw the PartialOrd stuff but just at a glance assumed it was boilerplate for sorting something related to the local rust deps.
No this PR does break it, I was going to dig in more but test-install isn't gating (yet)...though it probably should be. Anyways I'll work on it. |
Add
cargo xtask local-rust-depswhich usescargo metadatato find local path dependencies outside the workspace (e.g., from [patch] sections) and outputs podman bind mount arguments.This enables a cleaner workflow for local development against modified dependencies like composefs-rs:
just build- the Justfile auto-detects and bind-mounts themBenefits over the previous BOOTC_extra_src approach:
cargo buildand container buildsThe Justfile's build target now calls
cargo xtask local-rust-depsto get bind mount args, falling back gracefully if there are no external deps. The old BOOTC_extra_src mechanism is still supported for backwards compat.Assisted-by: Claude Sonnet 4 (via OpenCode)