def getListFromLogFiles(logfiles):
logindex = []
global pidlen, verlen
- c = re.compile(r"===== Hi, me zypper (\d+.\d+.\d+)\s(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).+\((\d+)\).+=====\s(.+)\s=====")
+ # ===== Hi, me zypper 1.5.7
+ # ===== Hi, me zypper 1.5.7 built Jul 28 2011 17:19:50 =====
+ # genericfrontend.cc(main):675 Launched YaST2 component 'y2base' 'installation' '("continue")' 'qt'
+ c = re.compile(r"===== Hi, me zypper (\d+.\d+.\d+).*$\s(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).+\((\d+)\).+=====\s(.+)\s=====|genericfrontend.cc.*Launched (YaST2) component (.*)$\s(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).+\((\d+)\)", re.M)
for logfile in logfiles:
print >> sys.stderr, "Reading %s" % logfile, '.' * (filenamelen - len(logfile) + 3),
sys.stderr.flush()
for run in c.findall(readFile(logfile)):
- if len(run[2]) > pidlen:
- pidlen = len(run[2])
- if len(run[0]) > verlen:
- verlen = len(run[0])
- logindex.append({'version': run[0],
- 'time': time.strptime(run[1], "%Y-%m-%d %H:%M:%S"),
- 'pid': run[2],
- 'cmd': run[3].replace("'", "")})
+ if run[4] == 'YaST2':
+ ver = run[4]
+ tim = run[6]
+ pid = run[7]
+ cmd = run[5]
+ else:
+ ver = run[0]
+ tim = run[1]
+ pid = run[2]
+ cmd = run[3]
+
+ if len(pid) > pidlen:
+ pidlen = len(pid)
+ if len(ver) > verlen:
+ verlen = len(ver)
+ logindex.append({'version': ver,
+ 'time': time.strptime(tim, "%Y-%m-%d %H:%M:%S"),
+ 'pid': pid,
+ 'cmd': cmd.replace("'", "")})
print >> sys.stderr, "DONE"
sys.stderr.flush()
print >> sys.stderr, ""