--- UserCode/TWikiIB/makeDepMetrics.py 2009/09/07 09:46:41 1.1 +++ UserCode/TWikiIB/makeDepMetrics.py 2009/09/09 19:47:48 1.13 @@ -2,137 +2,96 @@ import re, os class mkDepMetrics(object) : - def __init__(self, page, tday, arch, package_name) : + def __init__(self, page, tday, arch, packagename) : self.page=page self.tday = tday self.arch = arch - self.package_name = package_name - self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+package_name+'/igRun/metrics' - self.contents = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url) - - self.page.write(""" - - - -""") - + self.packagename = packagename + self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+packagename+'/igRun/metrics' + temp = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url) + self.contents=[] + self.contents = temp.readlines() + + + def makeSummary(self): + contents=self.contents + writeflag = False + cycleflag = False + typeCycle = re.compile('^(Cycle \w*)') + if len(contents)==0 : + self.page.write(' * No data about summary\n') + for line in contents : + matchCycle = typeCycle.search(line) + if line=='# Summary\n' : + self.page.write(' * Summary\n') + writeflag = True + elif line=='# Levels\n' : + writeflag = False + cycleflag = False + self.page.write('''
+* CCD:  Cumulative Component Dependency measures the cumulative testing cost
+        across the system.
+* ACD:  Average Component Dependency indicates the number of other packages
+        an average package depends on.
+* NCCD: Normalised Cumulative Component Dependency measures how the structure
+        differs from a balanced binary tree of comparable size. If NCCD is one,
+        the structure resembles a binary tree; if much less than one, the
+        packages are mostly independent; if much greater than one, the system
+        is fairly strongly coupled. The only universal NCCD target is to
+        minimise for any given software system--a high value indicates a
+        strongly coupled system and less coupling is better.
+
+''') + break + elif line=='\n' : + continue + elif line[0:5] =='* CCD' : + writeflag = False + elif line=='# Cycles\n' : + self.page.write(' * Cycles\n') + cycleflag=True + elif matchCycle and cycleflag : + self.page.write(' * '+matchCycle.group(1)+'\n') + elif cycleflag : + self.page.write(' * !'+line.strip()+'\n') + elif writeflag : + self.page.write(' * '+line) + else : + continue def packlist(self): - contents=self.contents - pack = [['Levels']] - j=0 - while 1: - l = contents.readline() - if not l: - if j==0 : self.page.write('---+++++No data about metrics information.\n') - break - m1 = re.search('# Levels',l) - if m1: - while 1: - l2 = contents.readline() - if not l2: - break - if l2=='\n': - continue - m2 = re.search('[0-9]. ',l2) - if m2: - j = j + 1 - temp = l2.split() - pack.append(temp) - - while 1: - l3 = contents.readline() - if l3=='\n': - break - if not l3: - break - temp =l3.split() - pack[j].extend(temp) - + contents=self.contents + pack = [['Levels']] + j=0 + writeflag = False + valueflag = False + if len(contents)==0 : + self.page.write(' * No data about metrics information.\n') return pack + for line in contents : + if line =='# Levels\n' : + writeflag = True + continue + elif not writeflag : + continue + if line=='\n': + continue + matchLevel = re.search('[0-9]. ',line) + if matchLevel : + j = j + 1 + temp = line.split() + pack.append(temp) + valueflag=True + continue + if valueflag : + if line=='\n' : + valueflag=False + continue + else : + temp =line.strip() + pack[j].append(temp) + return pack # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...] def repack(self,pack): listlen = len(pack) @@ -152,10 +111,8 @@ class mkDepMetrics(object) : temp.append(title) packname.append(temp) packname[check].append(module) - #print packname[0] else: if packname[check][0]==title: - #print 'it\'s work!' packname[check].append(module) else: check = check + 1 @@ -168,14 +125,14 @@ class mkDepMetrics(object) : return pack2 def dropdown(self,list): - self.page.write('
\n\n') + self.page.write('\n
\n\n') listlen = len(list) for level in range(1,listlen): self.page.write(' * !'+str(list[level][0][0])+'\n') for pack in range(1,len(list[level])): self.page.write(' * !'+str(list[level][pack][0])+'\n') for module in range(1,len(list[level][pack])): - self.page.write(' * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.package_name+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n') + self.page.write(' * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.packagename+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n') self.page.write('
\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n

\n\n')