This commit is contained in:
parent
3080fee86b
commit
376e4f4eb8
2 changed files with 36 additions and 0 deletions
|
@ -13,3 +13,4 @@ steps:
|
|||
username: jmarya
|
||||
password:
|
||||
from_secret: registry_token
|
||||
|
||||
|
|
35
src/pkg.rs
35
src/pkg.rs
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue