pull: reject malformed --ppa values instead of silently using the archive

A --ppa value that was not exactly 'user/name' (full URL, extra
segment, empty halves) made base_url None and pulled the package from
the main archive without any warning. Error out naming the expected
format instead, and document the format in --help.
This commit is contained in:
2026-09-16 01:24:02 +02:00
parent 213668fa82
commit f6fed7328b
+6 -6
View File
@@ -47,7 +47,7 @@ fn main() {
)
.arg(arg!(-v --version <version> "Target package version").required(false))
.arg(arg!(--archive "Only use the archive to download package source, not git").required(false))
.arg(arg!(--ppa <ppa> "Download the package from a specific PPA").required(false))
.arg(arg!(--ppa <ppa> "Download the package from a specific PPA (format: user/ppa_name)").required(false))
.arg(arg!(--repository <url> "Download the package from an external flat repository, given as its full suite URL (e.g. https://pkg.noctalia.dev/deb/resolute/)").required(false)
.conflicts_with("ppa"))
.arg(arg!(-p --pocket <pocket> "Target package distribution pocket (updates, security, proposed)").required(false))
@@ -152,14 +152,14 @@ fn main() {
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| {
let base_url = ppa.map(|ppa_str| {
// PPA format: user/ppa_name
let parts: Vec<&str> = ppa_str.split('/').collect();
if parts.len() == 2 {
Some(pkh::package_info::ppa_to_base_url(parts[0], parts[1]))
} else {
None
if parts.len() != 2 || parts[0].is_empty() || parts[1].is_empty() {
error!("Invalid PPA format: '{}'. Expected: user/ppa_name", ppa_str);
std::process::exit(1);
}
pkh::package_info::ppa_to_base_url(parts[0], parts[1])
});
// Since pull is async, we need to block on it