refactor command flow and add signed package/hook safety

- split CLI definitions and command execution out of main.rs into new cli.rs and commands.rs modules\n- add transaction hook support via /etc/depot.d/hooks/*.toml with pre/post phases, operation/package/path filters, wildcard negation, and optional affected-path stdin\n- execute transaction hooks around install/update/remove operations and add package-action prompts for install/build/remove flows\n- require and verify detached minisign signatures for binary package archives when allow_unsigned=false, including cache handling and tests\n- persist optional dependencies from package metadata into repo index data and include optional deps in produced metadata\n- update dependency/planner logic to ignore dependencies provided by local split outputs and stop pulling test deps into install planning\n- auto-disable tests when required test dependencies are missing instead of hard-failing build/install paths\n- improve autotools defaults by injecting standard install directory flags when supported and preserving user overrides\n- remove static .a archives during staging by default with new build.flags.no_delete_static escape hatch\n- preserve symlinks and file metadata (permissions/timestamps) in extractor fallback copy path and add regression tests\n- refresh README docs for detached package signatures, optional dependencies, and transaction hooks\n- adjust dependency set: add filetime, disable reqwest default features, and simplify git2/OpenSSL linkage
This commit is contained in:
2026-02-28 00:54:08 -06:00
parent e045ae78fd
commit ce5fefa833
19 changed files with 3863 additions and 2923 deletions
+24 -12
View File
@@ -104,12 +104,7 @@ pub fn prompt_yes_no(prompt: &str, default_yes: bool) -> Result<bool> {
let default_hint = if default_yes { "Y/n" } else { "y/N" };
loop {
print!(
"{} {} [{}] ",
label(Stream::Stdout, "?", "35"),
prompt,
default_hint
);
print!("{prompt} [{default_hint}]: ");
io::stdout()
.flush()
.context("Failed to flush prompt to stdout")?;
@@ -123,10 +118,25 @@ pub fn prompt_yes_no(prompt: &str, default_yes: bool) -> Result<bool> {
return Ok(answer);
}
warn("Please answer with 'y' or 'n'.");
warn("Invalid choice. Please answer with 'y' or 'n'.");
}
}
/// Prompt for a package-oriented action with a Starpack-like layout.
pub fn prompt_package_action(action: &str, packages: &[String], default_yes: bool) -> Result<bool> {
if packages.is_empty() {
return prompt_yes_no(
&format!("No packages were selected for {action}. Continue?"),
default_yes,
);
}
println!();
println!("The following packages will be processed for {}:", action);
println!(" {}", packages.join(" "));
prompt_yes_no("Proceed?", default_yes)
}
/// Prompt the user to choose one option by index.
pub fn prompt_select_index(prompt: &str, options: &[String], default_idx: usize) -> Result<usize> {
if options.is_empty() {
@@ -144,18 +154,17 @@ pub fn prompt_select_index(prompt: &str, options: &[String], default_idx: usize)
}
loop {
println!("{} {}", label(Stream::Stdout, "?", "35"), prompt);
println!("{}:", prompt);
for (idx, option) in options.iter().enumerate() {
println!(
" {} {}{}",
" {}) {}{}",
idx + 1,
option,
if idx == default_idx { " [default]" } else { "" }
);
}
print!(
"{} Select an option [1-{}] (default {}): ",
label(Stream::Stdout, "?", "35"),
"Choose option [1-{}] (Enter = {}): ",
options.len(),
default_idx + 1
);
@@ -176,7 +185,10 @@ pub fn prompt_select_index(prompt: &str, options: &[String], default_idx: usize)
{
return Ok(num - 1);
}
warn("Please enter a valid option number.");
warn(format!(
"Invalid choice. Please enter a number between 1 and {}.",
options.len()
));
}
}