ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeScramInfo.py
Revision: 1.1
Committed: Mon Sep 7 09:46:41 2009 UTC (15 years, 7 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
Log Message:
New integration build page using TWiki

File Contents

# Content
1 #!/usr/bin/env python
2
3 # make sure this is first to trap also problems in includes later
4
5 import os, sys, time, re
6
7
8
9 class makeScramInfo(object):
10
11 def __init__(self, scramInfo,packagename,day,arch):
12 import config
13 self.scramInfo = open(config.siteInfo['IBPath']+scramInfo,'w')
14 self.packagename = packagename
15 self.day =day
16 self.arch = arch
17 self.scramInfo.write('%META:TOPICINFO{author="GunmoRyu" date="1249052809" format="1.1" version="1.1"}%\n')
18 self.scramInfo.write('%META:TOPICPARENT{name="'+packagename+'"}%\n')
19 self.scramInfo.write('---+*CMSSW Integration Build Scram Information*\n')
20 self.scramInfo.write('---------------------\n')
21 def __del__(self):
22 self.scramInfo.write('-- Main.GunmoRyu - 31 Jul 2009\n')
23 self.scramInfo.close()
24
25
26 # --------------------------------------------------------------------------------
27
28 def analyzeLogFile(self, lines):
29
30 scramErrRe = re.compile('\*+.?ERROR: .*?\s*src/([A-Z].*?/[A-Z].*?)/.*')
31 scramWarnRe = re.compile('\*+WARNING: .*?\s*src/([A-Z].*?/[A-Z].*?)/.*')
32 prepkg=''
33 errPkg = {}
34 warnPkg = {}
35 startFound = False
36 linesOut = []
37 nErr = 0
38 nWarn = 0
39 for line in lines:
40 if "Resetting caches" in line: startFound = True
41 if not startFound: continue
42 linesOut.append(line)
43
44 scramErrMatch = scramErrRe.match(line)
45 if scramErrMatch :
46 nErr += 1
47 pkg = scramErrMatch.group(1)
48 if pkg not in errPkg :
49 errPkg[pkg] = 1
50 else:
51 errPkg[pkg] += 1
52
53 scramWarnMatch = scramWarnRe.match(line)
54 if scramWarnMatch :
55 nWarn += 1
56 pkg = scramWarnMatch.group(1)
57 if pkg not in warnPkg :
58 warnPkg[pkg] = 1
59 else:
60 warnPkg[pkg] += 1
61
62 pkgList = errPkg.keys()
63 if len(pkgList) > 0:
64 self.scramInfo.write('---+A total of '+str(nErr)+' SCRAM errors in '+str(len(pkgList))+' packages found in build.\n')
65 self.scramInfo.write('| *Package* | *Scram Errors* |\n')
66 pkgList.sort()
67 for pkg in pkgList:
68 err = errPkg[pkg]
69 if pkg==prepkg :
70 self.scramInfo.write('| ^ | '+str(err)+' |\n')
71 else :
72 self.scramInfo.write('| !'+pkg+' | '+ str(err)+' |\n')
73 prepkg=pkg
74 else:
75 self.scramInfo.write('---+*No SCRAM errors found in build.*\n')
76
77 pkgList = warnPkg.keys()
78 if len(pkgList) > 0:
79 self.scramInfo.write('---+A total of '+str(nWarn)+' SCRAM warnings in '+str(len(pkgList))+' packages found in build.\n')
80 self.scramInfo.write('| *Package* | *Scram Warnings* |\n')
81 pkgList.sort()
82 for pkg in pkgList:
83 warn = warnPkg[pkg]
84 if pkg == prepkg :
85 self.scramInfo.write('| ^ | '+str(warn)+' |\n')
86 else :
87 self.scramInfo.write('| !'+pkg+' | '+ str(warn)+' |\n')
88 prepkg=pkg
89 else:
90 self.scramInfo.write('---+*No SCRAM warnings found in build.*\n')
91
92 return linesOut
93
94 # --------------------------------------------------------------------------------
95
96 def makeLog(self):
97
98
99 summarytype = self.packagename[6]+'.'+self.packagename[8]+'-'+self.day+'-'+self.packagename[23:25]
100 url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/rc/'+self.arch+'/www/'+self.day+'/'+summarytype+'/'+self.packagename+'/scramInfo.log'
101 print url
102 lines = []
103 page = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
104
105 try:
106 lines = page.readlines()
107 page.close()
108 except:
109 self.scramInfo.write("no log\n")
110 return
111
112 self.analyzeLogFile(lines)
113
114 return
115
116
117
118 if __name__ == '__main__' :
119 pass
120
121
122
123