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, 30 Nov 2011 17:38:42
Message-Id: b41b45df8693af1b00b59f8ad64ce4d4e1815cbf.phajdan.jr@gentoo
1 commit: b41b45df8693af1b00b59f8ad64ce4d4e1815cbf
2 Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 30 17:37:53 2011 +0000
4 Commit: Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 30 17:37:53 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=b41b45df
7
8 Do not file bugs by default, and only stabilze latest version in ~arch.
9
10 ---
11 stabilization-candidates.py | 118 +++++++++++++++++++++++--------------------
12 1 files changed, 63 insertions(+), 55 deletions(-)
13
14 diff --git a/stabilization-candidates.py b/stabilization-candidates.py
15 index 55c3da1..8feee30 100755
16 --- a/stabilization-candidates.py
17 +++ b/stabilization-candidates.py
18 @@ -26,6 +26,7 @@ if __name__ == "__main__":
19 parser.add_option("-l", "--limit", dest="limit", type="int", default=-1, help="Limit of filed bugs. Default is no limit.")
20 parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
21 parser.add_option("--category", dest="category", help="Portage category filter (default is all categories)")
22 + 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.")
23
24 (options, args) = parser.parse_args()
25 if not options.arch:
26 @@ -92,69 +93,76 @@ if __name__ == "__main__":
27 candidates.append(cpv)
28 if not candidates:
29 continue
30 +
31 candidates.sort(key=portage.versions.cpv_sort_key())
32 candidates.reverse()
33 - best_candidate = None
34 +
35 + # Only consider the best version in ~arch for stabilization.
36 + # It's usually better tested, and often maintainers refuse
37 + # to stabilize anything else, e.g. bug #391607.
38 + best_candidate = candidates[0]
39 +
40 cvs_path = os.path.join(options.repo, cp)
41 - for candidate in candidates:
42 - ebuild_name = portage.versions.catsplit(candidate)[1] + ".ebuild"
43 - ebuild_path = os.path.join(cvs_path, ebuild_name)
44 - manifest_path = os.path.join(cvs_path, 'Manifest')
45 - original_contents = open(ebuild_path).read()
46 - manifest_contents = open(manifest_path).read()
47 - try:
48 - for arch in options.arch:
49 - subprocess.check_output(["ekeyword", arch, ebuild_name], cwd=cvs_path)
50 - subprocess.check_output(["repoman", "manifest"], cwd=cvs_path)
51 - subprocess.check_output(["repoman", "full"], cwd=cvs_path)
52 - except subprocess.CalledProcessError:
53 - continue
54 - finally:
55 - f = open(ebuild_path, "w")
56 - f.write(original_contents)
57 - f.close()
58 - f = open(manifest_path, "w")
59 - f.write(manifest_contents)
60 - f.close()
61 - best_candidate = candidate
62 - break
63 - if best_candidate:
64 - # Do not risk trying to stabilize a package with known bugs.
65 - bugs = bugzilla.search(cp, status=None)
66 - if bugs:
67 - continue
68 + ebuild_name = portage.versions.catsplit(best_candidate)[1] + ".ebuild"
69 + ebuild_path = os.path.join(cvs_path, ebuild_name)
70 + manifest_path = os.path.join(cvs_path, 'Manifest')
71 + original_contents = open(ebuild_path).read()
72 + manifest_contents = open(manifest_path).read()
73 + try:
74 + for arch in options.arch:
75 + subprocess.check_output(["ekeyword", arch, ebuild_name], cwd=cvs_path)
76 + subprocess.check_output(["repoman", "manifest"], cwd=cvs_path)
77 + subprocess.check_output(["repoman", "full"], cwd=cvs_path)
78 + except subprocess.CalledProcessError:
79 + continue
80 + finally:
81 + f = open(ebuild_path, "w")
82 + f.write(original_contents)
83 + f.close()
84 + f = open(manifest_path, "w")
85 + f.write(manifest_contents)
86 + f.close()
87
88 - # Protection against filing a stabilization bug twice.
89 - bugs = bugzilla.search(best_candidate)
90 - if bugs:
91 - continue
92 + # Do not risk trying to stabilize a package with known bugs.
93 + bugs = bugzilla.search(cp, status=None)
94 + if bugs:
95 + continue
96
97 - metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
98 - maintainer_split = metadata.format_maintainer_string().split(' ', 1)
99 - maintainer = maintainer_split[0]
100 - if len(maintainer_split) > 1:
101 - other_maintainers = maintainer_split[1].split(',')
102 - else:
103 - other_maintainers = []
104 - url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
105 - final_candidates.append((best_candidate, url, maintainer, other_maintainers))
106 + # Protection against filing a stabilization bug twice.
107 + bugs = bugzilla.search(best_candidate)
108 + if bugs:
109 + continue
110 +
111 + metadata = MetaDataXML(os.path.join(cvs_path, 'metadata.xml'), '/usr/portage/metadata/herds.xml')
112 + maintainer_split = metadata.format_maintainer_string().split(' ', 1)
113 + maintainer = maintainer_split[0]
114 + if len(maintainer_split) > 1:
115 + other_maintainers = maintainer_split[1].split(',')
116 + else:
117 + other_maintainers = []
118 + url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
119 + final_candidates.append((best_candidate, url, maintainer, other_maintainers))
120
121 if options.limit != -1:
122 final_candidates = random.sample(final_candidates, min(options.limit, len(final_candidates)))
123 for x in final_candidates:
124 best_candidate, url, maintainer, other_maintainers = x
125 - description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate +
126 - 'If so, please CC arches and add STABLEREQ keyword.\n\n' +
127 - 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch))
128 - bug_id = bugzilla.post('Gentoo Linux',
129 - 'Keywording and Stabilization',
130 - 'Please stabilize =%s' % best_candidate,
131 - description,
132 - url=url,
133 - assigned_to=maintainer,
134 - cc=other_maintainers,
135 - severity='enhancement')
136 - if bug_id == 0:
137 - print 'Submitting bug for %s failed. :-(' % best_candidate
138 +
139 + if options.file_bugs:
140 + description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate +
141 + 'If so, please CC arches and add STABLEREQ keyword.\n\n' +
142 + 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch))
143 + bug_id = bugzilla.post('Gentoo Linux',
144 + 'Keywording and Stabilization',
145 + 'Please stabilize =%s' % best_candidate,
146 + description,
147 + url=url,
148 + assigned_to=maintainer,
149 + cc=other_maintainers,
150 + severity='enhancement')
151 + if bug_id == 0:
152 + print 'Submitting bug for %s failed. :-(' % best_candidate
153 + else:
154 + print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate)
155 else:
156 - print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate)
157 + print (best_candidate, maintainer, other_maintainers)