[Collab-qa-commits] r395 - log-analysis

lucas at alioth.debian.org lucas at alioth.debian.org
Thu Aug 30 13:11:13 UTC 2007


Author: lucas
Date: 2007-08-30 13:11:13 +0000 (Thu, 30 Aug 2007)
New Revision: 395

Modified:
   log-analysis/parse-logs-piuparts.rb
Log:
improved parse-logs-piuparts

Modified: log-analysis/parse-logs-piuparts.rb
===================================================================
--- log-analysis/parse-logs-piuparts.rb	2007-08-29 21:14:41 UTC (rev 394)
+++ log-analysis/parse-logs-piuparts.rb	2007-08-30 13:11:13 UTC (rev 395)
@@ -3,12 +3,12 @@
 dir = ARGV[0]
 
 REASONS = [
-   [ /ERROR: Broken symlinks:$/, 'BRKSYM' ],
-   [ /ERROR: After purging files have been modified:$/, 'FILESMODIFIED' ],
-   [ /ERROR: Command failed/, 'CMDFAILED' ],
-   [ /ERROR: Processes are running inside chroot:$/, 'PROCESSESRUNNING' ],
-   [ /ERROR: Package purging left files on system:/, 'LEFTFILES' ],
-   [ /ERROR: After purging files have disappeared:/, 'FILESDISA' ],
+   [ / ERROR: Broken symlinks:$/, 'BRKSYM' ],
+   [ / ERROR: After purging files have been modified:$/, 'FILESMODIFIED' ],
+   [ / ERROR: Command failed/, 'CMDFAILED' ],
+   [ / ERROR: Processes are running inside chroot:$/, 'PROCESSESRUNNING' ],
+   [ / ERROR: Package purging left files on system:/, 'LEFTFILES' ],
+   [ / ERROR: After purging files have disappeared:/, 'FILESDISA' ],
    [ /(add|del)(user|group): command not found/, 'ADDUSER_NOT_FOUND' ],
    [ /(user|group)(del|add): command not found/, 'PASSWD_NOT_FOUND' ],
    [ /update-inetd: command not found/, 'INETD_NOT_FOUND' ],
@@ -18,13 +18,16 @@
    [ /\/usr\/share\/wwwconfig-common\/mysql-dropuser.sh: No such file or directory/, 'WWWCONFIG_NOT_FOUND' ],
    [ /sbin\/update-modules: No such file or directory/, 'UPDATE_MODULES_NOT_FOUND' ],
    [ /^  E: Broken packages$/, 'BRKPKG' ],
-   [ /dbconfig-common:/, 'DBCONFIG_COMMON' ],
 ]
 
-(Dir::entries(dir) - ['.', '..']).each do |f|
+(Dir::entries(dir) - ['.', '..']).sort.reverse.each do |f|
   s = IO::read(dir + '/' + f)
   h = s.grep(/^DC-Piuparts-Header: /)[0]
   stat = s.grep(/^DC-Piuparts-Status: /)[0]
+  if stat.nil? or h.nil?
+    STDERR.puts "File with no DC- headers: #{f}"
+    next
+  end
   rest1, pkg, v, rest2 = h.split(' ',4)
   if stat.nil? # build not finished
     result = "Unknown"
@@ -48,7 +51,7 @@
     end
   end
   # fetch version
-  setups = s.scan(/^  Setting up #{pkg} \((.*)\) ...$/)
+  setups = s.scan(/^  Setting up #{Regexp::escape(pkg)} \((.*)\) ...$/)
   if setups.length == 0
     vers = 'UKN'
   elsif setups.length == 1




More information about the Collab-qa-commits mailing list