pull: use the most recent pocket first on 'find'
Some checks failed
CI / build (push) Failing after 32s

This commit is contained in:
2025-12-12 18:22:29 +01:00
parent 659a8a2ba7
commit c14ea99dc2

View File

@@ -143,6 +143,14 @@ pub struct PackageInfo {
pub archive_url: String, pub archive_url: String,
} }
fn get_dist_pockets(dist: &str) -> Vec<&'static str> {
match dist {
"ubuntu" => vec!["proposed", "updates", ""],
"debian" => vec!["proposed-updates", "updates", ""],
_ => vec![""],
}
}
fn get_sources_url(base_url: &str, series: &str, pocket: &str, component: &str) -> String { fn get_sources_url(base_url: &str, series: &str, pocket: &str, component: &str) -> String {
let pocket_full = if pocket.is_empty() { let pocket_full = if pocket.is_empty() {
String::new() String::new()
@@ -362,20 +370,31 @@ pub async fn find_package(
cb("", &format!("Checking {}...", series), i, series_list.len()); cb("", &format!("Checking {}...", series), i, series_list.len());
} }
match get(package_name, series, pocket, version).await { let pockets = if pocket.is_empty() {
Ok(info) => { get_dist_pockets(dist)
if i > 0 { } else {
warn!( vec![pocket]
"Package '{}' not found in development release. Found in {}/{}.", };
package_name, dist, series
); for p in pockets {
} else { match get(package_name, series, p, version).await {
debug!("Found package '{}' in {}/{}", package_name, dist, series); Ok(info) => {
if i > 0 {
warn!(
"Package '{}' not found in development release. Found in {}/{}-{}.",
package_name, dist, series, p
);
} else {
debug!(
"Found package '{}' in {}/{}-{}",
package_name, dist, series, p
);
}
return Ok(info);
}
Err(_e) => {
continue;
} }
return Ok(info);
}
Err(_e) => {
continue;
} }
} }
} }