public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Paweł Hajdan" <phajdan.jr@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/arch-tools:master commit in: /
Date: Thu, 28 Feb 2013 04:50:44 +0000 (UTC)	[thread overview]
Message-ID: <1362027006.3c20e14c939bf0efa495dead6243f8035d699b86.phajdan.jr@gentoo> (raw)

commit:     3c20e14c939bf0efa495dead6243f8035d699b86
Author:     Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 28 04:50:06 2013 +0000
Commit:     Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org>
CommitDate: Thu Feb 28 04:50:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=3c20e14c

Stabilization candidates: split out the bug filing script.

---
 file-stabilization-bugs.py  |  103 +++++++++++++++++++++++++++++++++++++++++++
 stabilization-candidates.py |   66 +++++++++++++---------------
 2 files changed, 134 insertions(+), 35 deletions(-)

diff --git a/file-stabilization-bugs.py b/file-stabilization-bugs.py
new file mode 100755
index 0000000..4963937
--- /dev/null
+++ b/file-stabilization-bugs.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import glob
+import itertools
+import optparse
+import os
+import pickle
+import re
+import shutil
+import subprocess
+import sys
+import urllib
+import xmlrpclib
+
+from bugz.bugzilla import BugzillaProxy
+from common import login
+import portage.versions
+from portage.xml.metadata import MetaDataXML
+
+def save_state(done_cpvs):
+	with open('file-stabilization-bugs.state', 'w') as state_file:
+		pickle.dump(done_cpvs, state_file)
+
+if __name__ == "__main__":
+	exit_code = 0
+
+	parser = optparse.OptionParser()
+	parser.add_option("-i", "--input", dest="input_filename", default="stabilization-candidates.txt", help="Input filename [default=%default]")
+	parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
+
+	(options, args) = parser.parse_args()
+	if not options.input_filename:
+		parser.error("--input option is required")
+	if not options.repo:
+		parser.error("--repo option is required")
+	if args:
+		parser.error("unrecognized command-line args")
+
+	done_cpvs = []
+	if os.path.exists('file-stabilization-bugs.state'):
+		with open('file-stabilization-bugs.state', 'r') as state_file:
+			done_cpvs = pickle.load(state_file)
+
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	print 'You will be prompted for your Gentoo Bugzilla username and password (%s).' % url
+	bugzilla = BugzillaProxy(url)
+	login(bugzilla)
+	
+	with open(options.input_filename, "r") as input_file:
+		for line in input_file:
+			line = line.strip()
+
+			# Skip empty/whitespace/comment lines.
+			if not line or line.startswith("#"):
+				continue
+
+			cpv = line
+			if cpv in done_cpvs:
+				print 'Skipping %s because it\'s marked as done' % cpv
+				continue
+
+			cp = portage.versions.pkgsplit(cpv)[0]
+
+			cvs_path = os.path.join(options.repo, cp)
+			metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
+			maintainer_split = metadata.format_maintainer_string().split(' ', 1)
+			maintainer = maintainer_split[0]
+			if len(maintainer_split) > 1:
+				other_maintainers = maintainer_split[1].split(',')
+			else:
+				other_maintainers = []
+
+			description = ('Is it OK to stabilize =%s ?\n\n' % cpv +
+				       'If so, please CC all arches which have stable keywords\n\n' +
+				       'for older versions of this package and add STABLEREQ keyword\n\n' +
+				       'to the bug.')
+			url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
+			params = {}
+			params['product'] = 'Gentoo Linux'
+			params['version'] = 'unspecified'
+			params['component'] = 'Keywording and Stabilization'
+			params['summary'] = 'Please stabilize =%s' % cpv
+			params['description'] = description
+			params['url'] = url
+			params['assigned_to'] = maintainer
+			params['cc'] = other_maintainers
+			params['severity'] = 'enhancement'
+			try:
+				bug_id = bugzilla.Bug.create(params)['id']
+				print 'Submitted bug #%d for %s. ;-)' % (bug_id, cpv)
+				done_cpvs += cpv
+				save_state(done_cpvs)
+			except xmlrpclib.Fault, f:
+				exit_code = 1
+				print f
+				print 'Failed to submit bug for %s. :-(' % cpv
+	
+	if exit_code == 0 and os.path.exists('file-stabilization-bugs.state'):
+		os.remove('file-stabilization-bugs.state')
+	
+	sys.exit(exit_code)

