pull: use the most recent pocket first on 'find'
Some checks failed
CI / build (push) Failing after 32s
Some checks failed
CI / build (push) Failing after 32s
This commit is contained in:
@@ -143,6 +143,14 @@ pub struct PackageInfo {
|
||||
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 {
|
||||
let pocket_full = if pocket.is_empty() {
|
||||
String::new()
|
||||
@@ -362,20 +370,31 @@ pub async fn find_package(
|
||||
cb("", &format!("Checking {}...", series), i, series_list.len());
|
||||
}
|
||||
|
||||
match get(package_name, series, pocket, version).await {
|
||||
Ok(info) => {
|
||||
if i > 0 {
|
||||
warn!(
|
||||
"Package '{}' not found in development release. Found in {}/{}.",
|
||||
package_name, dist, series
|
||||
);
|
||||
} else {
|
||||
debug!("Found package '{}' in {}/{}", package_name, dist, series);
|
||||
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) => {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user