diff --git a/AGENTS.md b/AGENTS.md index 4dc59a2..c7529e9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,6 +49,8 @@ Rules: - `sandbox` — the build environment trait, host and unshare backends, staging (`src/sandbox/`) - `exec` — subprocess line capture and host process helpers (`src/exec.rs`) + - `build_profile` — build phase labels and wall-clock profiling + (`src/build_profile.rs`) - `interrupt` — Ctrl+C interception and interrupt-time cleanup (`src/interrupt.rs`) - `debian` — Debian format primitives: control, versions, checksums, diff --git a/docs/sandbox.md b/docs/sandbox.md index 3988e6d..29eb23f 100644 --- a/docs/sandbox.md +++ b/docs/sandbox.md @@ -427,10 +427,12 @@ src/ namespace.rs UnshareDriver, path mapping, overlay staging, namespace and pivot scripts, MAPPED_BUILD_ID ecrou.rs future Ecrou + build_profile.rs Phase, BuildProfiler, BuildProfile, PhaseTiming ``` -`Phase` and `BuildProfiler` still live in `deb`; moving them to -`build_profile.rs` is the remaining separation between `sandbox` and `deb`. +`Phase`, `BuildProfiler` and the profile record types live in +`src/build_profile.rs`. `deb` re-exports `Phase` and `session` re-exports the +record types, so their public paths do not change. ## Migration plan (implemented) diff --git a/src/build_profile.rs b/src/build_profile.rs new file mode 100644 index 0000000..b83cca0 --- /dev/null +++ b/src/build_profile.rs @@ -0,0 +1,284 @@ +//! Build phases and their wall-clock profile. +//! +//! The phase enum, its display labels and machine keys, the classifier +//! selection and the profiler that records one entry per executed phase. +//! Kept apart from `deb` so the sandbox backends can announce phases and +//! time them without depending on the binary-build flow. + +use crate::logfmt::{ + AptInstallClassifier, AptUpdateClassifier, Classifier, GenericClassifier, MakeClassifier, + MmdebstrapClassifier, QuiltClassifier, +}; +use crate::report::BuildView; +use serde::{Deserialize, Serialize}; + +/// Phases of a binary build, announced to the [`BuildView`] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Phase { + /// Downloading the chroot tarball (mmdebstrap) + PreparingChroot, + /// Extracting the chroot tarball + ExtractingChroot, + /// Device nodes, /proc bind mount, etc. + FinalizingChroot, + /// apt-get update + UpdatingPackageLists, + /// Installing build-essential & co + InstallingEssentials, + /// quilt push -a + ApplyingPatches, + /// --inject packages + InjectingPackages, + /// apt-get build-dep + InstallingBuildDeps, + /// Drop the resumed tree's input-untracked stamp caches (quirk: + /// `resume_clear`) + ClearingResumeCaches, + /// Establish the unprivileged build identity for the rules steps + /// (rootless builds): a nested user namespace mapping the chroot's + /// root ownership onto the identity — the tree needs no chown — or, + /// when unavailable, a build user with a chown tree handover + PreparingBuildUser, + /// debian/rules build + Building, + /// fakeroot debian/rules binary + ProducingBinaries, + /// Retrieving produced .deb files + RetrievingArtifacts, +} + +impl Phase { + /// Human-readable label displayed in the status bar + pub fn label(&self) -> &'static str { + match self { + Phase::PreparingChroot => "Preparing chroot", + Phase::ExtractingChroot => "Extracting chroot", + Phase::FinalizingChroot => "Finalizing chroot", + Phase::UpdatingPackageLists => "Updating package lists", + Phase::InstallingEssentials => "Installing essential packages", + Phase::ApplyingPatches => "Applying patches", + Phase::InjectingPackages => "Injecting packages", + Phase::InstallingBuildDeps => "Installing build dependencies", + Phase::ClearingResumeCaches => "Clearing resumed build caches", + Phase::PreparingBuildUser => "Preparing the build user", + Phase::Building => "Building package", + Phase::ProducingBinaries => "Producing binary packages", + Phase::RetrievingArtifacts => "Retrieving artifacts", + } + } + + /// Stable machine name of the phase, as recorded in a build + /// record's profile (`pkh deb profile`); unlike [`Self::label`] + /// this is a storage key, never reworded. + pub fn key(&self) -> &'static str { + match self { + Phase::PreparingChroot => "preparing_chroot", + Phase::ExtractingChroot => "extracting_chroot", + Phase::FinalizingChroot => "finalizing_chroot", + Phase::UpdatingPackageLists => "updating_package_lists", + Phase::InstallingEssentials => "installing_essentials", + Phase::ApplyingPatches => "applying_patches", + Phase::InjectingPackages => "injecting_packages", + Phase::InstallingBuildDeps => "installing_build_deps", + Phase::ClearingResumeCaches => "clearing_resume_caches", + Phase::PreparingBuildUser => "preparing_build_user", + Phase::Building => "building", + Phase::ProducingBinaries => "producing_binaries", + Phase::RetrievingArtifacts => "retrieving_artifacts", + } + } + + /// The phase `key` names, when it is one of the known machine + /// names; a key written by an older pkh whose phase has since been + /// renamed renders as its raw key. + pub fn from_key(key: &str) -> Option { + let phase = match key { + "preparing_chroot" => Phase::PreparingChroot, + "extracting_chroot" => Phase::ExtractingChroot, + "finalizing_chroot" => Phase::FinalizingChroot, + "updating_package_lists" => Phase::UpdatingPackageLists, + "installing_essentials" => Phase::InstallingEssentials, + "applying_patches" => Phase::ApplyingPatches, + "injecting_packages" => Phase::InjectingPackages, + "installing_build_deps" => Phase::InstallingBuildDeps, + "clearing_resume_caches" => Phase::ClearingResumeCaches, + "preparing_build_user" => Phase::PreparingBuildUser, + "building" => Phase::Building, + "producing_binaries" => Phase::ProducingBinaries, + "retrieving_artifacts" => Phase::RetrievingArtifacts, + _ => return None, + }; + Some(phase) + } +} + +/// Default line classifier rewriting a phase's subprocess output +fn default_classifier(phase: Phase) -> Box { + match phase { + Phase::PreparingChroot => Box::new(MmdebstrapClassifier::new()), + Phase::ExtractingChroot | Phase::FinalizingChroot => Box::new(GenericClassifier::new()), + Phase::UpdatingPackageLists => Box::new(AptUpdateClassifier::new()), + Phase::InstallingEssentials => Box::new(AptInstallClassifier::new("Installing essentials")), + Phase::ApplyingPatches => Box::new(QuiltClassifier::new(0)), + Phase::InjectingPackages => Box::new(AptInstallClassifier::new("Injecting packages")), + Phase::InstallingBuildDeps => { + Box::new(AptInstallClassifier::new("Installing build dependencies")) + } + Phase::ClearingResumeCaches | Phase::PreparingBuildUser => { + Box::new(GenericClassifier::new()) + } + Phase::Building | Phase::ProducingBinaries => Box::new(MakeClassifier::new()), + Phase::RetrievingArtifacts => Box::new(GenericClassifier::new()), + } +} + +/// One executed phase of a build profile: the stable machine name of a +/// [`crate::deb::Phase`] ([`crate::deb::Phase::key`]) and the +/// wall-clock milliseconds it ran. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct PhaseTiming { + /// Stable machine name of the phase. + pub phase: String, + /// Wall-clock milliseconds the phase ran. + pub millis: u64, +} + +/// Per-phase wall-clock profile of one build, recorded in the record's +/// manifest and shown by `pkh deb profile`: one entry per executed +/// phase, in execution order. A phase the flow skipped (the chroot +/// tarball was already cached, the device nodes were ready) has no +/// entry; a failed build's profile ends at the phase the error +/// propagated out of. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub struct BuildProfile { + /// Executed phases with their durations, in execution order. + pub phases: Vec, +} + +impl BuildProfile { + /// Whether nothing was recorded: the build ended before any phase + /// produced a measurement, and the record must not claim an empty + /// profile. + pub fn is_empty(&self) -> bool { + self.phases.is_empty() + } + + /// Total milliseconds across the recorded phases. + pub fn total_millis(&self) -> u64 { + self.phases.iter().map(|p| p.millis).sum() + } +} + +/// Records the wall-clock duration of every [`Phase`] the build flow +/// announces: one profile entry per executed phase, in execution +/// order. A phase closes when the next one is entered or at +/// [`BuildProfiler::finish`]. A failed build's profile ends at the phase the +/// error propagated out of, with its entry covering the phase until the +/// failure. Conditional phases that never ran (the chroot +/// tarball was cached, the device nodes were ready) record nothing. +pub(crate) struct BuildProfiler { + /// The phase being timed, since when. + open: Option<(Phase, std::time::Instant)>, + /// Closed phases, in execution order. + phases: Vec, +} + +impl BuildProfiler { + /// A profiler with nothing recorded yet. + pub(crate) fn new() -> Self { + Self { + open: None, + phases: Vec::new(), + } + } + + /// Close the phase being timed (if any) and open `phase`. + pub(crate) fn enter(&mut self, phase: Phase) { + self.close_open(); + self.open = Some((phase, std::time::Instant::now())); + } + + /// Close the open phase and return the recorded profile. + pub(crate) fn finish(&mut self) -> BuildProfile { + self.close_open(); + BuildProfile { + phases: std::mem::take(&mut self.phases), + } + } + + fn close_open(&mut self) { + if let Some((phase, started)) = self.open.take() { + self.phases.push(PhaseTiming { + phase: phase.key().to_string(), + millis: started.elapsed().as_millis() as u64, + }); + } + } +} + +/// Enter `phase` on the view with its default line classifier, timing +/// it into `profiler` +pub(crate) fn enter_phase(view: &dyn BuildView, phase: Phase, profiler: &mut BuildProfiler) { + profiler.enter(phase); + view.phase(phase.label(), default_classifier(phase)); +} + +#[cfg(test)] +mod tests { + use super::*; + + /// Every phase's machine key round-trips through `Phase::from_key`: + /// the profile renderer relies on it to show a recorded entry as + /// the phase's human label, and a key/from_key drift would + /// downgrade the row to the raw key. + #[test] + fn phase_keys_round_trip() { + for phase in [ + Phase::PreparingChroot, + Phase::ExtractingChroot, + Phase::FinalizingChroot, + Phase::UpdatingPackageLists, + Phase::InstallingEssentials, + Phase::ApplyingPatches, + Phase::InjectingPackages, + Phase::InstallingBuildDeps, + Phase::ClearingResumeCaches, + Phase::PreparingBuildUser, + Phase::Building, + Phase::ProducingBinaries, + Phase::RetrievingArtifacts, + ] { + assert_eq!(Phase::from_key(phase.key()), Some(phase), "{}", phase.key()); + assert_ne!(phase.key(), "", "{}", phase.key()); + } + assert_eq!(Phase::from_key("nonesuch"), None); + } + + /// The profiler closes each phase when the next opens and the last + /// one at `finish`, recording entries in execution order; an empty + /// run records nothing (the record must not claim an empty + /// profile), and a phase never entered leaves no entry. + #[test] + fn profiler_records_phases_in_execution_order() { + let mut profiler = BuildProfiler::new(); + assert!(profiler.finish().is_empty()); + + let mut profiler = BuildProfiler::new(); + profiler.enter(Phase::PreparingChroot); + std::thread::sleep(std::time::Duration::from_millis(5)); + profiler.enter(Phase::UpdatingPackageLists); + std::thread::sleep(std::time::Duration::from_millis(2)); + profiler.enter(Phase::Building); + std::thread::sleep(std::time::Duration::from_millis(2)); + let profile = profiler.finish(); + + let phases: Vec<&str> = profile.phases.iter().map(|p| p.phase.as_str()).collect(); + assert_eq!( + phases, + vec!["preparing_chroot", "updating_package_lists", "building"] + ); + assert!(profile.total_millis() >= 9, "{profile:?}"); + // finish() closes the last phase: nothing stays open afterwards. + assert!(profiler.finish().is_empty()); + } +} diff --git a/src/deb/local.rs b/src/deb/local.rs index 3d40ad7..ca84e5b 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -1,4 +1,5 @@ -use crate::deb::{BuildProfiler, Phase, enter_phase, find_dsc_file}; +use crate::build_profile::{BuildProfiler, Phase, enter_phase}; +use crate::deb::find_dsc_file; use crate::exec::LineSink; use crate::logfmt::QuiltClassifier; use crate::report::BuildView; diff --git a/src/deb/mod.rs b/src/deb/mod.rs index 49c943a..cc97602 100644 --- a/src/deb/mod.rs +++ b/src/deb/mod.rs @@ -4,190 +4,15 @@ pub(crate) mod local; /// host-tree snapshot/sync that keeps build artifacts alive across attempts pub mod session; -use crate::logfmt::{ - AptInstallClassifier, AptUpdateClassifier, Classifier, GenericClassifier, MakeClassifier, - MmdebstrapClassifier, QuiltClassifier, -}; +pub use crate::build_profile::Phase; +use crate::build_profile::{BuildProfiler, enter_phase}; +use crate::logfmt::Classifier; use crate::report::{BuildTarget, BuildView, TargetKind}; use crate::sandbox::{Host, PutOutcome, ReuseState, Sandbox, SandboxExt, StageOptions, Unshare}; use std::error::Error; use std::path::{Path, PathBuf}; use std::sync::Arc; -/// Phases of a binary build, announced to the [`BuildView`] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Phase { - /// Downloading the chroot tarball (mmdebstrap) - PreparingChroot, - /// Extracting the chroot tarball - ExtractingChroot, - /// Device nodes, /proc bind mount, etc. - FinalizingChroot, - /// apt-get update - UpdatingPackageLists, - /// Installing build-essential & co - InstallingEssentials, - /// quilt push -a - ApplyingPatches, - /// --inject packages - InjectingPackages, - /// apt-get build-dep - InstallingBuildDeps, - /// Drop the resumed tree's input-untracked stamp caches (quirk: - /// `resume_clear`) - ClearingResumeCaches, - /// Establish the unprivileged build identity for the rules steps - /// (rootless builds): a nested user namespace mapping the chroot's - /// root ownership onto the identity — the tree needs no chown — or, - /// when unavailable, a build user with a chown tree handover - PreparingBuildUser, - /// debian/rules build - Building, - /// fakeroot debian/rules binary - ProducingBinaries, - /// Retrieving produced .deb files - RetrievingArtifacts, -} - -impl Phase { - /// Human-readable label displayed in the status bar - pub fn label(&self) -> &'static str { - match self { - Phase::PreparingChroot => "Preparing chroot", - Phase::ExtractingChroot => "Extracting chroot", - Phase::FinalizingChroot => "Finalizing chroot", - Phase::UpdatingPackageLists => "Updating package lists", - Phase::InstallingEssentials => "Installing essential packages", - Phase::ApplyingPatches => "Applying patches", - Phase::InjectingPackages => "Injecting packages", - Phase::InstallingBuildDeps => "Installing build dependencies", - Phase::ClearingResumeCaches => "Clearing resumed build caches", - Phase::PreparingBuildUser => "Preparing the build user", - Phase::Building => "Building package", - Phase::ProducingBinaries => "Producing binary packages", - Phase::RetrievingArtifacts => "Retrieving artifacts", - } - } - - /// Stable machine name of the phase, as recorded in a build - /// record's profile (`pkh deb profile`); unlike [`Self::label`] - /// this is a storage key, never reworded. - pub fn key(&self) -> &'static str { - match self { - Phase::PreparingChroot => "preparing_chroot", - Phase::ExtractingChroot => "extracting_chroot", - Phase::FinalizingChroot => "finalizing_chroot", - Phase::UpdatingPackageLists => "updating_package_lists", - Phase::InstallingEssentials => "installing_essentials", - Phase::ApplyingPatches => "applying_patches", - Phase::InjectingPackages => "injecting_packages", - Phase::InstallingBuildDeps => "installing_build_deps", - Phase::ClearingResumeCaches => "clearing_resume_caches", - Phase::PreparingBuildUser => "preparing_build_user", - Phase::Building => "building", - Phase::ProducingBinaries => "producing_binaries", - Phase::RetrievingArtifacts => "retrieving_artifacts", - } - } - - /// The phase `key` names, when it is one of the known machine - /// names; a key written by an older pkh whose phase has since been - /// renamed renders as its raw key. - pub fn from_key(key: &str) -> Option { - let phase = match key { - "preparing_chroot" => Phase::PreparingChroot, - "extracting_chroot" => Phase::ExtractingChroot, - "finalizing_chroot" => Phase::FinalizingChroot, - "updating_package_lists" => Phase::UpdatingPackageLists, - "installing_essentials" => Phase::InstallingEssentials, - "applying_patches" => Phase::ApplyingPatches, - "injecting_packages" => Phase::InjectingPackages, - "installing_build_deps" => Phase::InstallingBuildDeps, - "clearing_resume_caches" => Phase::ClearingResumeCaches, - "preparing_build_user" => Phase::PreparingBuildUser, - "building" => Phase::Building, - "producing_binaries" => Phase::ProducingBinaries, - "retrieving_artifacts" => Phase::RetrievingArtifacts, - _ => return None, - }; - Some(phase) - } -} - -/// Default line classifier rewriting a phase's subprocess output -fn default_classifier(phase: Phase) -> Box { - match phase { - Phase::PreparingChroot => Box::new(MmdebstrapClassifier::new()), - Phase::ExtractingChroot | Phase::FinalizingChroot => Box::new(GenericClassifier::new()), - Phase::UpdatingPackageLists => Box::new(AptUpdateClassifier::new()), - Phase::InstallingEssentials => Box::new(AptInstallClassifier::new("Installing essentials")), - Phase::ApplyingPatches => Box::new(QuiltClassifier::new(0)), - Phase::InjectingPackages => Box::new(AptInstallClassifier::new("Injecting packages")), - Phase::InstallingBuildDeps => { - Box::new(AptInstallClassifier::new("Installing build dependencies")) - } - Phase::ClearingResumeCaches | Phase::PreparingBuildUser => { - Box::new(GenericClassifier::new()) - } - Phase::Building | Phase::ProducingBinaries => Box::new(MakeClassifier::new()), - Phase::RetrievingArtifacts => Box::new(GenericClassifier::new()), - } -} - -/// Records the wall-clock duration of every [`Phase`] the build flow -/// announces: one profile entry per executed phase, in execution -/// order. A phase closes when the next one is entered or at -/// [`BuildProfiler::finish`] — so a failed build's profile ends at the -/// phase the error propagated out of, its entry covering the phase -/// until the failure. Conditional phases that never ran (the chroot -/// tarball was cached, the device nodes were ready) record nothing. -pub(crate) struct BuildProfiler { - /// The phase being timed, since when. - open: Option<(Phase, std::time::Instant)>, - /// Closed phases, in execution order. - phases: Vec, -} - -impl BuildProfiler { - /// A profiler with nothing recorded yet. - pub(crate) fn new() -> Self { - Self { - open: None, - phases: Vec::new(), - } - } - - /// Close the phase being timed (if any) and open `phase`. - pub(crate) fn enter(&mut self, phase: Phase) { - self.close_open(); - self.open = Some((phase, std::time::Instant::now())); - } - - /// Close the open phase and return the recorded profile. - pub(crate) fn finish(&mut self) -> session::BuildProfile { - self.close_open(); - session::BuildProfile { - phases: std::mem::take(&mut self.phases), - } - } - - fn close_open(&mut self) { - if let Some((phase, started)) = self.open.take() { - self.phases.push(session::PhaseTiming { - phase: phase.key().to_string(), - millis: started.elapsed().as_millis() as u64, - }); - } - } -} - -/// Enter `phase` on the view with its default line classifier, timing -/// it into `profiler` -pub(crate) fn enter_phase(view: &dyn BuildView, phase: Phase, profiler: &mut BuildProfiler) { - profiler.enter(phase); - view.phase(phase.label(), default_classifier(phase)); -} - /// Parameters of one [`build_binary_package`] call. pub struct DebBuildOptions<'a> { /// Target architecture; defaults to the host architecture. @@ -1174,61 +999,6 @@ mod tests { assert!(!is_archive_source_pinned(mirror, None)); } - /// Every phase's machine key round-trips through `Phase::from_key`: - /// the profile renderer relies on it to show a recorded entry as - /// the phase's human label, and a key/from_key drift would - /// downgrade the row to the raw key. - #[test] - fn phase_keys_round_trip() { - for phase in [ - Phase::PreparingChroot, - Phase::ExtractingChroot, - Phase::FinalizingChroot, - Phase::UpdatingPackageLists, - Phase::InstallingEssentials, - Phase::ApplyingPatches, - Phase::InjectingPackages, - Phase::InstallingBuildDeps, - Phase::ClearingResumeCaches, - Phase::PreparingBuildUser, - Phase::Building, - Phase::ProducingBinaries, - Phase::RetrievingArtifacts, - ] { - assert_eq!(Phase::from_key(phase.key()), Some(phase), "{}", phase.key()); - assert_ne!(phase.key(), "", "{}", phase.key()); - } - assert_eq!(Phase::from_key("nonesuch"), None); - } - - /// The profiler closes each phase when the next opens and the last - /// one at `finish`, recording entries in execution order; an empty - /// run records nothing (the record must not claim an empty - /// profile), and a phase never entered leaves no entry. - #[test] - fn profiler_records_phases_in_execution_order() { - let mut profiler = BuildProfiler::new(); - assert!(profiler.finish().is_empty()); - - let mut profiler = BuildProfiler::new(); - profiler.enter(Phase::PreparingChroot); - std::thread::sleep(std::time::Duration::from_millis(5)); - profiler.enter(Phase::UpdatingPackageLists); - std::thread::sleep(std::time::Duration::from_millis(2)); - profiler.enter(Phase::Building); - std::thread::sleep(std::time::Duration::from_millis(2)); - let profile = profiler.finish(); - - let phases: Vec<&str> = profile.phases.iter().map(|p| p.phase.as_str()).collect(); - assert_eq!( - phases, - vec!["preparing_chroot", "updating_package_lists", "building"] - ); - assert!(profile.total_millis() >= 9, "{profile:?}"); - // finish() closes the last phase: nothing stays open afterwards. - assert!(profiler.finish().is_empty()); - } - /// An unshare sandbox mapped over `chroot_root` on a host base: /// exists/list_files/is_dir answer through the path mapping, no /// namespace privileges needed. diff --git a/src/deb/session.rs b/src/deb/session.rs index 60c7432..e989ce6 100644 --- a/src/deb/session.rs +++ b/src/deb/session.rs @@ -56,6 +56,8 @@ use sha2::{Digest, Sha256}; use crate::exec::{LineSink, Stream}; +pub use crate::build_profile::{BuildProfile, PhaseTiming}; + /// Manifest schema version: a record recorded by another schema is /// ignored (and eventually pruned) rather than forked. pub(crate) const SCHEMA_VERSION: u32 = 1; @@ -165,43 +167,6 @@ impl BuildTimings { } } -/// One executed phase of a build profile: the stable machine name of a -/// [`crate::deb::Phase`] ([`crate::deb::Phase::key`]) and the -/// wall-clock milliseconds it ran. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct PhaseTiming { - /// Stable machine name of the phase. - pub phase: String, - /// Wall-clock milliseconds the phase ran. - pub millis: u64, -} - -/// Per-phase wall-clock profile of one build, recorded in the record's -/// manifest and shown by `pkh deb profile`: one entry per executed -/// phase, in execution order. A phase the flow skipped (the chroot -/// tarball was already cached, the device nodes were ready) has no -/// entry; a failed build's profile ends at the phase the error -/// propagated out of. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct BuildProfile { - /// Executed phases with their durations, in execution order. - pub phases: Vec, -} - -impl BuildProfile { - /// Whether nothing was recorded: the build ended before any phase - /// produced a measurement, and the record must not claim an empty - /// profile. - pub fn is_empty(&self) -> bool { - self.phases.is_empty() - } - - /// Total milliseconds across the recorded phases. - pub fn total_millis(&self) -> u64 { - self.phases.iter().map(|p| p.millis).sum() - } -} - /// The record manifest: identity, lineage, outcome and tree state. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SessionManifest { diff --git a/src/lib.rs b/src/lib.rs index f7ed879..8a3e907 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,8 @@ pub mod apt; /// Build a Debian source package (into a .dsc) pub mod build; +/// Build phases, their labels and wall-clock profile +pub(crate) mod build_profile; /// Parse or edit a Debian changelog of a source package pub mod changelog; /// User settings: the optional `config.yml` in the pkh configuration diff --git a/src/sandbox/unshare/mod.rs b/src/sandbox/unshare/mod.rs index 9470a61..56541ec 100644 --- a/src/sandbox/unshare/mod.rs +++ b/src/sandbox/unshare/mod.rs @@ -2,8 +2,8 @@ mod namespace; pub(crate) use namespace::{MAPPED_BUILD_ID, MAPPED_IDENTITY_ENV, UnshareDriver}; +use crate::build_profile::{BuildProfiler, Phase, enter_phase}; use crate::deb::session::{self, Session}; -use crate::deb::{BuildProfiler, Phase, enter_phase}; use crate::interrupt::CleanupHookGuard; use crate::report::BuildView; use crate::sandbox::SandboxExt; diff --git a/src/test/bed.rs b/src/test/bed.rs index ca8fd6e..8bfb1bf 100644 --- a/src/test/bed.rs +++ b/src/test/bed.rs @@ -10,7 +10,7 @@ use std::error::Error; use std::sync::Arc; -use crate::deb::BuildProfiler; +use crate::build_profile::BuildProfiler; use crate::report::BuildView; use crate::sandbox::{Host, Sandbox, SandboxExt, Unshare}; use crate::test::options::TestMode; diff --git a/src/test/mod.rs b/src/test/mod.rs index d159bda..4eabb07 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -588,7 +588,7 @@ async fn configure_testbed( view, &None, &mut crate::deb::session::BuildTimings::default(), - &mut crate::deb::BuildProfiler::new(), + &mut crate::build_profile::BuildProfiler::new(), )?; } Ok(())