Allow overriding or omitting the revision metadata stamp
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- build-system, cli
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 593
- Forks
- 68
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bytecodealliance/cargo-component
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Cargo Component WASI InterfacesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
bytecodealliance/cargo-component#399 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
bytecodealliance/cargo-component#398 · 1 reacción ·
Todos los issues de bytecodealliance/cargo-component
Issues similares
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
lbjlaq/Antigravity-Manager#4180 ·
Los mantenedores suelen responder en 1 día
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedAbiertobug triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
zizmorcore/zizmor#2608 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
RecompLauncher supportAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
longbridge/nsh#4201 ·
Los mantenedores suelen responder en 1 día