Gentoo Archives: gentoo-commits

From: "Paweł Hajdan" <phajdan.jr@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/arch-tools:master commit in: /
Date: Wed, 23 Nov 2011 08:59:14
Message-Id: 5a195bce432416b7486ec481d7dbb241c80fc412.phajdan.jr@gentoo
1 commit: 5a195bce432416b7486ec481d7dbb241c80fc412
2 Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 23 08:57:03 2011 +0000
4 Commit: Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 23 08:57:03 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=5a195bce
7
8 Automatically file stabilization bugs.
9
10 ---
11 stabilization-candidates.py | 43 ++++++++++++++++++++++++++++++++++++++-----
12 1 files changed, 38 insertions(+), 5 deletions(-)
13
14 diff --git a/stabilization-candidates.py b/stabilization-candidates.py
15 index 5d0c3f8..696ad9c 100755
16 --- a/stabilization-candidates.py
17 +++ b/stabilization-candidates.py
18 @@ -5,8 +5,10 @@
19 import datetime
20 import optparse
21 import os.path
22 +import random
23 import re
24 import subprocess
25 +import urllib
26
27 import bugz.bugzilla
28 from portage.package.ebuild.getmaskingstatus import getmaskingstatus
29 @@ -21,6 +23,7 @@ if __name__ == "__main__":
30 parser = optparse.OptionParser()
31 parser.add_option("--arch", dest="arch", action="append", help="Gentoo arch to use, e.g. x86, amd64, ... Can be passed multiple times.")
32 parser.add_option("--days", dest="days", type=int, default=30, help="Number of days in the tree after stabilization is possible.")
33 + parser.add_option("-l", "--limit", dest="limit", type="int", default=-1, help="Limit of filed bugs. Default is no limit.")
34 parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
35 parser.add_option("--category", dest="category", help="Portage category filter (default is all categories)")
36
37 @@ -37,6 +40,7 @@ if __name__ == "__main__":
38 bugzilla = MyBugz(url)
39 bugzilla.auth()
40
41 + final_candidates = []
42 now = datetime.datetime.now()
43 for cp in portage.portdb.cp_all():
44 if options.category and not cp.startswith(options.category + "/"):
45 @@ -44,6 +48,7 @@ if __name__ == "__main__":
46 best_stable = portage.versions.best(portage.portdb.match(cp))
47 if not best_stable:
48 continue
49 + print 'Working on %s...' % cp
50 candidates = []
51 for cpv in portage.portdb.cp_list(cp):
52 # Only consider higher versions than best stable.
53 @@ -58,6 +63,12 @@ if __name__ == "__main__":
54 break
55 if is_unstable:
56 continue
57 +
58 + # Eliminate 'live' packages. Obviously have some false positives,
59 + # but it'd be much worse to miss something. There are variations
60 + # like -r9999 or .9999 in the tree.
61 + if '99' in cpv:
62 + continue
63
64 # Eliminate hard masked packages among others.
65 if getmaskingstatus(cpv) not in [[u'~%s keyword' % arch] for arch in options.arch]:
66 @@ -77,7 +88,6 @@ if __name__ == "__main__":
67 if not candidates:
68 continue
69 candidates.sort(key=portage.versions.cpv_sort_key())
70 - print '\t\tWorking on %s. Candidates: %s' % (cp, ', '.join(candidates))
71 candidates.reverse()
72 best_candidate = None
73 cvs_path = os.path.join(options.repo, cp)
74 @@ -115,8 +125,31 @@ if __name__ == "__main__":
75 continue
76
77 metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
78 + maintainer_split = metadata.format_maintainer_string().split(' ', 1)
79 + maintainer = maintainer_split[0]
80 + if len(maintainer_split) > 1:
81 + other_maintainers = maintainer_split[1].split(',')
82 + else:
83 + other_maintainers = []
84 + url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
85 + final_candidates.append((best_candidate, url, maintainer, other_maintainers))
86
87 - # Spam protection (strip @ and domain name).
88 - maintainer_string = re.sub('@[^\s]*', '', metadata.format_maintainer_string())
89 -
90 - print (cp, best_stable, best_candidate, maintainer_string)
91 + if options.limit != -1:
92 + final_candidates = random.sample(final_candidates, min(options.limit, len(final_candidates)))
93 + for x in final_candidates:
94 + best_candidate, url, maintainer, other_maintainers = x
95 + description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate +
96 + 'If so, please CC arches and add STABLEREQ keyword.\n\n' +
97 + 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch))
98 + bug_id = bugzilla.post('Gentoo Linux',
99 + 'Keywording and Stabilization',
100 + 'Please stabilize =%s' % best_candidate,
101 + description,
102 + url=url,
103 + assigned_to=maintainer,
104 + cc=other_maintainers,
105 + severity='enhancement')
106 + if bug_id == 0:
107 + print 'Submitting bug for %s failed. :-(' % best_candidate
108 + else:
109 + print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate)