]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
- print only status messages when processing
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 10 Feb 2011 05:47:48 +0000 (05:47 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 10 Feb 2011 05:47:48 +0000 (05:47 +0000)
Changed files:
    bin/pfa-lintpkg -> 1.4

bin/pfa-lintpkg

index 509de1aa1a0408f35d1b28c0f135ecf511ad172b..cd9eb5a0050bdfe464302d2bfa9d5d5a0c8f4657 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
 
-import sys, os
+import sys, os, re
 import subprocess
 sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules')
 import ftptree
@@ -48,7 +48,16 @@ cachedir = os.path.expanduser("~/tmp/rpmlint")
 if not os.path.isdir(cachedir):
     os.makedirs(cachedir)
 
+# for rpmlint stats
+packages = specfiles = errors = warnings = 0
+# 1 packages and 0 specfiles checked; 0 errors, 0 warnings.
+lintre = re.compile('(?P<packages>\d+) packages and (?P<specfiles>\d+) specfiles checked; (?P<errors>\d+) errors, (?P<warnings>\d+) warnings.')
+
 def rpmlint(file):
+    global packages
+    global specfiles
+    global errors
+    global warnings
     (dirname,filename) = os.path.split(file)
     cachefile = os.path.join(cachedir, filename+'.txt')
 
@@ -63,12 +72,23 @@ def rpmlint(file):
             raise
         outfd.close()
 
-    # print result (from cache)
-    print "".join(open(cachefile, 'r').readlines())
+    # show last line (that contains status)
+    l = (open(cachefile, 'r').readlines())[-1]
+    m = lintre.match(l)
+    if m:
+        packages += int(m.group('packages'))
+        specfiles += int(m.group('specfiles'))
+        errors += int(m.group('errors'))
+        warnings += int(m.group('warnings'))
 
     return rc == 0
 
 print "rpmlint of %d files from %d packages" % (len(files), len(tree.loadedpkgs))
 for x in files:
-    print "rpmlint %s" % x
+    (n, f) = os.path.split(x)
+    print "\r\033[0K%d packages and %d specfiles checked; %d errors, %d warnings. [%s]" % (packages, specfiles, errors, warnings, f),
+    sys.stdout.flush()
     rpmlint(x)
+
+print "\r\033[0K%d packages and %d specfiles checked; %d errors, %d warnings." % (packages, specfiles, errors, warnings)
+print "Done"
This page took 0.087924 seconds and 4 git commands to generate.