From b912dd027a175ff5d58f06910148d95804a7eb4b Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 14 Aug 2022 23:40:37 +0000 Subject: [PATCH] add pruning step for old repos --- update-soft-serve-repos.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/update-soft-serve-repos.py b/update-soft-serve-repos.py index 59954e3..8dc1f4b 100755 --- a/update-soft-serve-repos.py +++ b/update-soft-serve-repos.py @@ -6,24 +6,31 @@ import shutil GITEA_REPOS = Path(__file__).parent / "gitea/git/repositories/daylin" SOFT_REPOS = Path(__file__).parent / "soft/repos" -allowed = ["dotfiles", "gitea-server"] +allowed = ["dotfiles", "git-server"] +soft_serve_only = ["config"] def main(): for repo in GITEA_REPOS.iterdir(): name = repo.name.replace(".git", "") - if name not in allowed: - continue - print(repo) - dest = SOFT_REPOS / name - print(f">> {dest}") + if name not in [*allowed, *soft_serve_only]: + continue + + print(f"{repo} >> {dest}") if dest.is_dir(): shutil.rmtree(dest) shutil.copytree(repo, dest) + for repo in SOFT_REPOS.iterdir(): + name = repo.name.replace(".git", "") + dest = SOFT_REPOS / name + if name not in [*allowed, *soft_serve_only]: + print(f"pruning {name}") + shutil.rmtree(repo) + if __name__ == "__main__": main()