Allow overriding or omitting the revision metadata stamp
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- build-system, cli
调研方向
Start with src/metadata.rs and add_component_metadata in src/lib.rs to trace how the current Git revision is resolved and stamped. Then review tests/build.rs and add coverage for the requested manifest and environment precedence, omission, validation, and rebuild cases. Done when each case produces at most one revision section in the existing position, with the default behavior unchanged.
由索引模型根据 Issue 内容生成。
描述
Since #383 (for #378), cargo-component always stamps the HEAD commit of the
package's git repository into the component's revision metadata section
(src/git.rs, and add_component_metadata in src/lib.rs, the
revision: git.map(...) field). There is no way to change or turn this off,
so identical sources built at different commits differ in bytes, and a build
outside git or from a source archive stamps nothing. That defeats
reproducible builds that compare or sign component bytes, and it makes the
stamp the HEAD commit even when the component's own sources did not change.
Today the only workaround is a post-build rewrite (wasm-tools strip --delete '^revision$' then wasm-tools metadata add --revision). That moves the
section to the end of the component, so its bytes differ from what
cargo-component would have produced with the same value.
Request: a setting to choose the revision, with a manifest form and an
environment form, the environment winning:
[package.metadata.component] revision = "<literal>"stamps the literal,
andrevision = falseomits the section.CARGO_COMPONENT_REVISION=<literal>stamps the literal, and an empty value
omits the section. When set, it takes precedence over the manifest, so a
build tool can stamp a source tree hash without editing the manifest.- With neither set, behavior is unchanged: the HEAD commit.
Every case yields at most one revision section, in the position
cargo-component already uses, and a literal or a disable never consults git.
We carry this in a fork (https://github.com/attackordie/cargo-component/tree/feat/revision-setting) and would be glad to send it as a PR if the shape is
acceptable: about 115 added lines in src/metadata.rs (a RevisionSetting with a
custom deserializer that accepts a non-empty string or false) and
src/lib.rs (a resolve_revision step before add_component_metadata),
plus integration tests in tests/build.rs for the default, a manifest
literal, a manifest disable, a rejected revision = true, the environment
over the manifest, an empty environment value, and a re-stamp on a fresh
rebuild.
Searched existing issues and PRs for revision, revision section, git commit
hash, deterministic, source hash and CARGO_COMPONENT_REVISION: only #378
(closed, the request that added the stamp) and #383 (merged, its
implementation) came up.
- 主要语言
- Rust
- 星标
- 593
- 派生
- 68
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bytecodealliance/cargo-component 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 38/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 48/100
bytecodealliance/cargo-component#399 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
bytecodealliance/cargo-component#398 · 1 个 reaction ·
查看 bytecodealliance/cargo-component 的全部 Issue
相似的 Issue
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)未关闭
难度 2/5 1-3 小时 新手友好度 83/100
lbjlaq/Antigravity-Manager#4180 ·
维护者通常 1 天内回复
-
bug triage
难度 2/5 1-3 小时 新手友好度 78/100
zizmorcore/zizmor#2608 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 83/100
longbridge/nsh#4201 ·
维护者通常 1 天内回复