[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. 0.51

David Steele dsteele at gmail.com
Wed May 15 10:09:38 UTC 2013


The following commit has been merged in the master branch:
commit e74c13fc2f32aed7b8164c3385634abb373e58c3
Author: David Steele <dsteele at gmail.com>
Date:   Tue Jan 22 23:40:24 2013 -0500

    detect_well_known_errors - Use python re for fast kpr generation.
    
    Run with full .kpr replacement is 2 1/2 minutes vs. 28 minutes for
    grep, per section, with stale file buffers, and idle slaves.
    Subsequent runs are 15 seconds vs. 60 seconds. Replacing the
    packagesdb rdep sort with an alpha sort reduces that to 5 seconds.

diff --git a/master-bin/detect_well_known_errors b/master-bin/detect_well_known_errors
index 38ae96a..a9a6d7c 100755
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@ -107,6 +107,13 @@ class Problem():
 
         self.init_problem()
 
+        self.inc_re = re.compile( self.INCLUDE )
+
+        if "EXCLUDE" in self.__dict__:
+            self.exc_re = re.compile( self.EXCLUDE )
+        else:
+            self.exc_re = None
+
     def init_problem(self):
         """Load problem file parameters (HELPTEXT="foo" -> self.HELPTEXT)"""
 
@@ -135,13 +142,12 @@ class Problem():
         """Does the log text 'logbody' contain this known problem?"""
 
         if where in self.WHERE:
-
-            s = subprocess.Popen( self.COMMAND, stdin=subprocess.PIPE,
-                 stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True )
-            s.communicate( logbody )
-
-            if s.returncode != 1:
-                return( True )
+            if self.inc_re.search( logbody, re.MULTILINE ):
+                for line in logbody.splitlines():
+                    if self.inc_re.search( line ):
+                        if self.exc_re == None \
+                               or not self.exc_re.search(line):
+                            return( True )
 
         return( False )
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list