summaryrefslogtreecommitdiffstats
path: root/src/pipeline/mod.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/pipeline/mod.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
Diffstat (limited to 'src/pipeline/mod.rs')
-rw-r--r--src/pipeline/mod.rs41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 308f2a8..9e3c12a 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -13,11 +13,6 @@ use crate::db::SnapshotRow;
use crate::error::{Error, Result};
use crate::sandbox::{Sandbox, SandboxBackend};
-/// The approved source identity a build must reproduce.
-///
-/// For a new version it comes from the candidate; for a manual rebuild it comes
-/// from the accepted release, which is what makes I6 true: a rebuild reuses the
-/// approved source identity and never needs a new approval.
#[derive(Debug, Clone)]
pub struct SourceIdentity {
pub aur_commit: String,
@@ -30,10 +25,6 @@ pub struct SourceIdentity {
}
impl SourceIdentity {
- /// The identity of a build's source, complete on construction (n-1). The
- /// snapshot is an argument because an `aur_commit` that could mean either
- /// "not filled in yet" or "genuinely unknown" records empty provenance
- /// silently.
pub fn from_candidate(c: &CandidateRow, snapshot: &SnapshotRow) -> Self {
Self {
aur_commit: snapshot.aur_commit.clone(),
@@ -61,13 +52,11 @@ impl SourceIdentity {
}
}
-/// One package produced by the build, as recorded by `collect` and `ingest`.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct CollectedPkg {
pub name: String,
pub version: String,
pub arch: String,
- /// Where the artifact lives: staging until `ingest`, the store afterwards.
pub path: String,
pub digest: String,
pub size: u64,
@@ -76,7 +65,6 @@ pub struct CollectedPkg {
pub makedepends: Vec<String>,
pub provides: Vec<String>,
pub conflicts: Vec<String>,
- /// The full installed set from `.BUILDINFO`, unfiltered (§10.1).
pub installed: Vec<(String, String)>,
}
@@ -98,7 +86,6 @@ impl Collect {
}
}
-/// Everything a step needs. Built once per build run, cheap to clone handles.
pub struct Ctx {
pub cfg: Config,
pub db: Db,
@@ -111,8 +98,6 @@ pub struct Ctx {
pub log: PathBuf,
pub profile: String,
pub attempt: i64,
- /// Where build code runs. Defaults to the loopback backend (§8, sandbox
- /// seam); the pipeline itself never spawns a build subprocess directly.
pub backend: Arc<dyn SandboxBackend>,
}
@@ -126,9 +111,6 @@ impl Ctx {
Some(cid) => {
let c = crate::review::candidates::candidate_by_id(db, cid)?
.ok_or_else(|| Error::not_found("candidate for build"))?;
- // A candidate without its snapshot is a broken row, not a
- // candidate with less provenance: say so rather than build
- // against an empty commit and hash.
let snap = db::snapshot_by_id(db, c.snapshot_id)?
.ok_or_else(|| Error::not_found("snapshot for candidate"))?;
SourceIdentity::from_candidate(&c, &snap)
@@ -163,9 +145,6 @@ impl Ctx {
})
}
- /// Lease a sandbox for this build's profile. The TTL is the lease window: a
- /// sandbox that outlives it is assumed dead, which is what the reaper already
- /// concludes about an expired build lease.
pub fn sandbox(&self) -> Result<Arc<dyn Sandbox>> {
let spec = crate::sandbox::SandboxSpec {
profile: self.profile.clone(),
@@ -176,7 +155,6 @@ impl Ctx {
self.backend.acquire(&spec)
}
- /// Append to the build log; the SSE tail reads this file (§12).
pub fn log_line(&self, line: &str) {
use std::io::Write;
if let Some(parent) = self.log.parent() {
@@ -188,7 +166,6 @@ impl Ctx {
}
}
-/// What a full run produced.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Outcome {
Succeeded { release_id: i64 },
@@ -197,7 +174,6 @@ pub enum Outcome {
Cancelled,
}
-/// Run a build to completion, resuming at the first incomplete step (I5).
pub fn run(cfg: &Config, db: &Db, build_id: &str) -> Result<Outcome> {
let ctx = Ctx::new(cfg, db, build_id)?;
db::audit_system(
@@ -219,7 +195,7 @@ pub fn run_with(ctx: &Ctx) -> Result<Outcome> {
}
let status = builds::step_status(&ctx.db, &ctx.build.id, step)?;
if status.is_some_and(|s| s.is_done()) {
- continue; // checkpoint says we already did this
+ continue;
}
builds::begin_step(&ctx.db, &ctx.build.id, step, ctx.attempt)?;
builds::set_state(&ctx.db, &ctx.build.id, BuildState::Running, None)?;
@@ -249,10 +225,6 @@ pub fn run_with(ctx: &Ctx) -> Result<Outcome> {
Some(&format!("{step}: {e}")),
)?;
ctx.log_line(&format!("!! {step} failed: {e}"));
- // A failed build must not leave the old version looking healthy.
- // Nothing has to do that: the accepted pointer was never moved,
- // so the derived query reads it back (§8.4). There is
- // deliberately no state to set here.
return Ok(Outcome::Failed { step: step.to_string(), error: e.to_string(), transient });
}
}
@@ -277,8 +249,6 @@ impl Ctx {
}
}
-/// Enqueue the build an approval implies. Deterministic id, so calling this
-/// twice is a no-op (§8.2).
pub fn enqueue_for_candidate(cfg: &Config, db: &Db, c: &CandidateRow) -> Result<String> {
let pb = db::get_pkgbase_by_id(db, c.pkgbase_id)?
.ok_or_else(|| Error::not_found("pkgbase"))?;
@@ -290,18 +260,11 @@ pub fn enqueue_for_candidate(cfg: &Config, db: &Db, c: &CandidateRow) -> Result<
Ok(id)
}
-/// Manual rebuild of the current accepted version (I6): same source identity,
-/// no new approval, same version.
pub fn enqueue_manual_rebuild(cfg: &Config, db: &Db, pkgbase: &str) -> Result<String> {
let pb = db::get_pkgbase(db, pkgbase)?
.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")))?;
- // A manual rebuild is the accepted release asked for again, so its identity
- // is derived from what that release actually is, through the same
- // canonical-JSON hash every other identity uses (n-5). `requested` is what
- // keeps a rebuild a *distinct* build 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!({
@@ -323,10 +286,8 @@ pub fn enqueue_manual_rebuild(cfg: &Config, db: &Db, pkgbase: &str) -> Result<St
Ok(id)
}
-/// What one step produced.
pub enum StepResult {
Done(Option<String>),
Skipped(String),
- /// A dependency we publish is not in the index yet (§10.4).
Blocked(Vec<String>),
}