report,ui: name the tee log by flow kind
BuildTarget::source_only carried two states for what is a three-way distinction now that pkh test exists: replace it with a TargetKind (Source/Binary/Test) and derive the tee log prefix (build-/deb-/test-) from it, so test runs get their own log family instead of borrowing the deb one.
This commit is contained in:
+1
-1
@@ -314,7 +314,7 @@ pub fn run_source_build(
|
||||
entry.version.full(),
|
||||
entry.distribution
|
||||
),
|
||||
source_only: true,
|
||||
kind: crate::report::TargetKind::Source,
|
||||
tee_log: true,
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ use crate::logfmt::{
|
||||
AptInstallClassifier, AptUpdateClassifier, Classifier, GenericClassifier, MakeClassifier,
|
||||
MmdebstrapClassifier, QuiltClassifier,
|
||||
};
|
||||
use crate::report::{BuildTarget, BuildView};
|
||||
use crate::report::{BuildTarget, BuildView, TargetKind};
|
||||
use std::error::Error;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
@@ -256,7 +256,7 @@ async fn build_binary_package_impl(
|
||||
version: &version,
|
||||
target: &format!("{series}/{arch}"),
|
||||
display: format!("Building {package} ({version}) for {series}/{arch}"),
|
||||
source_only: false,
|
||||
kind: TargetKind::Binary,
|
||||
tee_log: true,
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ async fn put_impl(opts: &PutOptions<'_>) -> Result<(), Box<dyn std::error::Error
|
||||
"Uploading {} {} to {}",
|
||||
changes.source, changes.version, target.label
|
||||
),
|
||||
source_only: false,
|
||||
kind: crate::report::TargetKind::Binary,
|
||||
// An upload runs no subprocess: nothing to tee
|
||||
tee_log: false,
|
||||
});
|
||||
|
||||
+14
-3
@@ -28,6 +28,18 @@ use crate::logfmt::Classifier;
|
||||
/// why it is rejected (the implementation re-asks with the explanation).
|
||||
pub type Validator = dyn Fn(&str) -> Result<(), String>;
|
||||
|
||||
/// Which flow a target belongs to; names the terminal adapter's tee log
|
||||
/// (`build-*.log`, `deb-*.log`, `test-*.log`).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum TargetKind {
|
||||
/// Source-only build (produces a `.dsc`).
|
||||
Source,
|
||||
/// Binary build (produces `.debs`).
|
||||
Binary,
|
||||
/// DEP-8 test run (`pkh test`).
|
||||
Test,
|
||||
}
|
||||
|
||||
/// Identity of the build whose events follow, as announced through
|
||||
/// [`BuildView::target`].
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -45,9 +57,8 @@ pub struct BuildTarget<'a> {
|
||||
/// "Uploading hello (2.10-3) to ppa:user/ppa"): the wording is the
|
||||
/// flow's, adapters render it verbatim.
|
||||
pub display: String,
|
||||
/// Whether this is a source-only build (producing a `.dsc`); names the
|
||||
/// terminal adapter's tee log (`build-*.log` vs `deb-*.log`).
|
||||
pub source_only: bool,
|
||||
/// The flow driving the events; names the terminal adapter's tee log.
|
||||
pub kind: TargetKind,
|
||||
/// Whether the view should tee raw subprocess output to its log file.
|
||||
/// Flows without subprocess output (uploads) pass `false` and create
|
||||
/// no log file.
|
||||
|
||||
+5
-1
@@ -272,7 +272,11 @@ impl crate::report::BuildView for DebUi {
|
||||
self.shared.top.set_prefix(target.display.clone());
|
||||
}
|
||||
if target.tee_log {
|
||||
let kind = if target.source_only { "build" } else { "deb" };
|
||||
let kind = match target.kind {
|
||||
crate::report::TargetKind::Source => "build",
|
||||
crate::report::TargetKind::Binary => "deb",
|
||||
crate::report::TargetKind::Test => "test",
|
||||
};
|
||||
self.open_log(
|
||||
kind,
|
||||
target.package,
|
||||
|
||||
Reference in New Issue
Block a user