def writereport(dict, dir, title): shutil.rmtree(dir, True) os.makedirs(dir) f = open(dir+'/index.html', 'w') print >>f, '<html>' print >>f, '<head>' print >>f, '<title>'+title+'</title>' # print >>f, '<link rel="stylesheet" type="text/css" href="newspaper.css">' print >>f, '<style type="text/css">' css = open(rel+'newspaper.css') for line in css: print >>f, line.rstrip() css.close() print >>f, '</style>' print >>f, '</head>' print >>f, '<body>' if len(dict) == 0: print >>f, '<h3>No recent changes</h3>' else: print >>f, '<table id="newspaper">' print >>f, '<caption>'+title+'</caption>' print >>f, '<tr>' print >>f, '<th>Plugin</th>' print >>f, '<th>Hudson Version</th>' print >>f, '<th>Jenkins Version</th>' print >>f, '</tr>' for key in sorted(dict.keys()): row = dict[key] hversion = row['hversion'] jversion = row['jversion'] td = '<td>' needtoknow = False if cmpversion(hversion, jversion) < 0: color = "#FDFFBB" # pastel yellow if percentmap is not None: percent = percentmap.get(key, None) if percent: if percent >= 5.0: color = "#FFCBE2" # pastel red needtoknow = True elif percent >= 2.0: color = "#FFD5BF" # pastel amber needtoknow = True td = '<td bgcolor="%s">' % color if row['hversion'] != 'None' or needtoknow: print >>f, '<tr>' print >>f, td+key+'</td>' print >>f, td+hversion+'</td>' print >>f, td+jversion+'</td>' print >>f, '</tr>' print >>f, '</table>' print >>f, '<div id="newspaper">' print >>f, '<p>Legend:</p>' for line in legend: print >>f, line print >>f, '</div>' print >>f, '</body>' print >>f, '</html>' f.close()
def resetToHighTag(): p = subprocess.Popen(['git', 'tag'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) tags = [] while True: line = p.stdout.readline() if not line: break tags.append(line.strip()) if p.wait() == 0: if _debug: print tags max = 'max' for tag in tags: if cmpversion(max, tag) < 0: max = tag if _debug: print max if max != 'max': if not subprocess.call(['git', 'reset', '--hard', max]): if _debug: print max return max if _debug: print 'Failed' return None
for key, jplugin in jplugins.items(): jversion = jplugin['version'] hplugin = hplugins.get(key, None) extract[key] = ex = {} ex['version'] = jversion ex['url'] = jplugin['url'] setscm(key, ex) ex['diff'] = 'Same' labels = jplugin.get('labels') addlabels(jlabels, labels) if labels and '' in labels: jemptylabels.append(key) if not hplugin: ex['diff'] = 'Missing' notinhudson.append(key) if hplugin is not None and cmpversion(hplugin['version'], jversion) < 0: ex['diff'] = 'Older' olderinhudson.append(key) for key, hplugin in hplugins.items(): labels = hplugin.get('labels') if len(labels) > 1: multilabels[key] = labels if '' in labels: hemptylabels.append(key) addlabels(hlabels, labels) if not jplugins.get(key, None): # We have already added all the hudson/jenkins pairs notinjenkins.append(key) difflabels = jlabels.difference(hlabels)
uptodate = 0 forked = 0 forkedolder = 0 forkeduptodate = 0 forkedpattern = re.compile(r"-h-[0-9]") original = 0 featured = 0 for key, jplugin in jplugins.items(): jversion = jplugin['version'] hplugin = hplugins.get(key, None) splugin = status.get(key, None) if key in donotupdate: featured += 1 continue; if hplugin and (not splugin or not splugin.get('jversion', None) or cmpversion(splugin['jversion'], jversion) != 0): hversion = hplugin['version'] if cmpversion(hversion, jversion) < 0: # this is a reportable change! changes[key] = change = {} change['hversion'] = hversion change['jversion'] = jversion status[key] = stat = {} stat['jversion'] = jversion if hplugin: hversion = hplugin['version'] stat['hversion'] = hversion old = cmpversion(hversion, jversion) < 0 fork = re.search(forkedpattern, hversion) if old: older += 1