diff --git a/stabilization-candidates.py b/stabilization-candidates.py
index 20dae63..615e3b6 100755
--- a/stabilization-candidates.py
+++ b/stabilization-candidates.py
@@ -24,8 +24,8 @@ if __name__ == "__main__":
 	parser.add_option("--days", dest="days", type=int, default=30, help="Number of days in the tree after stabilization is possible.")
 	parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
 	parser.add_option("--category", dest="category", help="Portage category filter (default is all categories)")
-	parser.add_option("--file-bugs", dest="file_bugs", action="store_true", default=False, help="File stabilization bugs for detected candidates. Otherwise (default) the candidates are just displayed.")
 	parser.add_option("--exclude", dest="exclude", default=".*(kde-base|sci|lisp|perl-core|virtual|gnome|ruby|x11|mono|dotnet|games|xfce).*", help="Regular expression for excluded packages.")
+	parser.add_option("-o", "--output", dest="output_filename", default="stabilization-candidates.txt", help="Output filename for generated stabilization candidates list.")
 
 	(options, args) = parser.parse_args()
 	if not options.arch:
@@ -46,8 +46,33 @@ if __name__ == "__main__":
 		if options.category and not cp.startswith(options.category + "/"):
 			continue
 
-		if options.exclude and re.match(options.exclude, cp):
+		cvs_path = os.path.join(options.repo, cp)
+		try:
+			metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
+		except IOError:
 			continue
+		maintainer_split = metadata.format_maintainer_string().split(' ', 1)
+		maintainer = maintainer_split[0]
+		if len(maintainer_split) > 1:
+			other_maintainers = maintainer_split[1].split(',')
+		else:
+			other_maintainers = []
+
+		if options.exclude:
+			if re.match(options.exclude, cp):
+				continue
+
+			if re.match(options.exclude, maintainer):
+				continue
+
+			skip = False
+			for m in other_maintainers:
+				if re.match(options.exclude, m):
+					skip = True
+					break
+			if skip:
+				continue
+
 
 		best_stable = portage.versions.best(portage.portdb.match(cp))
 		if not best_stable:
@@ -129,7 +154,6 @@ if __name__ == "__main__":
 			print 'version has bugs'
 			continue
 
-		cvs_path = os.path.join(options.repo, cp)
 		ebuild_name = portage.versions.catsplit(best_candidate)[1] + ".ebuild"
 		ebuild_path = os.path.join(cvs_path, ebuild_name)
 		manifest_path = os.path.join(cvs_path, 'Manifest')
@@ -155,35 +179,7 @@ if __name__ == "__main__":
 			f.write(manifest_contents)
 			f.close()
 
