]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
- if no args passed, load whole tree files
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 3 Feb 2011 07:35:25 +0000 (07:35 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 3 Feb 2011 07:35:25 +0000 (07:35 +0000)
Changed files:
    bin/pfa-lintpkg -> 1.2

bin/pfa-lintpkg

index b89d153743d608e79bd25ec06f9affc429eefdd2..a5ce67f9dbd42e39b5ddb8ac2123569da32be257 100644 (file)
@@ -8,7 +8,7 @@ import ftptree
 from common import checkdir
 import ftpio
 
-if len(sys.argv) < 3:
+if len(sys.argv) < 2:
     print >>sys.stderr, "ERR: not enough parameters given"
     print >>sys.stderr, "rpmlint.py tree package1 [package2...]"
     sys.exit(1)
@@ -23,8 +23,18 @@ if not ftpio.lock(sys.argv[1], True):
 
 files = []
 try:
-    tree = ftptree.FtpTree(sys.argv[1])
-    tree.mark4moving(sys.argv[2:])
+    if len(sys.argv) < 3:
+        loadall = True
+    else:
+        loadall = False
+
+    # if no files specified, grab whole tree contents
+    tree = ftptree.FtpTree(sys.argv[1], loadall = loadall)
+    if loadall:
+        # this is hack, should be a param, not access private .loadedpkgs element
+        tree.mark4moving(tree.loadedpkgs)
+    else:
+        tree.mark4moving(sys.argv[2:])
     files = tree.rpmfiles(debugfiles = False, sourcefiles = False)
 
 except ftptree.SomeError:
@@ -61,12 +71,11 @@ def chunk(seq, size, pad=None):
          yield seq[-mod:]
 
 def rpmlint(files):
-    print files
     cmd = ['/usr/bin/rpmlint'] + files
     rc = subprocess.call(cmd, stdin = subprocess.PIPE, stdout = sys.stdout, stderr = sys.stderr, close_fds = True)
     return rc == 0
 
 print "rpmlint of %d files from %d packages" % (len(files), len(tree.loadedpkgs))
 for x in chunk(files, 512):
-    print "rpmlint %d files" % len(x)
+    print "rpmlint %d of %d files" % (len(x), len(files))
     rpmlint(x)
This page took 0.026558 seconds and 4 git commands to generate.