[projects/pld-ftp-admin] pfa-signpkg, pfa-checksign, pfa-lintpkg: unlock the tree whatever stops them
arekm
arekm at pld-linux.org
Thu Oct 29 09:17:25 CET 2026
commit 34c710bae41950f5a42a67fa6edb55af52aefd71
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Oct 28 22:49:13 2026 +0100
pfa-signpkg, pfa-checksign, pfa-lintpkg: unlock the tree whatever stops them
They unlocked the tree only after a clean load or a SomeError (and in
pfa-lintpkg a Ctrl-C). Any other error while the tree loads, such as an
unreadable .info file, left it locked, since ftpiod keeps a lock until
someone unlocks it, and the next run refused to start.
bin/pfa-checksign | 7 +++----
bin/pfa-lintpkg | 7 +++----
bin/pfa-signpkg | 7 +++----
3 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/bin/pfa-checksign b/bin/pfa-checksign
index fcee3cb..b2a2be1 100755
--- a/bin/pfa-checksign
+++ b/bin/pfa-checksign
@@ -50,11 +50,10 @@ try:
tree.mark4moving(packages)
except ftptree.SomeError:
- # In case of problems we need to unlock the tree before exiting
- ftpio.unlock(treename)
sys.exit(1)
-
-ftpio.unlock(treename)
+finally:
+ # ftpiod keeps a lock until someone unlocks it, so on any exit
+ ftpio.unlock(treename)
print(f"Checking signatures of {len(tree.loadedpkgs)} packages")
sign = []
diff --git a/bin/pfa-lintpkg b/bin/pfa-lintpkg
index 07eb863..f4da997 100755
--- a/bin/pfa-lintpkg
+++ b/bin/pfa-lintpkg
@@ -66,11 +66,10 @@ try:
files = tree.rpmfiles(debugfiles = debugfiles, sourcefiles = False)
except (ftptree.SomeError, KeyboardInterrupt):
- # In case of problems we need to unlock the tree before exiting
- ftpio.unlock(treename)
sys.exit(1)
-
-ftpio.unlock(treename)
+finally:
+ # ftpiod keeps a lock until someone unlocks it, so on any exit
+ ftpio.unlock(treename)
class LintPkg:
def __init__(self, cachedir):
diff --git a/bin/pfa-signpkg b/bin/pfa-signpkg
index 23e842a..81e9bb3 100755
--- a/bin/pfa-signpkg
+++ b/bin/pfa-signpkg
@@ -57,11 +57,10 @@ try:
files = tree.rpmfiles()
except ftptree.SomeError:
- # In case of problems we need to unlock the tree before exiting
- ftpio.unlock(treename)
sys.exit(1)
-
-ftpio.unlock(treename)
+finally:
+ # ftpiod keeps a lock until someone unlocks it, so on any exit
+ ftpio.unlock(treename)
print(f"Checking signatures of {len(files)} files from {len(tree.loadedpkgs)} packages")
sign = []
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/16c6c5f2d4269aef64813afc632c36b5ce242afa
More information about the pld-cvs-commit
mailing list