-		metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
-		maintainer_split = metadata.format_maintainer_string().split(' ', 1)
-		maintainer = maintainer_split[0]
-		if len(maintainer_split) > 1:
-			other_maintainers = maintainer_split[1].split(',')
-		else:
-			other_maintainers = []
-		url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
-
-		if options.file_bugs:
-			description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate +
-				       'If so, please CC all arches which have stable keywords\n\n' +
-				       'for older versions of this package and add STABLEREQ keyword\n\n' +
-				       'to the bug.')
-			params = {}
-			params['product'] = 'Gentoo Linux'
-			params['version'] = 'unspecified'
-			params['component'] = 'Keywording and Stabilization'
-			params['summary'] = 'Please stabilize =%s' % best_candidate
-			params['description'] = description
-			params['url'] = url
-			params['assigned_to'] = maintainer
-			params['cc'] = other_maintainers
-			params['severity'] = 'enhancement'
-			try:
-				bug_id = bugzilla.Bug.create(params)['id']
-				print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate)
-			except xmlrpclib.Fault, f:
-				print f
-				print 'Failed to submit bug for %s. :-(' % best_candidate
-		else:
-			print (best_candidate, maintainer, other_maintainers)
+		with open(options.output_filename, 'a') as f:
+			f.write('# %s %s\n' % (maintainer, ', '.join(other_maintainers)))
+			f.write('%s\n' % best_candidate)
+		print (best_candidate, maintainer, other_maintainers)


             reply	other threads:[~2013-02-28  4:50 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28  4:50 Paweł Hajdan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-07-10 20:29 [gentoo-commits] proj/arch-tools:master commit in: / Paweł Hajdan
2017-07-09 14:42 Paweł Hajdan
2015-01-05 14:41 Paweł Hajdan
2015-01-05 14:41 Paweł Hajdan
2015-01-05 14:41 Paweł Hajdan
2014-06-14  9:47 Paweł Hajdan
2014-04-07 12:40 Samuli Suominen
2014-02-12  7:06 Paweł Hajdan
2013-06-22 15:05 Paweł Hajdan
2013-06-22 14:57 Paweł Hajdan
2013-05-19 23:35 Paweł Hajdan
2013-03-11 21:56 Paweł Hajdan
2013-02-28  4:50 Paweł Hajdan
2012-10-16 16:54 Paweł Hajdan
2012-10-16 16:54 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:03 Paweł Hajdan
2012-10-08 16:02 [gentoo-commits] proj/arch-tools:new-pybugz " Paweł Hajdan
2012-10-08 16:03 ` [gentoo-commits] proj/arch-tools:master " Paweł Hajdan
2012-08-01 11:08 [gentoo-commits] proj/arch-tools:new-pybugz " Paweł Hajdan
2012-10-08 16:03 ` [gentoo-commits] proj/arch-tools:master " Paweł Hajdan
2012-08-01  7:28 [gentoo-commits] proj/arch-tools:new-pybugz " Paweł Hajdan
2012-10-08 16:03 ` [gentoo-commits] proj/arch-tools:master " Paweł Hajdan
2012-06-04  9:18 [gentoo-commits] proj/arch-tools:new-pybugz " Paweł Hajdan
2012-10-08 16:03 ` [gentoo-commits] proj/arch-tools:master " Paweł Hajdan
2012-03-27 15:26 Paweł Hajdan
2012-03-09 11:49 Paweł Hajdan
2012-03-09 11:49 Paweł Hajdan
2012-02-02 16:48 Paweł Hajdan
2012-01-27 14:55 Paweł Hajdan
2012-01-21 17:05 Paweł Hajdan
2011-12-14  7:23 Paweł Hajdan
2011-12-06 11:14 Paweł Hajdan
2011-12-01 18:56 Paweł Hajdan
2011-12-01 18:47 Paweł Hajdan
2011-12-01 18:47 Paweł Hajdan
2011-11-30 17:38 Paweł Hajdan
2011-11-23  8:59 Paweł Hajdan
2011-11-23  8:59 Paweł Hajdan
2011-11-21  8:34 Paweł Hajdan
2011-11-03 11:00 Paweł Hajdan
2011-10-22  8:18 Paweł Hajdan
2011-10-21 15:15 Paweł Hajdan
2011-10-18 14:05 Paweł Hajdan
2011-10-16  3:51 Paweł Hajdan
2011-10-13 21:59 Paweł Hajdan
2011-10-04 21:46 Paweł Hajdan
2011-09-19  3:09 Paweł Hajdan
2011-08-07  3:26 Paweł Hajdan
2011-06-05 16:16 Paweł Hajdan
2011-06-02 15:41 Paweł Hajdan
2011-06-02 15:38 Paweł Hajdan
2011-05-25 19:51 Paweł Hajdan
2011-05-25 10:32 Paweł Hajdan
2011-05-22 15:31 Paweł Hajdan
2011-05-22 15:16 Paweł Hajdan
2011-05-22 13:36 Paweł Hajdan

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=1362027006.3c20e14c939bf0efa495dead6243f8035d699b86.phajdan.jr@gentoo \
    --to=phajdan.jr@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