deb: add opt-in --incremental flag for single-flag iterate loops
Iterating on a package currently needs two flags (--resume --keep): without --keep a successful build consumes the session, and without --resume nothing is reused, so incremental iteration never "just works" opt-in. --incremental is the single-flag form: with no --resume it adopts the newest usable session of this tree (like `pkh deb --resume`), and it always keeps the session on success, so the loop (edit, `pkh deb --incremental`, edit, ...) reuses the chroot, build deps and objects and only recompiles what changed. With an explicit `--resume <id>` it only adds keep. A plain `pkh deb` is unchanged: fresh session, consumed on success.
This commit is contained in:
+9
-3
@@ -376,6 +376,8 @@ fn main() {
|
||||
)
|
||||
.arg(arg!(--keep "Keep the build session after a successful build (for a later --resume)")
|
||||
.long_help("Keep the build session after a successful build, so a later 'pkh deb --resume' can iterate on it (e.g. after editing sources).\nWithout it, a successful build consumes the session (failures and interrupts always keep it)."))
|
||||
.arg(arg!(--incremental "Reuse a previous build session of this target (like --resume) and keep the session even on success; the next --incremental build reuses the chroot, build deps and objects")
|
||||
.required(false))
|
||||
.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(
|
||||
@@ -937,14 +939,18 @@ fn main() {
|
||||
})
|
||||
});
|
||||
|
||||
// Session handling: --resume [<id>] and --keep (see the deb
|
||||
// subcommand help).
|
||||
// Session handling: --resume [<id>], --incremental and --keep
|
||||
// (see the deb subcommand help). --incremental adopts the newest
|
||||
// session when no explicit --resume ID is given, and always adds
|
||||
// keep so the session survives success.
|
||||
let incremental = sub_matches.get_flag("incremental");
|
||||
let resume = match sub_matches.get_one::<String>("resume").map(String::as_str) {
|
||||
Some("") => pkh::deb::SessionResume::Latest,
|
||||
Some(id) => pkh::deb::SessionResume::Id(id.to_string()),
|
||||
None if incremental => pkh::deb::SessionResume::Latest,
|
||||
None => pkh::deb::SessionResume::Fresh,
|
||||
};
|
||||
let keep_session = sub_matches.get_flag("keep");
|
||||
let keep_session = sub_matches.get_flag("keep") || incremental;
|
||||
|
||||
// Live build view, unless --verbose (DebUi additionally disables
|
||||
// itself when stdout is not a terminal)
|
||||
|
||||
Reference in New Issue
Block a user