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

This commit is contained in:
JMARyA 2024-12-28 11:03:52 +01:00
parent 3080fee86b
commit 376e4f4eb8
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 36 additions and 0 deletions

View file

@ -13,3 +13,4 @@ steps:
username: jmarya
password:
from_secret: registry_token

View file

@ -35,6 +35,20 @@ impl Repository {
}
}
pub fn arch(&self) -> Vec<String> {
let dir_path = PathBuf::from("./data").join(&self.name);
let mut arch = vec![];
if let Ok(entries) = std::fs::read_dir(dir_path) {
for entry in entries.filter_map(Result::ok) {
let file_name = entry.file_name().into_string().unwrap_or_default();
arch.push(file_name);
}
}
arch
}
pub fn base_path(&self, arch: &str) -> PathBuf {
PathBuf::from("./data").join(&self.name).join(arch)
}
@ -143,6 +157,27 @@ impl Package {
db_file.to_str().unwrap(),
pkg_file.to_str().unwrap(),
]);
if &self.arch == "any" {
let archs = Repository::new(&self.repo).unwrap().arch();
for arch in archs {
if arch == "any" {
continue;
}
let db_file = PathBuf::from("./data")
.join(&self.repo)
.join(&arch)
.join(format!("{}.db.tar.gz", self.repo));
run_command(vec![
"repo-add",
db_file.to_str().unwrap(),
pkg_file.to_str().unwrap(),
]);
}
}
}
fn base_path(&self) -> PathBuf {