[projects/pld-ftp-admin] checkdir: refuse a directory that is not an ftp tree

arekm arekm at pld-linux.org
Sat Nov 21 10:42:37 CET 2026


commit 31cbd019ca6146d00e02c00dd2247abf2f9220e1
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Nov 21 01:28:31 2026 +0100

    checkdir: refuse a directory that is not an ftp tree
    
    .archive passed for the archive tree .archive/PLD: a tool then locked
    it and stopped with a traceback on the missing SRPMS/.metadata.
    pfa-genindex, which indexes binary trees too, checks only that it exists.

 bin/pfa-genindex  | 2 +-
 modules/common.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/bin/pfa-genindex b/bin/pfa-genindex
index 7007316..32d3ba2 100755
--- a/bin/pfa-genindex
+++ b/bin/pfa-genindex
@@ -84,7 +84,7 @@ if not quiet:
 # a tree named twice (PLD and PLD/, or a symlink) would get two jobs writing the same index at once
 named = {}
 for tree in trees:
-    checkdir(tree)
+    checkdir(tree, metadata = False)
     named.setdefault(os.path.realpath(ftp_dir + tree), tree)
 trees = list(named.values())
 
diff --git a/modules/common.py b/modules/common.py
index 5a3c9c7..46375de 100644
--- a/modules/common.py
+++ b/modules/common.py
@@ -13,10 +13,14 @@ def fileexists(path):
         fullpath = config.ftp_dir + path
     return os.path.exists(fullpath)
 
-def checkdir(dir):
+def checkdir(dir, metadata = True):
+    """Exits unless dir exists and, with metadata, is an ftp tree: .archive/PLD is one, .archive only holds them"""
     if not fileexists(dir):
         print('ERR: ' + config.value['ftp_dir']+'/' + dir + " does not exist", file=sys.stderr)
         sys.exit(1)
+    if metadata and not fileexists(dir + '/SRPMS/.metadata'):
+        print('ERR: ' + config.value['ftp_dir']+'/' + dir + " is not an ftp tree, it has no SRPMS/.metadata", file=sys.stderr)
+        sys.exit(1)
 
 if 'HOME' in os.environ:
     ftpadmdir = os.environ['HOME'] + '/pld-ftp-admin'
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/a049a512859eaede288d71649a2320e16c959476



More information about the pld-cvs-commit mailing list