simple summary extractor
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 15 Dec 2007 13:55:38 +0000 (13:55 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 15 Dec 2007 13:55:38 +0000 (13:55 +0000)
summary.py [new file with mode: 0755]
vbuild-nightly.sh

diff --git a/summary.py b/summary.py
new file mode 100755 (executable)
index 0000000..7919a92
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# read a full log and tries to extract the interesting stuff
+
+import sys,re
+m_beg=re.compile('.* BEG RPM.*')
+m_installing_any=re.compile('\r  (Installing:[^\]]*]) ')
+m_installing_err=re.compile('\r  (Installing:[^\]]*])(..+)')
+m_installing_end=re.compile('Installed:.*')
+m_installing_doc=re.compile(".*such file or directory for /usr/share/info.*")
+
+def scan_log (filename):
+
+    try:
+        if filename=="-":
+            filename="stdin"
+            f=sys.stdin
+        else:
+            f=open(filename)
+        echo=False
+        for line in f.xreadlines():
+            if m_beg.match(line):
+                print line,
+            elif m_installing_err.match(line):
+                (installing,error)=m_installing_err.match(line).groups()
+                print installing
+                print error
+                echo=True
+            elif m_installing_end.match(line):
+                echo=False
+            elif m_installing_any.match(line):
+                if echo: 
+                    installing=m_installing_any.match(line).group(1)
+                    print installing
+                echo=False
+            else:
+                if echo: print line,
+        f.close()
+    except:
+        print 'Failed to analyze',filename
+
+if __name__ == "__main__":
+    for arg in sys.argv[1:]:
+        scan_log(arg)
index 22d9af8..4a69bc9 100755 (executable)
@@ -34,7 +34,8 @@ DATE=$(date +'%Y.%m.%d')
 function summary () {
     from=$1; shift
     echo "******************** BEG SUMMARY" 
-    tr -d '\r' < $from | egrep 'BEG RPM|not installed|Installing:.*([eE]rror|[wW]arning)' 
+#   tr -d '\r' < $from | egrep 'BEG RPM|not installed|Installing:.*([eE]rror|[wW]arning)' 
+    ./summary.py < $from 
     echo "******************** END SUMMARY" 
 }