From 8d2e176c2f1a213cecc7520d5b4e57c89ede43d4 Mon Sep 17 00:00:00 2001 From: moson-mo Date: Thu, 9 Feb 2023 19:09:07 +0100 Subject: [PATCH] housekeep: stop "pkgmaint" script (cron job) With the removal of the "setup-repo" command this script becomes obsolete, because it is not possible to reserve a repo anymore. Hence we don't need cleanup. We've also seen issues in case the last packager's user account is removed, leading to the deletion of a Package. Let's deactivate this for now. Issue report: #425 Signed-off-by: moson-mo --- aurweb/scripts/pkgmaint.py | 6 ++++++ test/test_pkgmaint.py | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/aurweb/scripts/pkgmaint.py b/aurweb/scripts/pkgmaint.py index 9d7cf53b..3d695f8f 100755 --- a/aurweb/scripts/pkgmaint.py +++ b/aurweb/scripts/pkgmaint.py @@ -17,6 +17,12 @@ def _main(): def main(): + # Previously used to clean up "reserved" packages which never got pushed. + # Let's deactivate this for now since "setup-repo" is gone and we see + # other issue where deletion of a user account might cause unintended + # removal of a package (where PackagerUID account was deleted) + return + db.get_engine() with db.begin(): _main() diff --git a/test/test_pkgmaint.py b/test/test_pkgmaint.py index a0fece78..e427b664 100644 --- a/test/test_pkgmaint.py +++ b/test/test_pkgmaint.py @@ -62,7 +62,12 @@ def test_pkgmaint(packages: list[Package]): # Query package objects again and assert that the # first package was deleted but all others are intact. packages = db.query(Package).all() - assert len(packages) == 4 - expected = ["pkg_1", "pkg_2", "pkg_3", "pkg_4"] - for i, pkgname in enumerate(expected): - assert packages[i].Name == pkgname + + # !Cleanup of packages without last packager deactivated. + # We should still have 5 packages + assert len(packages) == 5 + + # assert len(packages) == 4 + # expected = ["pkg_1", "pkg_2", "pkg_3", "pkg_4"] + # for i, pkgname in enumerate(expected): + # assert packages[i].Name == pkgname