deb: change ui/ux of pkh deb
CI / build (push) Successful in 2m54s
CI / test (push) Skipped
CI / snap (push) Failing after 12s

This commit is contained in:
2026-08-22 22:26:20 +02:00
parent e2d201d815
commit e5adf600c3
16 changed files with 1899 additions and 199 deletions
+30 -9
View File
@@ -12,8 +12,6 @@ use pkh::changelog::generate_entry;
use indicatif_log_bridge::LogWrapper;
use log::{error, info};
mod ui;
/// Obtain the current working directory, exiting with a helpful message on failure.
fn current_dir_or_exit() -> std::path::PathBuf {
match std::env::current_dir() {
@@ -75,7 +73,9 @@ fn main() {
.arg(arg!(--cross "Cross-compile for target architecture (instead of qemu-binfmt)")
.long_help("Cross-compile for target architecture (instead of using qemu-binfmt)\nNote that most packages cannot be cross-compiled").required(false))
.arg(arg!(--mode <mode> "Change build mode [local]").required(false)
.long_help("Change build mode [local]\nDefault will chose depending on other parameters, don't provide if unsure")),
.long_help("Change build mode [local]\nDefault will chose depending on other parameters, don't provide if unsure"))
.arg(arg!(--verbose "Show raw tool output instead of the live build view").required(false)
.long_help("Show raw tool output instead of the live build view.\nAlso implied by RUST_LOG=debug for pkh's own logs.")),
)
.subcommand(
Command::new("context")
@@ -139,7 +139,7 @@ fn main() {
.unwrap_or("");
let archive = sub_matches.get_one::<bool>("archive").unwrap_or(&false);
let (pb, progress_callback) = ui::create_progress_bar(&multi);
let (pb, progress_callback) = pkh::ui::create_progress_bar(&multi);
// Convert PPA to base URL if provided
let base_url = ppa.and_then(|ppa_str| {
@@ -194,7 +194,7 @@ fn main() {
pkh::distro_info::get_ordered_series_name(&dist).await
}) {
Ok(series_list) => {
match ui::select_series(&series_list, &current_series) {
match pkh::ui::select_series(&series_list, &current_series) {
Ok(selected) => Some(selected),
Err(e) => {
error!(
@@ -284,8 +284,20 @@ fn main() {
Some("local") => Some(pkh::deb::BuildMode::Local),
_ => None,
};
let verbose = sub_matches
.get_one::<bool>("verbose")
.copied()
.unwrap_or(false);
if let Err(e) = rt.block_on(async {
// Live build view: disabled by --verbose or when stdout is not a
// terminal (DebUi handles the non-TTY case itself)
let ui = if verbose {
None
} else {
Some(std::sync::Arc::new(pkh::ui::deb::DebUi::new(&multi)))
};
let result = rt.block_on(async {
pkh::deb::build_binary_package(
arch,
series,
@@ -296,11 +308,20 @@ fn main() {
ppa,
inject_packages,
None,
ui.clone(),
)
.await
}) {
error!("{}", e);
std::process::exit(1);
});
match result {
Ok(artifacts) => {
let _ = artifacts;
info!("Done.");
}
Err(e) => {
error!("{}", e);
std::process::exit(1);
}
}
}
Some(("context", sub_matches)) => {