summaryrefslogtreecommitdiffstats
path: root/src/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline')
-rw-r--r--src/pipeline/mod.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index c3a2cb3..20648c0 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -283,10 +283,26 @@ pub fn enqueue_manual_rebuild(cfg: &Config, db: &Db, pkgbase: &str) -> Result<St
.ok_or_else(|| Error::not_found(format!("pkgbase {pkgbase}")))?;
let rel = db::accepted_release(db, pkgbase)?
.ok_or_else(|| Error::invalid(format!("{pkgbase} has no accepted release")))?;
- let identity = crate::hash::hex_str(&format!(
- "{}|{}|manual",
- rel.aur_commit, rel.recipe_hash
- ));
+ // A manual rebuild is the accepted release asked for again, so its identity
+ // is derived from what that release actually is — commit, recipe, pins,
+ // digests — through the same canonical-JSON hash every other identity uses
+ // (n-5). The old version was an ad-hoc `commit|hash|manual` string: a
+ // different format for the same concept, with a delimiter that could appear
+ // inside the values, and no pins or digests at all, so two releases with the
+ // same recipe but different upstream commits... were distinguished only by
+ // luck. `requested` is what keeps a rebuild a *distinct* build from the one
+ // that produced the release, while staying deterministic (§8.2): clicking
+ // rebuild twice is one build, not two.
+ let identity = format!(
+ "sha256:{}",
+ crate::hash::hex(crate::hash::canonical_json(&serde_json::json!({
+ "aur_commit": rel.aur_commit,
+ "recipe_hash": rel.recipe_hash,
+ "upstream_pins": rel.pins(),
+ "source_digests": rel.digests(),
+ "requested": "manual_rebuild",
+ }))?.as_bytes())
+ );
let world = publish::index_world(db)?;
let world_hash = crate::hash::canonical_json(&world)?;
let id = builds::build_id(pkgbase, &identity, &world_hash, &cfg.build_profile);