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,15 +370,25 @@ 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() {
get_dist_pockets(dist)
} else {
vec![pocket]
};
for p in pockets {
match get(package_name, series, p, version).await {
Ok(info) => { Ok(info) => {
if i > 0 { if i > 0 {
warn!( warn!(
"Package '{}' not found in development release. Found in {}/{}.", "Package '{}' not found in development release. Found in {}/{}-{}.",
package_name, dist, series package_name, dist, series, p
); );
} else { } else {
debug!("Found package '{}' in {}/{}", package_name, dist, series); debug!(
"Found package '{}' in {}/{}-{}",
package_name, dist, series, p
);
} }
return Ok(info); return Ok(info);
} }
@@ -379,6 +397,7 @@ pub async fn find_package(
} }
} }
} }
}
Err(format!("Package '{}' not found.", package_name).into()) Err(format!("Package '{}' not found.", package_name).into())
} }