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: Sat, 22 Oct 2011 08:18:28 +0000 (UTC)	[thread overview]
Message-ID: <ec0907549e7827f7b32988dff21eaee40b7e45ab.phajdan.jr@gentoo> (raw)

commit:     ec0907549e7827f7b32988dff21eaee40b7e45ab
Author:     Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 22 08:17:12 2011 +0000
Commit:     Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org>
CommitDate: Sat Oct 22 08:17:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=ec090754

Improvements for the bugzilla viewer:

- do brace expansion on the bug summary
- make sure every entry for package.keywords ends with a newline
- add an option to query only for security bugs

---
 bugzilla-viewer.py |   49 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py
index c45530a..48b253e 100755
--- a/bugzilla-viewer.py
+++ b/bugzilla-viewer.py
@@ -17,6 +17,31 @@ import portage.versions
 
 CPV_REGEX = re.compile("[A-Za-z0-9+_.-]+/[A-Za-z0-9+_-]+-[0-9]+(?:\.[0-9]+)*[a-z0-9_]*(?:-r[0-9]+)?")
 
+# Snippet from http://bugs.python.org/issue9584
+def expand_braces(orig):
+	r = r'.*(\{.+?[^\\]\})'
+	p = re.compile(r)
+
+	s = orig[:]
+	res = list()
+
+	m = p.search(s)
+	if m is not None:
+		sub = m.group(1)
+		open_brace = s.find(sub)
+		close_brace = open_brace + len(sub) - 1
+		if ',' in sub:
+			for pat in sub.strip('{}').split(','):
+				res.extend(expand_braces(s[:open_brace] + pat + s[close_brace+1:]))
+
+		else:
+			res.extend(expand_braces(s[:open_brace] + sub.replace('}', '\\}') + s[close_brace+1:]))
+
+	else:
+		res.append(s.replace('\\}', '}'))
+
+	return list(set(res))
+
 def unicode_sanitize(text):
 	"""Converts a possibly unicode text to a regular string."""
 	if type(text) == unicode:
@@ -48,9 +73,11 @@ class Bug:
 	def detect_cpvs(self):
 		if self.__cpvs_detected:
 			return
-		for cpv_candidate in CPV_REGEX.findall(self.summary()):
-			if portage.db["/"]["porttree"].dbapi.cpv_exists(cpv_candidate):
-				self.__cpvs.append(cpv_candidate)
+		for cpv_string in list(set([self.summary()] + expand_braces(self.summary()))):
+			for cpv_candidate in CPV_REGEX.findall(cpv_string):
+				if portage.db["/"]["porttree"].dbapi.cpv_exists(cpv_candidate):
+					self.__cpvs.append(cpv_candidate)
+		self.__cpvs = list(set(self.__cpvs))
 		self.__cpvs_detected = True
 	
 	def id_number(self):
@@ -89,10 +116,10 @@ class BugQueue:
 	def generate_stabilization_list(self):
 		result = []
 		for bug in self.__bug_list:
-			result.append("# Bug %d: %s" % (bug.id_number(), bug.summary()))
+			result.append("# Bug %d: %s\n" % (bug.id_number(), bug.summary()))
 			for cpv in bug.cpvs():
-				result.append("=" + cpv)
-		return "\n".join(result)
+				result.append("=" + cpv + "\n")
+		return ''.join(result)
 
 # Main class (called with curses.wrapper later).
 class MainWindow:
@@ -273,6 +300,7 @@ if __name__ == "__main__":
 	parser.add_option("-o", "--output", dest="output_filename", default="package.keywords", help="Output filename for generated package.keywords file [default=%default]")
 	parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
 	parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False, help="Include more output, e.g. related bugs")
+	parser.add_option("--security", dest="security", action="store_true", default=False, help="Restrict search to security bugs.")
 
 	(options, args) = parser.parse_args()
 	if not options.arch:
@@ -285,7 +313,14 @@ if __name__ == "__main__":
 	bugzilla = bugz.bugzilla.Bugz('http://bugs.gentoo.org', skip_auth=True)
 
 	print "Searching for arch bugs..."
-	raw_bugs = bugzilla.search("", cc="%s@gentoo.org" % options.arch, keywords="STABLEREQ", status=None)
+	criteria = {
+		'cc': '%s@gentoo.org' % options.arch,
+		'keywords': 'STABLEREQ',
+		'status': None
+	}
+	if options.security:
+		criteria['assigned_to'] = 'security@gentoo.org'
+	raw_bugs = bugzilla.search("", **criteria)
 	bugs = [Bug(xml) for xml in bugzilla.get([bug['bugid'] for bug in raw_bugs]).findall("bug")]
 
 	if not bugs:



             reply	other threads:[~2011-10-22  8:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-22  8:18 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
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-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=ec0907549e7827f7b32988dff21eaee40b7e45ab.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