From 90a9559c009c52400e8b3ef72e8f2407f9937a6d Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Mon, 5 Oct 2026 10:22:58 +0200 Subject: [PATCH] deb: collapse the incremental fork logs into one line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fork announcement, the base selection and the resume note all described the same thing — building on the previous attempt's tree — in three consecutive lines. One line now carries the record ids, the carried/fresh state, and the selection why only when it deviates from the default pick (a base that did not succeed). --- src/deb/mod.rs | 66 ++++++++++++++++++++++++++++------------------ src/deb/session.rs | 10 ------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/deb/mod.rs b/src/deb/mod.rs index 21fcb80..97b1d84 100644 --- a/src/deb/mod.rs +++ b/src/deb/mod.rs @@ -641,9 +641,6 @@ async fn build_binary_package_impl( ) })?; if build_resume { - log::info!( - "Reusing the build artifacts of the previous attempt (incremental build)" - ); // Before the overlay mounts (see the function's doc): a // setpriv-era tree handed over here lets the mapped // build identity run the rules; a failed handover makes @@ -830,6 +827,17 @@ fn copy_report<'a>( }) } +/// The staged-tree clause of the incremental-base log line: right +/// after a successful fork the record's staged tree exists exactly +/// when the base's was carried through the gate. +fn fork_tree_clause(record: &session::Session) -> &'static str { + if record.has_upper() { + "staged tree carried" + } else { + "fresh staged tree" + } +} + /// Resolve the record a build runs in, per the `--incremental` request, /// against the real sessions root and the chroot tarball the bootstrap /// would use today. See [`resolve_record_in`]. @@ -889,11 +897,12 @@ fn resolve_record_in( .filter(|s| !session::lock_is_held(&s.lock_path()).unwrap_or(true)) .collect(); for base in session::rank_base_candidates(candidates) { - let why = if base.manifest().last_outcome == session::OUTCOME_SUCCESS { - "the newest successful record of the target" - } else { - "no successful record among the last usable ones; the newest record" - }; + // Only a deviant selection explains itself: forking from + // a record that did not succeed is worth a clause, the + // default pick is not. + let why = (base.manifest().last_outcome != session::OUTCOME_SUCCESS).then_some( + "no successful record among the last usable ones; the newest record", + ); let report = copy_report(view, &base.manifest().id); match session::fork_record_in( records_root, @@ -905,9 +914,14 @@ fn resolve_record_in( report.as_deref(), ) { Ok(record) => { + let mut notes = Vec::with_capacity(2); + notes.extend(why); + notes.push(fork_tree_clause(&record)); log::info!( - "Base of the incremental build: record {} ({why})", - base.manifest().id + "Incremental base {} -> record {} ({})", + base.manifest().id, + record.manifest().id, + notes.join(", ") ); return Ok((record, true)); } @@ -939,23 +953,23 @@ fn resolve_record_in( .into()), 1 => { let base = matches.remove(0); - log::info!( - "Base of the incremental build: record {} (pinned by id)", - base.manifest().id - ); let report = copy_report(view, &base.manifest().id); - Ok(( - session::fork_record_in( - records_root, - &base, - host_tree, - identity, - version, - cache_tarball_sha256, - report.as_deref(), - )?, - true, - )) + let record = session::fork_record_in( + records_root, + &base, + host_tree, + identity, + version, + cache_tarball_sha256, + report.as_deref(), + )?; + log::info!( + "Incremental base {} -> record {} ({})", + base.manifest().id, + record.manifest().id, + fork_tree_clause(&record) + ); + Ok((record, true)) } _ => { let found = matches diff --git a/src/deb/session.rs b/src/deb/session.rs index 0208056..b0c80ee 100644 --- a/src/deb/session.rs +++ b/src/deb/session.rs @@ -1324,16 +1324,6 @@ pub(crate) fn fork_record_in( ))); } } - log::info!( - "Forked build record {} from record {}: {}", - record.manifest().id, - base_manifest.id, - if carry_upper { - "the staged tree (objects included) is carried" - } else { - "a fresh staged tree; the environment comes from the apt cache" - } - ); Ok(record) }