diff options
author | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-26 15:18:35 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-26 15:18:35 (GMT) |
commit | d72ab057233cb80919cd82de107690ee96951e90 (patch) | |
tree | eba0837c2b7cdf80b00eb684d93341130b9bec2e /scripts | |
parent | 7c177eaba802a65a649d845fb8445c1782065cb9 (diff) |
Release report has been factored out to sugar-tools.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/report.py | 107 |
1 files changed, 1 insertions, 106 deletions
diff --git a/scripts/report.py b/scripts/report.py index 41e9a00..3617ee2 100644 --- a/scripts/report.py +++ b/scripts/report.py @@ -1,12 +1,7 @@ import os -import sys import urllib import csv -import re import smtplib -import subprocess -import htmllib -import formatter from optparse import make_option import StringIO @@ -48,100 +43,6 @@ class TextWriter(object): for number, testcase in testcases: self.out.write('#%s\n\n%s\n\n\n' % (number, testcase)) -class ReleaseReport(object): - def __init__(self, config, release): - module, self._version = release.rsplit('-', 1) - - module_set = jhbuild.moduleset.load(config) - self._module = module_set.modules[module] - self._config = config - self._tickets = [] - self._testcases = [] - - def generate(self): - cwd = os.getcwd() - os.chdir(self._module.get_srcdir(self._config)) - - p = subprocess.Popen(['git', 'tag'], stdout=subprocess.PIPE) - tags = p.stdout.read().split('\n') - tags = [ tag for tag in tags if tag.startswith('v') ] - - release_tag = 'v' + self._version - try: - i = tags.index(release_tag) - except ValueError: - print 'The tag you provided does not exist.' - return - - if i > 0: - previous = tags[i - 1] - interval = previous + '..' + release_tag - else: - interval = release_tag - - p = subprocess.Popen(['git', 'log', interval, - '--pretty=format:%an|||%s'], - stdout=subprocess.PIPE) - commits = p.stdout.read().split('\n') - - tickets = [] - for row in commits: - author, subject = row.split('|||') - - match = re.search("\#([0-9]*)", subject) - if match: - tickets.append(match.group(1)) - - for n in tickets: - f = urllib.urlopen('http://dev.laptop.org/ticket/%s?format=csv' % n) - - reader = csv.DictReader(f) - row = reader.next() - - ticket = { 'number' : row['id'], - 'summary' : row['summary'] } - self._tickets.append(ticket) - - f.close() - - url = 'http://dev.laptop.org/ticket/%s?format=rss' % n - - import feedparser - parser = feedparser.parse(url) - - for entry in parser.entries: - out = StringIO.StringIO() - - writer = formatter.DumbWriter(out) - form = formatter.AbstractFormatter(writer) - - html_parser = htmllib.HTMLParser(form) - html_parser.feed(entry['summary_detail']['value']) - html_parser.close() - - comment = out.getvalue().strip() - - out.close() - - marker = '|testcase|' - i = comment.lower().find(marker) - if i >= 0: - i += len(marker) - self._testcases.append([n, comment[i:].strip()]) - - os.chdir(cwd) - - def write(self, writer): - writer.write_headline('Closed tickets') - writer.write_tickets(self._tickets, compact=True) - - if self._testcases: - writer.write_headline('Testcases') - writer.write_testcases(self._testcases) - - def save(self): - pass - class ReviewsReport(object): def __init__(self, config): self._requested = {} @@ -246,7 +147,7 @@ class cmd_report(Command): ]) def run(self, config, options, args): - report_types = [ 'reviews', 'release' ] + report_types = [ 'reviews' ] if options.type not in report_types: print 'Available reports:\n' + '\n'.join(report_types) @@ -254,12 +155,6 @@ class cmd_report(Command): if options.type == 'reviews': report = ReviewsReport(config) - elif options.type == 'release': - if args: - report = ReleaseReport(config, args[0]) - else: - print 'Please provide a module name.' - return 1 report.generate() |