1 |
#!/usr/bin/env python
|
2 |
|
3 |
# make sure this is first to trap also problems in includes later
|
4 |
import os,sys,time,re
|
5 |
|
6 |
|
7 |
|
8 |
class makeCfgInfo(object):
|
9 |
|
10 |
def __init__(self, cfgInfo, packagename,day,arch) :
|
11 |
import config
|
12 |
self.cfgInfo = open(config.siteInfo['IBPath']+cfgInfo,'w')
|
13 |
self.day = day
|
14 |
self.arch = arch
|
15 |
self.packagename = packagename
|
16 |
self.cfgInfo.write('%META:TOPICINFO{author="GunmoRyu" date="1249052809" format="1.1" version="1.1"}%\n')
|
17 |
self.cfgInfo.write('%META:TOPICPARENT{name="'+packagename+'"}%\n')
|
18 |
self.cfgInfo.write('---+*CMSSW Integration Build Cfg Information*\n')
|
19 |
self.cfgInfo.write('---------------------\n')
|
20 |
def __del__(self):
|
21 |
self.cfgInfo.write('-- Main.GunmoRyu - 31 Jul 2009\n')
|
22 |
self.cfgInfo.close()
|
23 |
|
24 |
|
25 |
def analyzeLogFile(self,lines) :
|
26 |
print 'makeCfgInfo analyzeLogFile start!'
|
27 |
cfgInfo = {}
|
28 |
prePkg=''
|
29 |
for line in lines:
|
30 |
try:
|
31 |
pkg, num = line.split(':')
|
32 |
if num.strip() == '0': continue
|
33 |
cfgInfo[pkg] = num
|
34 |
except:
|
35 |
raise
|
36 |
|
37 |
pkgList = cfgInfo.keys()
|
38 |
if len(pkgList) > 0:
|
39 |
self.cfgInfo.write('---+Found a total of '+str(len(pkgList))+' packages with old style config files\n')
|
40 |
self.cfgInfo.write('| *Package* | *# of Old Style Cfg* |\n')
|
41 |
pkgList.sort()
|
42 |
for pkg in pkgList:
|
43 |
err = cfgInfo[pkg]
|
44 |
if pkg==prePkg :
|
45 |
self.cfgInfo.write('| ^ | '+str(err).strip()+' |\n')
|
46 |
else :
|
47 |
self.cfgInfo.write('| !'+pkg.strip()+' | '+ str(err).strip()+' |\n')
|
48 |
prepkg=pkg
|
49 |
else:
|
50 |
self.cfgInfo.write('---+*No packages with old style config files found.*\n')
|
51 |
|
52 |
print 'makeCfgInfo analyzeLogFile end!'
|
53 |
return
|
54 |
|
55 |
# --------------------------------------------------------------------------------
|
56 |
|
57 |
def makeLog(self):
|
58 |
|
59 |
summarytype = self.packagename[6]+'.'+self.packagename[8]+'-'+self.day+'-'+self.packagename[23:25]
|
60 |
url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/rc/'+self.arch+'/www/'+self.day+'/'+summarytype+'/'+self.packagename+'/cfgInfo.log'
|
61 |
lines = []
|
62 |
page = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
|
63 |
try:
|
64 |
lines = page.readlines()
|
65 |
page.close()
|
66 |
except:
|
67 |
self.cfgInfo.write("no log\n")
|
68 |
pass
|
69 |
|
70 |
self.analyzeLogFile(lines)
|
71 |
|
72 |
return
|
73 |
|
74 |
|
75 |
if __name__ == '__main__' :
|
76 |
pass
|