refactor(server): some functional coding
parent
d446e39253
commit
0a0a139407
|
@ -105,8 +105,8 @@ impl RepoGroupManager {
|
|||
// Also remove the old package archive
|
||||
let arch_repo_pkg_dir = self.pkg_dir.join(repo).join(arch);
|
||||
|
||||
for entry in arch_repo_pkg_dir.read_dir()? {
|
||||
let entry = entry?;
|
||||
arch_repo_pkg_dir.read_dir()?.try_for_each(|res| {
|
||||
res.and_then(|entry: fs::DirEntry| {
|
||||
let file_name = entry.file_name();
|
||||
let file_name = file_name.to_string_lossy();
|
||||
|
||||
|
@ -115,9 +115,12 @@ impl RepoGroupManager {
|
|||
let name = name_parts[..name_parts.len() - 3].join("-");
|
||||
|
||||
if name == pkg_name {
|
||||
fs::remove_file(entry.path())?;
|
||||
}
|
||||
fs::remove_file(entry.path())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
@ -166,7 +169,7 @@ impl RepoGroupManager {
|
|||
}
|
||||
|
||||
for arch in arch_repos.iter() {
|
||||
self.add_pkg_in_arch_repo(repo, &arch, pkg)?;
|
||||
self.add_pkg_in_arch_repo(repo, arch, pkg)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue