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:
+39
-10
@@ -418,15 +418,23 @@ fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(e) = generate_entry(
|
||||
let entry = match generate_entry(
|
||||
"debian/changelog",
|
||||
Some(&cwd),
|
||||
version,
|
||||
target_series.as_deref(),
|
||||
) {
|
||||
error!("{}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
Ok(entry) => entry,
|
||||
Err(e) => {
|
||||
error!("{}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
println!(
|
||||
"Found package: {}, version: {}",
|
||||
entry.package, entry.previous_version
|
||||
);
|
||||
println!("Added new changelog entry to {}", entry.path.display());
|
||||
|
||||
let editor = match std::env::var("EDITOR") {
|
||||
Ok(e) => e,
|
||||
@@ -461,8 +469,15 @@ fn main() {
|
||||
// Live build view, unless --verbose (DebUi additionally disables
|
||||
// itself when stdout is not a terminal)
|
||||
let quiet = pkh::report::Quiet;
|
||||
let live = pkh::ui::deb::DebUi::new(&multi);
|
||||
let view: &dyn pkh::report::BuildView = if verbose { &quiet } else { &live };
|
||||
let live = if verbose {
|
||||
None
|
||||
} else {
|
||||
Some(pkh::ui::deb::DebUi::new(&multi))
|
||||
};
|
||||
let view: &dyn pkh::report::BuildView = live
|
||||
.as_ref()
|
||||
.map(|v| v as &dyn pkh::report::BuildView)
|
||||
.unwrap_or(&quiet);
|
||||
let prompter = pkh::ui::prompt::TerminalPrompter;
|
||||
|
||||
let orig_source = match sub_matches.get_one::<String>("orig").map(String::as_str) {
|
||||
@@ -490,12 +505,19 @@ fn main() {
|
||||
}
|
||||
}
|
||||
if output.signed {
|
||||
info!("Package built and signed successfully!");
|
||||
println!("Package built and signed successfully!");
|
||||
} else {
|
||||
info!("Package built successfully (unsigned).");
|
||||
println!("Package built successfully (unsigned).");
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
// The unmet-dependency diagnostics first, then the
|
||||
// summary: the exact rendering the flow used to do.
|
||||
if let Some(unmet) =
|
||||
e.downcast_ref::<pkh::debian::deps::UnmetBuildDependencies>()
|
||||
{
|
||||
eprintln!("{}", unmet.0.message());
|
||||
}
|
||||
error!("{}", e);
|
||||
// Unmet build dependencies/conflicts exit with status 3,
|
||||
// like dpkg-buildpackage does.
|
||||
@@ -581,8 +603,15 @@ fn main() {
|
||||
// Live build view, unless --verbose (DebUi additionally disables
|
||||
// itself when stdout is not a terminal)
|
||||
let quiet = pkh::report::Quiet;
|
||||
let live = pkh::ui::deb::DebUi::new(&multi);
|
||||
let view: &dyn pkh::report::BuildView = if verbose { &quiet } else { &live };
|
||||
let live = if verbose {
|
||||
None
|
||||
} else {
|
||||
Some(pkh::ui::deb::DebUi::new(&multi))
|
||||
};
|
||||
let view: &dyn pkh::report::BuildView = live
|
||||
.as_ref()
|
||||
.map(|v| v as &dyn pkh::report::BuildView)
|
||||
.unwrap_or(&quiet);
|
||||
|
||||
let result = rt.block_on(async {
|
||||
pkh::deb::build_binary_package(pkh::deb::DebBuildOptions {
|
||||
|
||||
Reference in New Issue
Block a user