Skip to content

Add --git-describe and --git-rev CLI args#817

Merged
bunnie merged 1 commit intobetrusted-io:mainfrom
sbellem:xtask-git-args
Feb 12, 2026
Merged

Add --git-describe and --git-rev CLI args#817
bunnie merged 1 commit intobetrusted-io:mainfrom
sbellem:xtask-git-args

Conversation

@sbellem
Copy link
Copy Markdown
Contributor

@sbellem sbellem commented Feb 12, 2026

Enable reproducible builds without git state by accepting version info as CLI arguments:

  • --git-describe: version string for signing (e.g., v0.10.0-19-g0d934e1)
  • --git-rev: commit hash for swap nonce (last 16 hex chars used)

Renames xtask --gitrev to --git-describe for clarity.

Motivation

Build systems like Guix and Nix operate in sandboxed environments without access to .git directories. Previously, we had to patch the code inline in Guix and Nix package definitions to inject version information at build time. These CLI arguments allow passing version info directly, eliminating the need for source patching.

Affected tools

Tool New argument
xtask --git-describe, --git-rev
xous-sign-image --git-describe
xous-create-image --git-rev
xous-app-uf2 --git-rev

Breaking change

The xtask --gitrev argument is renamed to --git-describe to better reflect its purpose (it accepts git describe output, not a commit hash).

Usage

# Get version info before entering sandboxed build                                                                                                                                                                                   
GIT_DESCRIBE=$(git describe --long --abbrev=9)                                                                                                                                                                                       
GIT_REV=$(git rev-parse HEAD)                                                                                                                                                                                                        
                                                                                                                                                                                                                                       
# Build without git state                                                                                                                                                                                                            
cargo xtask boot0 --git-describe "$GIT_DESCRIBE" --git-rev "$GIT_REV"                                                                                                                                                                

Testing

  • cargo check passes
  • Full build with explicit version args
  • Verify signed images contain correct version
  • Verify swap nonce matches expected value

Enable reproducible builds without git state by accepting
version info as CLI arguments:

- --git-describe: version string for signing (e.g., v0.10.0-19-g0d934e1)
- --git-rev: commit hash for swap nonce (last 16 hex chars used)

Renames xtask --gitrev to --git-describe for clarity.
@bunnie
Copy link
Copy Markdown
Member

bunnie commented Feb 12, 2026

This will be handy for out of tree builds too - if i want to specify a git rev for those. The bin tool set is some of the gnarliest old code in the xous code base, sorry you had to slog through it.

@bunnie bunnie merged commit 7c98a86 into betrusted-io:main Feb 12, 2026
15 checks passed
sbellem added a commit to sbellem/xous-core that referenced this pull request Feb 13, 2026
Pass semver from --git-describe to swap image signing code path.

PR betrusted-io#817 added --git-describe and --git-rev support but the swap
image code path in xous-create-image was not updated to use the
semver for signing.

Changes:
- swap_writer.rs: Add semver parameter to encrypt_to()
- xous-create-image.rs: Parse --git-describe and pass to encrypt_to()
- xous-app-uf2.rs: Same changes for consistency
- builder.rs: Pass --git-describe to xous-create-image

Fixes betrusted-io#818
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.

2 participants