openvmm: define the product version in the workspace - #4132
Open
benhillis wants to merge 2 commits into
Open
Conversation
added 2 commits
July 31, 2026 11:55
`openvmm --version` did not exist, and there was nothing to report if it had: the workspace set no `version`, so every crate in it was `0.0.0`. OpenVMM ships as a source archive that packagers build themselves, which rules out the usual approach of having CI inject a version at build time -- the packager builds long after our pipeline has exited, from a tree with no git history to recover a version from. The version therefore has to be committed to the tree. QEMU, systemd, the kernel, cloud-hypervisor and rustc all do this, and each falls back gracefully when `.git` is absent rather than deriving the release version from a tag. So: set `version` in `[workspace.package]`, inherit it in `openvmm` and `openvmm_entry`, and wire up clap's `version`. `OPENVMM_PKGVERSION` lets a packager append their own build identity, as QEMU's `-Dpkgversion` and cloud-hypervisor's `CH_EXTRA_VERSION` do; an empty value is ignored, since build systems routinely pass an undefined variable through as "". Two things fall out of that: - The Windows VERSIONINFO resource is a second version surface, stamped from `OPENVMM_MAJOR`/`MINOR`/`PATCH`/`REVISION` and defaulting to `0.0.0.0`. No in-repo caller sets those, so leaving it alone would have left one binary reporting `0.1.0-dev` from `--version` and `0.0.0.0` from its file properties. It now defaults to the crate version, with the env vars still overriding per-component so a pipeline can stamp a build number in. - `cargo xtask fmt` deliberately strips `version` from `[package]`, partly because doing so also makes a crate unpublishable. The three crates on its exception list now set `publish = false` explicitly, restoring the property the lint was relying on. Verified by building `openvmm` from an extracted archive with no `.git` anywhere above it, which is the case that actually matters.
The workspace version advances only in the reviewed pull request that selects the next release. Development-build identity is added separately from the committed product version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0ba1c0df-faf0-4a0e-b39d-c3eb0e363fce
Contributor
There was a problem hiding this comment.
Pull request overview
This PR establishes a single canonical OpenVMM “product version” in the workspace manifest so that version information is preserved in source releases (without relying on Git history), and wires that version into user-visible reporting and Windows resource stamping.
Changes:
- Define the canonical version in
[workspace.package]and haveopenvmm/openvmm_entryinherit it. - Update
openvmm_entryto report the intended version viaopenvmm --version, with an optionalOPENVMM_PKGVERSIONoverride for downstream packagers. - Extend the
xtaskhouse-rules lint allowlist for crates that intentionally carry versions, and addpublish = falseto those crates’ manifests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| xtask/src/tasks/fmt/lints/package_info.rs | Expands version allowlist and documents why certain crates may carry versions. |
| vm/vmgs/vmgstool/Cargo.toml | Adds publish = false alongside its explicit version. |
| openvmm/openvmm/Cargo.toml | Inherits workspace version and sets publish = false. |
| openvmm/openvmm/build.rs | Defaults Windows VERSIONINFO stamping to the crate/workspace version unless overridden by OPENVMM_*. |
| openvmm/openvmm_entry/src/cli_args.rs | Sets the CLI-reported version (with OPENVMM_PKGVERSION override) and pins command name to openvmm. |
| openvmm/openvmm_entry/Cargo.toml | Inherits workspace version and sets publish = false. |
| Cargo.toml | Introduces [workspace.package].version as the canonical version. |
| Cargo.lock | Updates resolved versions for openvmm and openvmm_entry to match the workspace version. |
Comment on lines
+27
to
+31
| let component = |var: &str, from_crate_version: &str| { | ||
| std::env::var(var) | ||
| .or_else(|_| std::env::var(from_crate_version)) | ||
| .map(parse_u16) | ||
| .unwrap_or(0) |
Comment on lines
+35
to
+39
| /// List of packages that are allowed to have a version. | ||
| /// | ||
| /// Each of these must also set `publish = false`, since carrying a version | ||
| /// forfeits the implicit publishing protection described at the module level. | ||
| /// |
jstarks
reviewed
Jul 31, 2026
Comment on lines
+144
to
+145
| /// identity in, the way QEMU's `-Dpkgversion` and cloud-hypervisor's | ||
| /// `CH_EXTRA_VERSION` do. Distributions use this so a bug report names the |
Member
There was a problem hiding this comment.
Let's not reference other VMMs in comments.
jstarks
reviewed
Jul 31, 2026
Comment on lines
+151
to
+154
| const VERSION: &str = match option_env!("OPENVMM_PKGVERSION") { | ||
| Some(v) if !v.is_empty() => v, | ||
| _ => env!("CARGO_PKG_VERSION"), | ||
| }; |
Member
There was a problem hiding this comment.
Should we have an openvmm_version crate that defines this?
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenVMM needs one product version that travels in the source tree, because the release artifact is source that another party builds later without Git history.
This change:
[workspace.package];openvmmandopenvmm_entrycrates inherit it;openvmm --versionand Windows VERSIONINFO;OPENVMM_PKGVERSIONfor builders that need to identify their own package;This is the first independently reviewable change in the source-release series. It does not add Git probing, release automation, or archive assembly.