summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-12-14 08:23:10 +0100
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-12-14 08:23:10 +0100
commit05c2a91bc08d694c8d004126e2b99a610a67759b (patch)
tree0158f77eb1a11150ed1ffea9949ffc61b3de7000
parentWhen repoman manifest fails, do not crash entire script. (diff)
downloadarch-tools-05c2a91bc08d694c8d004126e2b99a610a67759b.tar.gz
arch-tools-05c2a91bc08d694c8d004126e2b99a610a67759b.tar.bz2
arch-tools-05c2a91bc08d694c8d004126e2b99a610a67759b.zip
Properly handle simultaneous stabilization of multiple packages
in a single bug.
-rwxr-xr-xbugzilla-viewer.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py
index ce0b2eb..e3cbcac 100755
--- a/bugzilla-viewer.py
+++ b/bugzilla-viewer.py
@@ -342,29 +342,33 @@ if __name__ == "__main__":
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)[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()]
+ if options.repo:
+ to_restore = {}
+ try:
+ output = repoman_dict[bug.id_number()]
+ for cpv in bug.cpvs():
+ pv = portage.versions.cpv_getkey(cpv)
+ cvs_path = os.path.join(options.repo, pv)
+ ebuild_name = portage.versions.catsplit(cpv)[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):
+ if ebuild_path not in to_restore:
+ to_restore[ebuild_path] = open(ebuild_path).read()
+ if manifest_path not in to_restore:
+ to_restore[manifest_path] = open(manifest_path).read()
output += subprocess.Popen(["ekeyword", options.arch, ebuild_name], cwd=cvs_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
# repoman manifest may fail if files are unfetchable. It shouldn't abort this script.
output += subprocess.Popen(["repoman", "manifest"], cwd=cvs_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
- output += subprocess.Popen(["repoman", "full"], cwd=cvs_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).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()
+ pvs = list(set([portage.versions.cpv_getkey(cpv) for cpv in bug.cpvs()]))
+ for pv in pvs:
+ cvs_path = os.path.join(options.repo, pv)
+ output += subprocess.Popen(["repoman", "full"], cwd=cvs_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
+ repoman_dict[bug.id_number()] = output
+ finally:
+ for path in to_restore:
+ with open(path, "w") as f:
+ f.write(to_restore[path])
dep_bug_ids += bug.depends_on()
dep_bug_ids = list(set(dep_bug_ids))