pld-ftp-admin: scripts/lintpkg.py - if no args passed, load whole tree files

glen glen at pld-linux.org
Thu Feb 3 08:35:31 CET 2011


Author: glen                         Date: Thu Feb  3 07:35:31 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- if no args passed, load whole tree files

---- Files affected:
pld-ftp-admin/scripts:
   lintpkg.py (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: pld-ftp-admin/scripts/lintpkg.py
diff -u pld-ftp-admin/scripts/lintpkg.py:1.1 pld-ftp-admin/scripts/lintpkg.py:1.2
--- pld-ftp-admin/scripts/lintpkg.py:1.1	Tue Feb  1 21:39:32 2011
+++ pld-ftp-admin/scripts/lintpkg.py	Thu Feb  3 08:35:25 2011
@@ -8,7 +8,7 @@
 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 @@
 
 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 @@
          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)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/scripts/lintpkg.py?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list