From: "Paweł Hajdan" <phajdan.jr@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/arch-tools:master commit in: /
Date: Wed, 25 May 2011 10:32:21 +0000 (UTC) [thread overview]
Message-ID: <e7192b0daf2c87a6e8be4ecda48e66cc5f8f34ac.phajdan.jr@gentoo> (raw)
commit: e7192b0daf2c87a6e8be4ecda48e66cc5f8f34ac
Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 10:32:03 2011 +0000
Commit: Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org>
CommitDate: Wed May 25 10:32:03 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=e7192b0d
Write stabilization list to a file.
---
bugzilla-viewer.py | 129 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 93 insertions(+), 36 deletions(-)
diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py
index 72ae93e..b62eaf4 100755
--- a/bugzilla-viewer.py
+++ b/bugzilla-viewer.py
@@ -27,6 +27,16 @@ class Bug:
self.__status = xml.find("bug_status").text
self.__depends_on = [int(dep.text) for dep in xml.findall("dependson")]
self.__comments = [c.find("who").text + "\n" + c.find("thetext").text for c in xml.findall("long_desc")]
+ self.__cpvs_detected = False
+ self.__cpvs = []
+
+ 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)
+ self.__cpvs_detected = True
def id_number(self):
return self.__id
@@ -42,15 +52,41 @@ class Bug:
def comments(self):
return self.__comments
+
+ def cpvs(self):
+ assert(self.__cpvs_detected)
+ return self.__cpvs
+
+class BugQueue:
+ def __init__(self):
+ self.__bug_list = []
+ self.__bug_set = set()
+
+ def add_bug(self, bug):
+ if self.has_bug(bug):
+ return
+ self.__bug_list.append(bug)
+ self.__bug_set.add(bug.id_number())
+
+ def has_bug(self, bug):
+ return bug.id_number() in self.__bug_set
+
+ def generate_stabilization_list(self):
+ result = []
+ for bug in self.__bug_list:
+ result.append("# Bug %d: %s" % (bug.id_number(), bug.summary()))
+ for cpv in bug.cpvs():
+ result.append("=" + cpv)
+ return "\n".join(result)
# Main class (called with curses.wrapper later).
class MainWindow:
- def __init__(self, screen, bugs, bugs_dict, packages_dict, related_bugs, repoman_dict):
+ def __init__(self, screen, bugs, bugs_dict, related_bugs, repoman_dict, bug_queue):
self.bugs = bugs
self.bugs_dict = bugs_dict
- self.packages_dict = packages_dict
self.related_bugs = related_bugs
self.repoman_dict = repoman_dict
+ self.bug_queue = bug_queue
curses.curs_set(0)
self.screen = screen
@@ -70,6 +106,8 @@ class MainWindow:
self.scroll_contents_pad(-1)
elif c == curses.KEY_RESIZE:
self.init_screen()
+ elif c == ord("a"):
+ self.add_bug_to_queue()
c = self.screen.getch()
@@ -97,7 +135,7 @@ class MainWindow:
for i in range(len(self.bugs)):
self.bugs_pad.addstr(i, 0,
- " %d %s" % (self.bugs[i].id_number(), self.bugs[i].summary()))
+ " %d %s" % (self.bugs[i].id_number(), self.bugs[i].summary()))
def scroll_bugs_pad(self, amount):
height = len(self.bugs)
@@ -115,7 +153,9 @@ class MainWindow:
def refresh_bugs_pad(self):
(height, width) = self.bugs_pad.getmaxyx()
for i in range(height):
- self.bugs_pad.addch(i, 0, " ")
+ self.bugs_pad.addstr(i, 0, " ")
+ if self.bug_queue.has_bug(self.bugs[i]):
+ self.bugs_pad.addch(i, 2, "+")
self.bugs_pad.addch(self.bugs_pad_pos, 0, "*")
pos = min(height - self.height + 2, max(0, self.bugs_pad_pos - (self.height / 2)))
self.bugs_pad.refresh(
@@ -132,11 +172,12 @@ class MainWindow:
output += textwrap.wrap(bug.summary(), width=width-2)
output.append("-" * (width - 2))
- cpvs = self.packages_dict[bug.id_number()]
+ cpvs = bug.cpvs()
if cpvs:
output += textwrap.wrap("Found package cpvs:", width=width-2)
for cpv in cpvs:
output += textwrap.wrap(cpv, width=width-2)
+ output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=width-2)
output.append("-" * (width - 2))
deps = [self.bugs_dict[dep_id] for dep_id in bug.depends_on()]
@@ -199,10 +240,21 @@ class MainWindow:
1, self.width / 3 + 1,
self.height - 2, self.width - 2)
self.screen.refresh()
+
+ def add_bug_to_queue(self):
+ bug = self.bugs[self.bugs_pad_pos]
+
+ # For now we only support auto-detected CPVs.
+ if not bug.cpvs():
+ return
+
+ self.bug_queue.add_bug(bug)
+ self.refresh_bugs_pad()
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
+ 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")
@@ -212,6 +264,8 @@ if __name__ == "__main__":
if args:
parser.error("unrecognized command-line args")
+ bug_queue = BugQueue()
+
bugzilla = bugz.bugzilla.Bugz('http://bugs.gentoo.org', skip_auth=True)
print "Searching for arch bugs..."
@@ -221,43 +275,40 @@ if __name__ == "__main__":
dep_bug_ids = []
bugs_dict = {}
- packages_dict = {}
related_bugs = {}
repoman_dict = {}
for bug in bugs:
print "Processing bug %d: %s" % (bug.id_number(), bug.summary())
bugs_dict[bug.id_number()] = bug
- packages_dict[bug.id_number()] = []
related_bugs[bug.id_number()] = []
repoman_dict[bug.id_number()] = ""
- for cpv_candidate in CPV_REGEX.findall(bug.summary()):
- if portage.db["/"]["porttree"].dbapi.cpv_exists(cpv_candidate):
- packages_dict[bug.id_number()].append(cpv_candidate)
- pv = portage.versions.cpv_getkey(cpv_candidate)
- if options.verbose:
- related_bugs[bug.id_number()] += bugzilla.search(pv, status=None)
-
- if options.repo:
- cvs_path = os.path.join(options.repo, pv)
- ebuild_name = portage.versions.catsplit(cpv_candidate)[1] + ".ebuild"
- ebuild_path = os.path.join(cvs_path, ebuild_name)
- manifest_path = os.path.join(cvs_path, 'Manifest')
- if os.path.exists(ebuild_path):
- original_contents = open(ebuild_path).read()
- manifest_contents = open(manifest_path).read()
- try:
- output = repoman_dict[bug.id_number()]
- output += subprocess.Popen(["ekeyword", options.arch, ebuild_name], cwd=cvs_path, stdout=subprocess.PIPE).communicate()[0]
- subprocess.check_call(["repoman", "manifest"], cwd=cvs_path)
- output += subprocess.Popen(["repoman", "full"], cwd=cvs_path, stdout=subprocess.PIPE).communicate()[0]
- repoman_dict[bug.id_number()] = output
- finally:
- f = open(ebuild_path, "w")
- f.write(original_contents)
- f.close()
- f = open(manifest_path, "w")
- f.write(manifest_contents)
- f.close()
+ bug.detect_cpvs()
+ for cpv in bug.cpvs():
+ pv = portage.versions.cpv_getkey(cpv)
+ if options.verbose:
+ related_bugs[bug.id_number()] += bugzilla.search(pv, status=None)
+
+ if options.repo:
+ cvs_path = os.path.join(options.repo, pv)
+ ebuild_name = portage.versions.catsplit(cpv_candidate)[1] + ".ebuild"
+ ebuild_path = os.path.join(cvs_path, ebuild_name)
+ manifest_path = os.path.join(cvs_path, 'Manifest')
+ if os.path.exists(ebuild_path):
+ original_contents = open(ebuild_path).read()
+ manifest_contents = open(manifest_path).read()
+ try:
+ output = repoman_dict[bug.id_number()]
+ output += subprocess.Popen(["ekeyword", options.arch, ebuild_name], cwd=cvs_path, stdout=subprocess.PIPE).communicate()[0]
+ subprocess.check_call(["repoman", "manifest"], cwd=cvs_path)
+ output += subprocess.Popen(["repoman", "full"], cwd=cvs_path, stdout=subprocess.PIPE).communicate()[0]
+ repoman_dict[bug.id_number()] = output
+ finally:
+ f = open(ebuild_path, "w")
+ f.write(original_contents)
+ f.close()
+ f = open(manifest_path, "w")
+ f.write(manifest_contents)
+ f.close()
dep_bug_ids += bug.depends_on()
dep_bug_ids = list(set(dep_bug_ids))
@@ -266,7 +317,13 @@ if __name__ == "__main__":
bugs_dict[bug.id_number()] = bug
try:
- curses.wrapper(MainWindow, bugs=bugs, bugs_dict=bugs_dict, packages_dict=packages_dict, related_bugs=related_bugs, repoman_dict=repoman_dict)
+ curses.wrapper(MainWindow, bugs=bugs, bugs_dict=bugs_dict, related_bugs=related_bugs, repoman_dict=repoman_dict, bug_queue=bug_queue)
except TermTooSmall:
print "Your terminal window is too small, please try to enlarge it"
sys.exit(1)
+
+ stabilization_list = bug_queue.generate_stabilization_list()
+ if stabilization_list:
+ with open(options.output_filename, "w") as f:
+ f.write(stabilization_list)
+ print "Writing stabilization list to %s" % options.output_filename
next reply other threads:[~2011-05-25 10:32 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 10:32 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-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-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=e7192b0daf2c87a6e8be4ecda48e66cc5f8f34ac.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