feat(server): added routes for removing arch-repo & repo

This commit is contained in:
Jef Roosens 2022-08-11 19:28:17 +02:00
parent 6283cbea9c
commit 68b7e5e71e
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 149 additions and 23 deletions

View file

@ -66,3 +66,20 @@ pub fn (r &RepoGroupManager) remove_arch_repo(repo string, arch string) ?bool {
return true
}
// remove_repo removes a repo & its packages.
pub fn (r &RepoGroupManager) remove_repo(repo string) ?bool {
repo_dir := os.join_path_single(r.repos_dir, repo)
// If the repository doesn't exist yet, the result is automatically false
if !os.exists(repo_dir) {
return false
}
os.rmdir_all(repo_dir)?
pkg_dir := os.join_path_single(r.pkg_dir, repo)
os.rmdir_all(pkg_dir)?
return true
}