pld-ftp-admin: bin/pfa-lintpkg - handle broken reporting (mailman pkg), see...

glen glen at pld-linux.org
Sun Feb 13 13:03:58 CET 2011


Author: glen                         Date: Sun Feb 13 12:03:58 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- handle broken reporting (mailman pkg), see http://rpmlint.zarb.org/cgi-bin/trac.cgi/ticket/201

---- Files affected:
pld-ftp-admin/bin:
   pfa-lintpkg (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: pld-ftp-admin/bin/pfa-lintpkg
diff -u pld-ftp-admin/bin/pfa-lintpkg:1.10 pld-ftp-admin/bin/pfa-lintpkg:1.11
--- pld-ftp-admin/bin/pfa-lintpkg:1.10	Sat Feb 12 20:18:09 2011
+++ pld-ftp-admin/bin/pfa-lintpkg	Sun Feb 13 13:03:52 2011
@@ -83,6 +83,8 @@
 
     def get_stats(self, file):
         cachefile = self.cachefile(file)
+        if not os.path.exists(cachefile):
+            return None
 
         # show last line (that contains status)
         l = (open(cachefile, 'r').readlines())[-1]
@@ -118,14 +120,20 @@
             print "\r\033[0K%d packages and %d specfiles checked; %d errors, %d warnings." % (self.packages, self.specfiles, self.errors, self.warnings)
         sys.stdout.flush()
 
+    def cat(self, file):
+        print "".join(open(file, 'r').readlines())
+
     def show_results(self, file):
         m = self.get_stats(file)
         if not m:
             return False
 
         cachefile = self.cachefile(file)
+        if not os.path.exists(cachefile):
+            print "MISSING: report: %s" % file
+
         if m['errors'] > 0 or m['warnings'] > 0:
-            print "".join(open(cachefile, 'r').readlines())
+            self.cat(cachefile)
 
     def rpmlint(self, file):
         cachefile = self.cachefile(file)
@@ -141,6 +149,8 @@
                 raise
             outfd.close()
         if not self.update_stats(file):
+            # update failed, dump cache and remove it
+            self.cat(cachefile)
             os.unlink(cachefile)
             rc = 1
         return rc == 0
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/bin/pfa-lintpkg?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list