fix mirror any pkg
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-01-13 20:15:15 +01:00
parent 0c47d6ccd0
commit cb4de4dcb4
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -22,10 +22,18 @@ impl MirrorRepository {
arch: Architecture,
) {
log::info!("Downloading {url} to {}", file_path.to_str().unwrap());
let arch = if matches!(arch, Architecture::any) {
Architecture::x86_64.to_string() // `any` packages dont get served under repo "any" for some reason
} else {
arch.to_string()
};
for mirror in mirrorlist {
let mirror = mirror
.replace("$repo", &self.inner.name)
.replace("$arch", &arch.to_string());
.replace("$arch", &arch);
let url = format!("{mirror}/{url}");
log::info!("Trying mirror {url}");
@ -44,6 +52,7 @@ impl MirrorRepository {
}
}
}
log::error!("Downloading {url} failed. No mirror could provide a valid response.")
}
/// Get the `.db.tar.gz` content for the repository of `arch`
@ -84,12 +93,22 @@ impl MirrorRepository {
// PKG
let (name, _, _, arch) = Package::extract_pkg_name(pkg_name).unwrap();
self.download_package(pkg_name, &name, arch, mirrorlist)
.await;
self.inner.get_pkg(pkg_name)
}
pub async fn download_package(
&self,
pkg_name: &str,
name: &str,
arch: Architecture,
mirrorlist: &[String],
) {
self.download_file(
pkg_name,
self.inner
.base_path(arch.clone())
.join(&name)
.join(pkg_name),
self.inner.base_path(arch.clone()).join(name).join(pkg_name),
mirrorlist,
arch.clone(),
)
@ -107,7 +126,5 @@ impl MirrorRepository {
arch.clone(),
)
.await;
self.inner.get_pkg(pkg_name)
}
}