🩹 fix any pkg download
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2025-04-27 19:23:07 +02:00
parent 66d53d227b
commit 36934fccfe
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 26 additions and 6 deletions

12
Cargo.lock generated
View file

@ -135,6 +135,17 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "async-stream" name = "async-stream"
version = "0.3.6" version = "0.3.6"
@ -1976,6 +1987,7 @@ name = "pacco"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"argh", "argh",
"async-recursion",
"based", "based",
"bytesize", "bytesize",
"chrono", "chrono",

View file

@ -31,3 +31,4 @@ zstd = "0.13.2"
argh = "0.1.13" argh = "0.1.13"
cmd_lib = "1.9.5" cmd_lib = "1.9.5"
nix = { version = "0.29.0", features = ["user"] } nix = { version = "0.29.0", features = ["user"] }
async-recursion = "1.1.1"

View file

@ -1,5 +1,6 @@
use std::path::PathBuf; use std::path::PathBuf;
use async_recursion::async_recursion;
use comrade::rally; use comrade::rally;
use crate::config::Mirrorlist; use crate::config::Mirrorlist;
@ -18,6 +19,7 @@ impl MirrorRepository {
} }
} }
#[async_recursion]
pub async fn download_file( pub async fn download_file(
&self, &self,
url: &str, url: &str,
@ -27,11 +29,14 @@ impl MirrorRepository {
) { ) {
log::info!("Downloading {url} to {}", file_path.to_str().unwrap()); log::info!("Downloading {url} to {}", file_path.to_str().unwrap());
let arch = if matches!(arch, Architecture::any) { if matches!(arch, Architecture::any) {
Architecture::x86_64.to_string() // `any` packages dont get served under repo "any" for some reason // `any` packages dont get served under repo "any" for some reason
} else { self.download_file(url, file_path.clone(), mirrorlist, Architecture::x86_64)
arch.to_string() .await;
}; self.download_file(url, file_path, mirrorlist, Architecture::aarch64)
.await;
return;
}
let parent = file_path.parent().unwrap(); let parent = file_path.parent().unwrap();
std::fs::create_dir_all(parent).unwrap(); std::fs::create_dir_all(parent).unwrap();
@ -40,7 +45,9 @@ impl MirrorRepository {
.into_iter() .into_iter()
.take(5) .take(5)
.map(|x| { .map(|x| {
let mirror = x.replace("$repo", &self.inner.name).replace("$arch", &arch); let mirror = x
.replace("$repo", &self.inner.name)
.replace("$arch", &arch.to_string());
( (
x.clone(), x.clone(),