report: reproduce the pre-refactor CLI output through the ports
Instead of carrying raw UI in core, the ports now represent everything
the CLI used to do inline:
- Prompter::present shows context outside of a question (the wizard
summary screen, the vendoring notice spacing); TerminalPrompter
prints it on stdout exactly like the println!s it replaces, server
embeds forward it as a display event.
- generate_entry returns the generated entry (package, versions,
series, path) instead of printing; the CLI renders the same lines.
- BuildTarget carries a flow-composed display line and a tee_log flag:
the terminal adapter renders it verbatim ("Building source package
...", "Building ... for series/arch", "Uploading ... to ...") and
uploads open no build log.
- The unmet build-dependency diagnostics are rendered by the CLI from
the typed error, in the original order (details, then summary).
- --verbose constructs no live view at all (an idle widget used to
linger), and the re-vendor offer only logs when it is actually
asked, so headless runs print the error exactly once.
This commit is contained in:
+17
-3
@@ -169,6 +169,13 @@ fn retry_after_revendor(
|
||||
opts: &SourceBuildOptions,
|
||||
original: Box<dyn Error>,
|
||||
) -> Result<SourceBuildOutput, Box<dyn Error>> {
|
||||
// The offer is only made when someone can answer it: headless prompters
|
||||
// answer with the default (false) without the error being logged here —
|
||||
// the caller logs the returned error itself, exactly once.
|
||||
if !prompter.interactive() {
|
||||
view.finish_failure();
|
||||
return Err(original);
|
||||
}
|
||||
log::error!("{original}");
|
||||
if !prompter
|
||||
.confirm(
|
||||
@@ -301,7 +308,14 @@ pub fn run_source_build(
|
||||
package: &entry.source,
|
||||
version: &entry.version.full(),
|
||||
target: &entry.distribution,
|
||||
display: format!(
|
||||
"Building source package {} ({}) for {}",
|
||||
entry.source,
|
||||
entry.version.full(),
|
||||
entry.distribution
|
||||
),
|
||||
source_only: true,
|
||||
tee_log: true,
|
||||
});
|
||||
|
||||
let source_display = entry.source.clone();
|
||||
@@ -389,9 +403,9 @@ pub fn run_source_build(
|
||||
};
|
||||
let report = crate::debian::deps::check_build_depends(&ctrl, &check_opts)?;
|
||||
if !report.is_ok() {
|
||||
// The diagnostics travel inside the error (its Display carries
|
||||
// report.message()); main renders it and maps the type to exit
|
||||
// status 3, like dpkg-buildpackage.
|
||||
// The typed error carries the diagnostics (UnmetReport is
|
||||
// public); the caller renders them and maps the type to exit
|
||||
// status 3, like dpkg-buildpackage does.
|
||||
return Err(Box::new(crate::debian::deps::UnmetBuildDependencies(
|
||||
report,
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user