Skip to content

Rust packaging for cargo install#15

Closed
ejc3 wants to merge 4 commits intofcvm-inceptionfrom
rust-packaging
Closed

Rust packaging for cargo install#15
ejc3 wants to merge 4 commits intofcvm-inceptionfrom
rust-packaging

Conversation

@ejc3
Copy link
Copy Markdown
Owner

@ejc3 ejc3 commented Dec 26, 2025

Summary

Prepares fcvm for cargo install by:

  • Package metadata (license, keywords, categories, release profile)
  • License files (MIT OR Apache-2.0)
  • Shell completions (fcvm completions bash|zsh|fish)
  • Packaging integration tests
  • CI job on ubuntu-latest to verify packaging works

Changes

File Description
Cargo.toml Package metadata, release profile
LICENSE-MIT MIT license
LICENSE-APACHE Apache 2.0 license
src/commands/completions.rs Shell completion generator
scripts/test-packaging.sh Simulates cargo install workflow
.github/workflows/ci.yml Packaging job on ubuntu-latest

Test plan

  • make test-packaging passes
  • cargo test --test test_packaging passes
  • Shell completions generate for all shells

ejc3 added 4 commits December 26, 2025 00:38
Prepares fcvm for cargo install and crates.io publishing:

Cargo.toml:
- Add package metadata (authors, description, license, keywords, categories)
- Add release profile with LTO, strip, and single codegen unit
- Add exclude patterns for .github, tests, benches, etc.

License files:
- LICENSE-MIT and LICENSE-APACHE for dual licensing

Shell completions:
- Add `fcvm completions <shell>` command
- Supports bash, zsh, fish, elvish, powershell
- Uses clap_complete for generation

Usage:
  fcvm completions bash > ~/.local/share/bash-completion/completions/fcvm
  fcvm completions zsh > ~/.zfunc/_fcvm
  fcvm completions fish > ~/.config/fish/completions/fcvm.fish

Tested: cargo build, cargo clippy, fcvm completions bash|zsh|fish
Tests verify that packaging features work correctly:
- Shell completions for bash, zsh, fish, elvish, powershell
- --generate-config creates config file at XDG path
- --generate-config without --force fails if file exists
- --generate-config --force overwrites existing file
- --version shows version info
- --help lists all commands including completions

Uses env!("CARGO_BIN_EXE_fcvm") to test the freshly built binary,
ensuring tests always run against current code, not stale binaries.

Tested: cargo test --test test_packaging (6 passed)
Simulates cargo install by:
1. Copying release binary to temp dir (away from source tree)
2. Running with isolated XDG_CONFIG_HOME
3. Verifying helpful error without config (not crash/panic)
4. Running --generate-config
5. Verifying setup finds the generated config

Also fixes CARGO_MANIFEST_DIR fallback to only work in debug builds.
In release builds (cargo install), that path would be stale.

Usage: make test-packaging (runs after make build)

Tested: make test-packaging (3/3 steps passed)
New job 'Packaging' runs on ubuntu-latest (no KVM needed):
1. Builds release binary
2. Runs scripts/test-packaging.sh

This verifies that cargo install users can:
- Run fcvm without source tree access
- Get helpful error when config is missing
- Generate config with --generate-config
- Find generated config on subsequent runs

Runs in parallel with Host and Container jobs.
@ejc3
Copy link
Copy Markdown
Owner Author

ejc3 commented Dec 28, 2025

Already merged to main

@ejc3 ejc3 closed this Dec 28, 2025
@ejc3 ejc3 deleted the rust-packaging branch December 31, 2025 17:56
claude-claude bot pushed a commit that referenced this pull request Feb 4, 2026
The --pids-limit=0 flag was causing test_pjdfstest_vm_truncate to fail
consistently (test #15 in truncate/00.t). While it was added to avoid
cgroup pids controller errors, disabling pids limits entirely can cause
unexpected behavior in tests that rely on proper process constraints.

The wait_for_cgroup_controllers() function should be sufficient to ensure
pids controller is available before starting containers, making the
--pids-limit=0 workaround unnecessary.

Fixes test failure in CI run #21682225880
ejc3 pushed a commit that referenced this pull request Feb 4, 2026
The --pids-limit=0 flag was causing test_pjdfstest_vm_truncate to fail
consistently (test #15 in truncate/00.t). While it was added to avoid
cgroup pids controller errors, disabling pids limits entirely can cause
unexpected behavior in tests that rely on proper process constraints.

The wait_for_cgroup_controllers() function should be sufficient to ensure
pids controller is available before starting containers, making the
--pids-limit=0 workaround unnecessary.

Fixes test failure in CI run #21682225880
ejc3 added a commit that referenced this pull request Mar 2, 2026
Added section #15 documenting code quality verification:
- Dead code detection with cargo clippy
- Unused dependency detection with cargo-machete
- Test coverage additions (5 new tests)
- Commands for running quality checks

All tools report zero issues: no warnings, no dead code, no unused deps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ejc3 pushed a commit that referenced this pull request Mar 2, 2026
The --pids-limit=0 flag was causing test_pjdfstest_vm_truncate to fail
consistently (test #15 in truncate/00.t). While it was added to avoid
cgroup pids controller errors, disabling pids limits entirely can cause
unexpected behavior in tests that rely on proper process constraints.

The wait_for_cgroup_controllers() function should be sufficient to ensure
pids controller is available before starting containers, making the
--pids-limit=0 workaround unnecessary.

Fixes test failure in CI run #21682225880
ejc3 added a commit that referenced this pull request Mar 2, 2026
Added section #15 documenting code quality verification:
- Dead code detection with cargo clippy
- Unused dependency detection with cargo-machete
- Test coverage additions (5 new tests)
- Commands for running quality checks

All tools report zero issues: no warnings, no dead code, no unused deps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ejc3 pushed a commit that referenced this pull request Mar 2, 2026
The --pids-limit=0 flag was causing test_pjdfstest_vm_truncate to fail
consistently (test #15 in truncate/00.t). While it was added to avoid
cgroup pids controller errors, disabling pids limits entirely can cause
unexpected behavior in tests that rely on proper process constraints.

The wait_for_cgroup_controllers() function should be sufficient to ensure
pids controller is available before starting containers, making the
--pids-limit=0 workaround unnecessary.

Fixes test failure in CI run #21682225880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant