[projects/pld-ftp-admin] pfa-signpkg, pfa-checksign, pfa-lintpkg: shorten the tree loading
arekm
arekm at pld-linux.org
Thu Oct 29 09:17:51 CET 2026
commit 0d9844d3c17782e6b9f93dd3c9df576f66447761
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Oct 28 22:50:38 2026 +0100
pfa-signpkg, pfa-checksign, pfa-lintpkg: shorten the tree loading
The same eleven lines picked between loading all of the tree and
loading the named packages; two expressions say it. No change in
behaviour.
bin/pfa-checksign | 16 +++-------------
bin/pfa-lintpkg | 16 +++-------------
bin/pfa-signpkg | 16 +++-------------
3 files changed, 9 insertions(+), 39 deletions(-)
---
diff --git a/bin/pfa-checksign b/bin/pfa-checksign
index b2a2be1..3e83f94 100755
--- a/bin/pfa-checksign
+++ b/bin/pfa-checksign
@@ -34,20 +34,10 @@ if not ftpio.lock(treename, True):
print(f"ERR: {treename} tree already locked", file=sys.stderr)
sys.exit(1)
-files = []
try:
- if len(packages) < 1:
- loadall = True
- else:
- loadall = False
-
- # if no files specified, grab whole tree contents
- tree = ftptree.FtpTree(treename, loadall = loadall)
- if loadall:
- # this is hack, should be a param, not access private .loadedpkgs element
- tree.mark4moving(tree.loadedpkgs)
- else:
- tree.mark4moving(packages)
+ # no packages given: all of the tree
+ tree = ftptree.FtpTree(treename, loadall = not packages)
+ tree.mark4moving(packages or tree.loadedpkgs)
except ftptree.SomeError:
sys.exit(1)
diff --git a/bin/pfa-lintpkg b/bin/pfa-lintpkg
index f4da997..728100f 100755
--- a/bin/pfa-lintpkg
+++ b/bin/pfa-lintpkg
@@ -48,21 +48,11 @@ if not ftpio.lock(treename, True):
print(f"ERR: {treename} tree already locked", file=sys.stderr)
sys.exit(1)
-files = []
try:
- if len(packages) < 1:
- loadall = True
- else:
- loadall = False
-
- # if no files specified, grab whole tree contents
- tree = ftptree.FtpTree(treename, loadall = loadall)
+ # no packages given: all of the tree
+ tree = ftptree.FtpTree(treename, loadall = not packages)
tree.do_checkbuild = False
- if loadall:
- # this is hack, should be a param, not access private .loadedpkgs element
- tree.mark4moving(tree.loadedpkgs)
- else:
- tree.mark4moving(packages)
+ tree.mark4moving(packages or tree.loadedpkgs)
files = tree.rpmfiles(debugfiles = debugfiles, sourcefiles = False)
except (ftptree.SomeError, KeyboardInterrupt):
diff --git a/bin/pfa-signpkg b/bin/pfa-signpkg
index 81e9bb3..5778b6e 100755
--- a/bin/pfa-signpkg
+++ b/bin/pfa-signpkg
@@ -40,20 +40,10 @@ if not ftpio.lock(treename, True):
print(f"ERR: {treename} tree already locked", file=sys.stderr)
sys.exit(1)
-files = []
try:
- if len(packages) < 1:
- loadall = True
- else:
- loadall = False
-
- # if no files specified, grab whole tree contents
- tree = ftptree.FtpTree(treename, loadall = loadall)
- if loadall:
- # this is hack, should be a param, not access private .loadedpkgs element
- tree.mark4moving(tree.loadedpkgs)
- else:
- tree.mark4moving(packages)
+ # no packages given: all of the tree
+ tree = ftptree.FtpTree(treename, loadall = not packages)
+ tree.mark4moving(packages or tree.loadedpkgs)
files = tree.rpmfiles()
except ftptree.SomeError:
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/16c6c5f2d4269aef64813afc632c36b5ce242afa
More information about the pld-cvs-commit
mailing list