Allow overriding or omitting the revision metadata stamp
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 76/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- rust
- Domaine
- build-system, cli
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Rust
- Étoiles
- 593
- Forks
- 68
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de bytecodealliance/cargo-component
-
Difficulté 2/5 1-3 heures Accessibilité débutants 38/100
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
-
Cargo Component WASI InterfacesOuverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
bytecodealliance/cargo-component#399 · 2 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
bytecodealliance/cargo-component#398 · 1 réaction ·
Toutes les issues de bytecodealliance/cargo-component
Issues similaires
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
lbjlaq/Antigravity-Manager#4180 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedOuvertebug triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
zizmorcore/zizmor#2608 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 1 jour
-
RecompLauncher supportOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
longbridge/nsh#4201 ·
Les mainteneurs répondent en général sous 1 jour