From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6CDAF13877A for ; Wed, 13 Aug 2014 14:49:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7B959E08A4; Wed, 13 Aug 2014 14:49:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 14E32E08A4 for ; Wed, 13 Aug 2014 14:49:12 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C191C3405BA for ; Wed, 13 Aug 2014 14:49:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 6C36A18816 for ; Wed, 13 Aug 2014 14:49:07 +0000 (UTC) From: "Agostino Sarubbo" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Agostino Sarubbo" Message-ID: <1407941338.2fb3bebf42dd93236157c8d26afc91b932ef24c2.ago@gentoo> Subject: [gentoo-commits] dev/ago:master commit in: script/ X-VCS-Repository: dev/ago X-VCS-Files: script/batch-ekeyword-only.py script/batch-keyword.py script/batch-stabilize-force.py script/batch-stabilize-pretend.py script/batch-stabilize.py X-VCS-Directories: script/ X-VCS-Committer: ago X-VCS-Committer-Name: Agostino Sarubbo X-VCS-Revision: 2fb3bebf42dd93236157c8d26afc91b932ef24c2 X-VCS-Branch: master Date: Wed, 13 Aug 2014 14:49:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4c845edc-d109-4bd8-ac37-1877e409bfb2 X-Archives-Hash: 8f6bb6a600d415d6e7b3e901cca7155f commit: 2fb3bebf42dd93236157c8d26afc91b932ef24c2 Author: Agostino Sarubbo gentoo org> AuthorDate: Wed Aug 13 14:48:58 2014 +0000 Commit: Agostino Sarubbo gentoo org> CommitDate: Wed Aug 13 14:48:58 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=2fb3bebf New version of the batch-* script that work with pybugz-0.10 --- script/batch-ekeyword-only.py | 17 +++++------- script/batch-keyword.py | 15 ++++------- script/batch-stabilize-force.py | 54 +++++---------------------------------- script/batch-stabilize-pretend.py | 15 ++++------- script/batch-stabilize.py | 52 ++++--------------------------------- 5 files changed, 28 insertions(+), 125 deletions(-) diff --git a/script/batch-ekeyword-only.py b/script/batch-ekeyword-only.py index 4506001..b4fcd14 100755 --- a/script/batch-ekeyword-only.py +++ b/script/batch-ekeyword-only.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -12,7 +12,7 @@ import shutil import subprocess import sys -import bugz.bugzilla +from bugz.bugzilla import BugzillaProxy import portage.versions BUG_REGEX = re.compile("[Bb]ug #?(\d+)") @@ -42,10 +42,6 @@ def save_state(done_bugs): with open('batch-stabilize.state', 'w') as state_file: pickle.dump(done_bugs, state_file) -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, ...") @@ -68,10 +64,8 @@ if __name__ == "__main__": with open('batch-stabilize.state', 'r') as state_file: done_bugs = pickle.load(state_file) - url = 'https://bugs.gentoo.org' - print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = MyBugz(url) - bugzilla.auth() + url = 'https://bugs.gentoo.org/xmlrpc.cgi' + bugzilla = BugzillaProxy(url) with open(options.input_filename, "r") as input_file: stabilization_dict = {} @@ -136,3 +130,6 @@ if __name__ == "__main__": if run_command(["repoman", "manifest"], cvs_path, log_file)[0] != 0: print '!!! repoman manifest failed' sys.exit(1) + + if os.path.exists('batch-stabilize.state'): + os.remove('batch-stabilize.state') diff --git a/script/batch-keyword.py b/script/batch-keyword.py index 1c1c126..d99fdb8 100755 --- a/script/batch-keyword.py +++ b/script/batch-keyword.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -12,7 +12,7 @@ import shutil import subprocess import sys -import bugz.bugzilla +from bugz.bugzilla import BugzillaProxy import portage.versions BUG_REGEX = re.compile("[Bb]ug #?(\d+)") @@ -42,10 +42,6 @@ def save_state(done_bugs): with open('batch-stabilize.state', 'w') as state_file: pickle.dump(done_bugs, state_file) -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, ...") @@ -68,10 +64,8 @@ if __name__ == "__main__": with open('batch-stabilize.state', 'r') as state_file: done_bugs = pickle.load(state_file) - url = 'https://bugs.gentoo.org' - print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = MyBugz(url) - bugzilla.auth() + url = 'https://bugs.gentoo.org/xmlrpc.cgi' + bugzilla = BugzillaProxy(url) with open(options.input_filename, "r") as input_file: stabilization_dict = {} @@ -150,5 +144,6 @@ if __name__ == "__main__": os.chdir(cvs_path) os.system("repoman full") sys.exit(1) + if os.path.exists('batch-stabilize.state'): os.remove('batch-stabilize.state') diff --git a/script/batch-stabilize-force.py b/script/batch-stabilize-force.py index e6432b9..d335545 100755 --- a/script/batch-stabilize-force.py +++ b/script/batch-stabilize-force.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -12,7 +12,7 @@ import shutil import subprocess import sys -import bugz.bugzilla +from bugz.bugzilla import BugzillaProxy import portage.versions BUG_REGEX = re.compile("[Bb]ug #?(\d+)") @@ -42,10 +42,6 @@ def save_state(done_bugs): with open('batch-stabilize.state', 'w') as state_file: pickle.dump(done_bugs, state_file) -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, ...") @@ -68,10 +64,8 @@ if __name__ == "__main__": with open('batch-stabilize.state', 'r') as state_file: done_bugs = pickle.load(state_file) - url = 'https://bugs.gentoo.org' - print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = MyBugz(url) - bugzilla.auth() + url = 'https://bugs.gentoo.org/xmlrpc.cgi' + bugzilla = BugzillaProxy(url) with open(options.input_filename, "r") as input_file: stabilization_dict = {} @@ -146,46 +140,10 @@ if __name__ == "__main__": done_bugs.append(bug_id) save_state(done_bugs) continue - if run_command(["repoman", "commit", "--include-arches", options.arch, "-f", "-m", commit_message], cvs_path, log_file)[0] != 0: + if run_command(["repoman", "commit", "-f", "-m", commit_message], cvs_path, log_file)[0] != 0: os.chdir(cvs_path) os.system("repoman full") sys.exit(1) - bug_xml = bugzilla.get(bug_id).find('bug') - has_my_arch = False - has_other_arches = False - for cc in bug_xml.findall('cc'): - body, domain = cc.text.split('@', 1) - if domain == 'gentoo.org' and body == options.arch: - has_my_arch = True - if domain == 'gentoo.org' and body in portage.archlist and body != options.arch: - has_other_arches=True - - if not has_my_arch: - print_and_log('Seems that bugzilla has already been updated.', log_file) - done_bugs.append(bug_id) - save_state(done_bugs) - continue - - print_and_log('Posting automated reply in bugzilla...', log_file) - # 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) - print_and_log('Successfully updated bug %d.' % bug_id, log_file) - else: - bugzilla.modify( - bug_id, - comment='%s stable. Last arch, closing' % options.arch, - remove_cc='%s@gentoo.org' % options.arch, - status='RESOLVED', - resolution='FIXED') - print_and_log('Succesfully updated bug %d and closed it.' % bug_id, log_file) - - done_bugs.append(bug_id) - save_state(done_bugs) - + if os.path.exists('batch-stabilize.state'): os.remove('batch-stabilize.state') diff --git a/script/batch-stabilize-pretend.py b/script/batch-stabilize-pretend.py index daafc5a..2e5996b 100755 --- a/script/batch-stabilize-pretend.py +++ b/script/batch-stabilize-pretend.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -12,7 +12,7 @@ import shutil import subprocess import sys -import bugz.bugzilla +from bugz.bugzilla import BugzillaProxy import portage.versions BUG_REGEX = re.compile("[Bb]ug #?(\d+)") @@ -42,10 +42,6 @@ def save_state(done_bugs): with open('batch-stabilize.state', 'w') as state_file: pickle.dump(done_bugs, state_file) -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, ...") @@ -68,10 +64,8 @@ if __name__ == "__main__": with open('batch-stabilize.state', 'r') as state_file: done_bugs = pickle.load(state_file) - url = 'https://bugs.gentoo.org' - print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = MyBugz(url) - bugzilla.auth() + url = 'https://bugs.gentoo.org/xmlrpc.cgi' + bugzilla = BugzillaProxy(url) with open(options.input_filename, "r") as input_file: stabilization_dict = {} @@ -150,5 +144,6 @@ if __name__ == "__main__": os.chdir(cvs_path) os.system("repoman full") sys.exit(1) + if os.path.exists('batch-stabilize.state'): os.remove('batch-stabilize.state') diff --git a/script/batch-stabilize.py b/script/batch-stabilize.py index 9bdfe8d..f86151f 100755 --- a/script/batch-stabilize.py +++ b/script/batch-stabilize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -12,7 +12,7 @@ import shutil import subprocess import sys -import bugz.bugzilla +from bugz.bugzilla import BugzillaProxy import portage.versions BUG_REGEX = re.compile("[Bb]ug #?(\d+)") @@ -42,10 +42,6 @@ def save_state(done_bugs): with open('batch-stabilize.state', 'w') as state_file: pickle.dump(done_bugs, state_file) -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, ...") @@ -68,10 +64,8 @@ if __name__ == "__main__": with open('batch-stabilize.state', 'r') as state_file: done_bugs = pickle.load(state_file) - url = 'https://bugs.gentoo.org' - print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = MyBugz(url) - bugzilla.auth() + url = 'https://bugs.gentoo.org/xmlrpc.cgi' + bugzilla = BugzillaProxy(url) with open(options.input_filename, "r") as input_file: stabilization_dict = {} @@ -150,42 +144,6 @@ if __name__ == "__main__": os.chdir(cvs_path) os.system("repoman full") sys.exit(1) - bug_xml = bugzilla.get(bug_id).find('bug') - has_my_arch = False - has_other_arches = False - for cc in bug_xml.findall('cc'): - body, domain = cc.text.split('@', 1) - if domain == 'gentoo.org' and body == options.arch: - has_my_arch = True - if domain == 'gentoo.org' and body in portage.archlist and body != options.arch: - has_other_arches=True - - if not has_my_arch: - print_and_log('Seems that bugzilla has already been updated.', log_file) - done_bugs.append(bug_id) - save_state(done_bugs) - continue - - print_and_log('Posting automated reply in bugzilla...', log_file) - # 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) - print_and_log('Successfully updated bug %d.' % bug_id, log_file) - else: - bugzilla.modify( - bug_id, - comment='%s stable. Last arch, closing' % options.arch, - remove_cc='%s@gentoo.org' % options.arch, - status='RESOLVED', - resolution='FIXED') - print_and_log('Succesfully updated bug %d and closed it.' % bug_id, log_file) - - done_bugs.append(bug_id) - save_state(done_bugs) - + if os.path.exists('batch-stabilize.state'): os.remove('batch-stabilize.state')