From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-408552-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RajC7-0002Oz-AY
	for garchives@archives.gentoo.org; Wed, 14 Dec 2011 07:24:04 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id AAD7321C088;
	Wed, 14 Dec 2011 07:23:54 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 613EF21C088
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Dec 2011 07:23:54 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id BF81E1B4021
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Dec 2011 07:23:53 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id EA45F8004A
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Dec 2011 07:23:52 +0000 (UTC)
From: "Paweł Hajdan" <phajdan.jr@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" <phajdan.jr@gentoo.org>
Message-ID: <05c2a91bc08d694c8d004126e2b99a610a67759b.phajdan.jr@gentoo>
Subject: [gentoo-commits] proj/arch-tools:master commit in: /
X-VCS-Repository: proj/arch-tools
X-VCS-Files: bugzilla-viewer.py
X-VCS-Directories: /
X-VCS-Committer: phajdan.jr
X-VCS-Committer-Name: Paweł Hajdan
X-VCS-Revision: 05c2a91bc08d694c8d004126e2b99a610a67759b
Date: Wed, 14 Dec 2011 07:23:52 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: d4dfb5ca-c239-4106-8adc-f226dbf16435
X-Archives-Hash: af6838fbc151bca2b120b4f12571f151

commit:     05c2a91bc08d694c8d004126e2b99a610a67759b
Author:     Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 14 07:23:10 2011 +0000
Commit:     Pawe=C5=82 Hajdan <phajdan.jr <AT> gentoo <DOT> org>
CommitDate: Wed Dec 14 07:23:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/arch-tools.gi=
t;a=3Dcommit;h=3D05c2a91b

Properly handle simultaneous stabilization of multiple packages
in a single bug.

---
 bugzilla-viewer.py |   44 ++++++++++++++++++++++++--------------------
 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__ =3D=3D "__main__":
 			pv =3D portage.versions.cpv_getkey(cpv)
 			if options.verbose:
 				related_bugs[bug.id_number()] +=3D bugzilla.search(pv, status=3DNone=
)
-
-			if options.repo:
-				cvs_path =3D os.path.join(options.repo, pv)
-				ebuild_name =3D portage.versions.catsplit(cpv)[1] + ".ebuild"
-				ebuild_path =3D os.path.join(cvs_path, ebuild_name)
-				manifest_path =3D os.path.join(cvs_path, 'Manifest')
-				if os.path.exists(ebuild_path):
-					original_contents =3D open(ebuild_path).read()
-					manifest_contents =3D open(manifest_path).read()
-					try:
-						output =3D repoman_dict[bug.id_number()]
+		if options.repo:
+			to_restore =3D {}
+			try:
+				output =3D repoman_dict[bug.id_number()]
+				for cpv in bug.cpvs():
+					pv =3D portage.versions.cpv_getkey(cpv)
+					cvs_path =3D os.path.join(options.repo, pv)
+					ebuild_name =3D portage.versions.catsplit(cpv)[1] + ".ebuild"
+					ebuild_path =3D os.path.join(cvs_path, ebuild_name)
+					manifest_path =3D os.path.join(cvs_path, 'Manifest')
+					if os.path.exists(ebuild_path):
+						if ebuild_path not in to_restore:
+							to_restore[ebuild_path] =3D open(ebuild_path).read()
+						if manifest_path not in to_restore:
+							to_restore[manifest_path] =3D open(manifest_path).read()
 						output +=3D subprocess.Popen(["ekeyword", options.arch, ebuild_nam=
e], cwd=3Dcvs_path, stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.STDOUT)=
.communicate()[0]
 						# repoman manifest may fail if files are unfetchable. It shouldn't=
 abort this script.
 						output +=3D subprocess.Popen(["repoman", "manifest"], cwd=3Dcvs_pa=
th, stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.STDOUT).communicate()[0=
]
-						output +=3D subprocess.Popen(["repoman", "full"], cwd=3Dcvs_path, =
stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.STDOUT).communicate()[0]
-						repoman_dict[bug.id_number()] =3D output
-					finally:
-						f =3D open(ebuild_path, "w")
-						f.write(original_contents)
-						f.close()
-						f =3D open(manifest_path, "w")
-						f.write(manifest_contents)
-						f.close()
+				pvs =3D list(set([portage.versions.cpv_getkey(cpv) for cpv in bug.cp=
vs()]))
+				for pv in pvs:
+					cvs_path =3D os.path.join(options.repo, pv)
+					output +=3D subprocess.Popen(["repoman", "full"], cwd=3Dcvs_path, s=
tdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.STDOUT).communicate()[0]
+				repoman_dict[bug.id_number()] =3D output
+			finally:
+				for path in to_restore:
+					with open(path, "w") as f:
+						f.write(to_restore[path])
 		dep_bug_ids +=3D bug.depends_on()
=20
 	dep_bug_ids =3D list(set(dep_bug_ids))