pld-ftp-admin: scripts/lintpkg.py - print only status messages when processing
glen
glen at pld-linux.org
Thu Feb 10 06:47:54 CET 2011
Author: glen Date: Thu Feb 10 05:47:54 2011 GMT
Module: pld-ftp-admin Tag: HEAD
---- Log message:
- print only status messages when processing
---- Files affected:
pld-ftp-admin/scripts:
lintpkg.py (1.3 -> 1.4)
---- Diffs:
================================================================
Index: pld-ftp-admin/scripts/lintpkg.py
diff -u pld-ftp-admin/scripts/lintpkg.py:1.3 pld-ftp-admin/scripts/lintpkg.py:1.4
--- pld-ftp-admin/scripts/lintpkg.py:1.3 Wed Feb 9 08:52:57 2011
+++ pld-ftp-admin/scripts/lintpkg.py Thu Feb 10 06:47:48 2011
@@ -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 @@
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 @@
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"
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/scripts/lintpkg.py?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list