Allow overriding or omitting the revision metadata stamp
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 593
- Fork
- 68
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/cargo-component
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Cargo Component WASI InterfacesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
bytecodealliance/cargo-component#399 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
bytecodealliance/cargo-component#398 · 1 reaction ·
Tất cả issue của bytecodealliance/cargo-component
Issue tương tự
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
lbjlaq/Antigravity-Manager#4180 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedĐang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zizmorcore/zizmor#2608 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RecompLauncher supportĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
longbridge/nsh#4201 ·
Maintainer thường phản hồi trong vòng 1 ngày