public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Agostino Sarubbo" <ago@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/ago:master commit in: script/
Date: Wed, 13 Aug 2014 14:49:07 +0000 (UTC)	[thread overview]
Message-ID: <1407941338.2fb3bebf42dd93236157c8d26afc91b932ef24c2.ago@gentoo> (raw)

commit:     2fb3bebf42dd93236157c8d26afc91b932ef24c2
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 13 14:48:58 2014 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> 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')


             reply	other threads:[~2014-08-13 14:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 14:49 Agostino Sarubbo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-13 14:45 [gentoo-commits] dev/ago:master commit in: script/ Agostino Sarubbo
2013-05-05  9:38 Agostino Sarubbo
2013-03-24 17:52 Agostino Sarubbo
2013-01-14 10:20 Agostino Sarubbo
2013-01-14  9:46 Agostino Sarubbo
2013-01-01 14:17 Agostino Sarubbo
2012-12-30 17:16 Agostino Sarubbo
2012-12-30 17:13 Agostino Sarubbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407941338.2fb3bebf42dd93236157c8d26afc91b932ef24c2.ago@gentoo \
    --to=ago@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox