diff options
author | 2011-11-30 18:37:53 +0100 | |
---|---|---|
committer | 2011-11-30 18:37:53 +0100 | |
commit | b41b45df8693af1b00b59f8ad64ce4d4e1815cbf (patch) | |
tree | c2a4a9d4e669031ea59ff86a4db0604ee53c008f | |
parent | Ignore ruby for now. (diff) | |
download | arch-tools-b41b45df8693af1b00b59f8ad64ce4d4e1815cbf.tar.gz arch-tools-b41b45df8693af1b00b59f8ad64ce4d4e1815cbf.tar.bz2 arch-tools-b41b45df8693af1b00b59f8ad64ce4d4e1815cbf.zip |
Do not file bugs by default, and only stabilze latest version in ~arch.
-rwxr-xr-x | stabilization-candidates.py | 118 |
1 files changed, 63 insertions, 55 deletions
diff --git a/stabilization-candidates.py b/stabilization-candidates.py index 55c3da1..8feee30 100755 --- a/stabilization-candidates.py +++ b/stabilization-candidates.py @@ -26,6 +26,7 @@ if __name__ == "__main__": parser.add_option("-l", "--limit", dest="limit", type="int", default=-1, help="Limit of filed bugs. Default is no limit.") 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.") (options, args) = parser.parse_args() if not options.arch: @@ -92,69 +93,76 @@ if __name__ == "__main__": candidates.append(cpv) if not candidates: continue + candidates.sort(key=portage.versions.cpv_sort_key()) candidates.reverse() - best_candidate = None + + # Only consider the best version in ~arch for stabilization. + # It's usually better tested, and often maintainers refuse + # to stabilize anything else, e.g. bug #391607. + best_candidate = candidates[0] + cvs_path = os.path.join(options.repo, cp) - for candidate in candidates: - ebuild_name = portage.versions.catsplit(candidate)[1] + ".ebuild" - ebuild_path = os.path.join(cvs_path, ebuild_name) - manifest_path = os.path.join(cvs_path, 'Manifest') - original_contents = open(ebuild_path).read() - manifest_contents = open(manifest_path).read() - try: - for arch in options.arch: - subprocess.check_output(["ekeyword", arch, ebuild_name], cwd=cvs_path) - subprocess.check_output(["repoman", "manifest"], cwd=cvs_path) - subprocess.check_output(["repoman", "full"], cwd=cvs_path) - except subprocess.CalledProcessError: - continue - finally: - f = open(ebuild_path, "w") - f.write(original_contents) - f.close() - f = open(manifest_path, "w") - f.write(manifest_contents) - f.close() - best_candidate = candidate - break - if best_candidate: - # Do not risk trying to stabilize a package with known bugs. - bugs = bugzilla.search(cp, status=None) - if bugs: - continue + 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') + original_contents = open(ebuild_path).read() + manifest_contents = open(manifest_path).read() + try: + for arch in options.arch: + subprocess.check_output(["ekeyword", arch, ebuild_name], cwd=cvs_path) + subprocess.check_output(["repoman", "manifest"], cwd=cvs_path) + subprocess.check_output(["repoman", "full"], cwd=cvs_path) + except subprocess.CalledProcessError: + continue + finally: + f = open(ebuild_path, "w") + f.write(original_contents) + f.close() + f = open(manifest_path, "w") + f.write(manifest_contents) + f.close() - # Protection against filing a stabilization bug twice. - bugs = bugzilla.search(best_candidate) - if bugs: - continue + # Do not risk trying to stabilize a package with known bugs. + bugs = bugzilla.search(cp, status=None) + if bugs: + continue - 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) - final_candidates.append((best_candidate, url, maintainer, other_maintainers)) + # Protection against filing a stabilization bug twice. + bugs = bugzilla.search(best_candidate) + if bugs: + continue + + 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) + final_candidates.append((best_candidate, url, maintainer, other_maintainers)) if options.limit != -1: final_candidates = random.sample(final_candidates, min(options.limit, len(final_candidates))) for x in final_candidates: best_candidate, url, maintainer, other_maintainers = x - description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate + - 'If so, please CC arches and add STABLEREQ keyword.\n\n' + - 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch)) - bug_id = bugzilla.post('Gentoo Linux', - 'Keywording and Stabilization', - 'Please stabilize =%s' % best_candidate, - description, - url=url, - assigned_to=maintainer, - cc=other_maintainers, - severity='enhancement') - if bug_id == 0: - print 'Submitting bug for %s failed. :-(' % best_candidate + + if options.file_bugs: + description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate + + 'If so, please CC arches and add STABLEREQ keyword.\n\n' + + 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch)) + bug_id = bugzilla.post('Gentoo Linux', + 'Keywording and Stabilization', + 'Please stabilize =%s' % best_candidate, + description, + url=url, + assigned_to=maintainer, + cc=other_maintainers, + severity='enhancement') + if bug_id == 0: + print 'Submitting bug for %s failed. :-(' % best_candidate + else: + print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate) else: - print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate) + print (best_candidate, maintainer, other_maintainers) |