summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-10-04 23:45:38 +0200
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-10-04 23:45:38 +0200
commita6ed12cee737b66c730f8a93769f242154ee3ec1 (patch)
treed707ac2b081351bc664e9f556ed98959f10f5f48
parentAdd a tool to find reverse dependencies. (diff)
downloadarch-tools-a6ed12cee737b66c730f8a93769f242154ee3ec1.tar.gz
arch-tools-a6ed12cee737b66c730f8a93769f242154ee3ec1.tar.bz2
arch-tools-a6ed12cee737b66c730f8a93769f242154ee3ec1.zip
Update Bugzilla when stabilizing packages.
-rwxr-xr-xbatch-stabilize.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/batch-stabilize.py b/batch-stabilize.py
index 8414f44..912d26b 100755
--- a/batch-stabilize.py
+++ b/batch-stabilize.py
@@ -9,6 +9,7 @@ import re
import subprocess
import sys
+import bugz.bugzilla
import portage.versions
BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -31,6 +32,10 @@ def run_command(args, cwd, log):
finally:
log.flush()
+class MyBugz(bugz.bugzilla.Bugz):
+ def get_input(self, prompt):
+ return raw_input(prompt)
+
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -47,6 +52,11 @@ if __name__ == "__main__":
parser.error("--repo option is required")
if args:
parser.error("unrecognized command-line args")
+
+ url = 'https://bugs.gentoo.org'
+ print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
+ bugzilla = MyBugz(url)
+ bugzilla.auth()
with open(options.input_filename, "r") as input_file:
stabilization_list = []
@@ -115,3 +125,26 @@ if __name__ == "__main__":
if run_command(["repoman", "commit", "-m", commit_message], cvs_path, log_file)[0] != 0:
print '!!! repoman full failed'
sys.exit(1)
+ log_file.write('Posting automated reply in bugzilla...\n')
+ bug_xml = bugzilla.get(bug_id).find('bug')
+ has_other_arches = False
+ for cc in bug_xml.findall('cc'):
+ body, domain = cc.text.split('@', 1)
+ if domain == 'gentoo.org' and body in portage.archlist and body != options.arch:
+ has_other_arches=True
+ # We don't close bugs which still have other arches for obvious reasons,
+ # and security bugs because stabilization is not the last step for them.
+ if has_other_arches or 'Security' in bug_xml.find('product').text:
+ bugzilla.modify(
+ bug_id,
+ comment='%s stable' % options.arch,
+ remove_cc='%s@gentoo.org' % options.arch)
+ log_file.write('Successfully updated bug %d.\n' % bug_id)
+ else:
+ bugzilla.modify(
+ bug_id,
+ comment='%s stable, closing' % options.arch,
+ remove_cc='%s@gentoo.org' % options.arch,
+ status='RESOLVED',
+ resolution='FIXED')
+ log_file.write('Succesfully updated bug %d and closed it.\n' % bug_id)