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 ) id 1Q3jAm-0001pv-2L for garchives@archives.gentoo.org; Sun, 27 Mar 2011 06:10:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 28A43E07CD; Sun, 27 Mar 2011 06:09:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DD8D5E07CD for ; Sun, 27 Mar 2011 06:09:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6CBED1B4021 for ; Sun, 27 Mar 2011 06:09:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CFF0E8006A for ; Sun, 27 Mar 2011 06:09:51 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/_MergeProcess.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: cdf04882ce380579814b9cfe63ee593dbfba5ef9 Date: Sun, 27 Mar 2011 06:09:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 39354c578437d6bec9d3c5bebb0a9cd9 commit: cdf04882ce380579814b9cfe63ee593dbfba5ef9 Author: Zac Medico gentoo org> AuthorDate: Sun Mar 27 06:09:27 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Mar 27 06:09:27 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dcdf04882 MergeProcess: add fallback setcpv call It's important that this metadata access happens in the parent process, since closing of file descriptors in the subprocess can prevent access to open database connections such as that used by the sqlite metadata cache module. --- pym/portage/dbapi/_MergeProcess.py | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_Merg= eProcess.py index ea7c3e6..afb2e08 100644 --- a/pym/portage/dbapi/_MergeProcess.py +++ b/pym/portage/dbapi/_MergeProcess.py @@ -30,6 +30,21 @@ class MergeProcess(SpawnProcess): '_buf', '_elog_keys') =20 def _start(self): + # Portage should always call setcpv prior to this + # point, but here we have a fallback as a convenience + # for external API consumers. It's important that + # this metadata access happens in the parent process, + # since closing of file descriptors in the subprocess + # can prevent access to open database connections such + # as that used by the sqlite metadata cache module. + cpv =3D "%s/%s" % (self.mycat, self.mypkg) + settings =3D self.settings + if cpv !=3D settings.mycpv or \ + "IUSE" not in settings.configdict["pkg"]: + settings.reload() + settings.reset() + settings.setcpv(cpv, mydb=3Dself.mydbapi) + self._handle_self_reinstall() super(MergeProcess, self)._start() =20 @@ -116,9 +131,10 @@ class MergeProcess(SpawnProcess): fcntl.fcntl(elog_reader_fd, fcntl.F_GETFL) | os.O_NONBLOCK) blockers =3D None if self.blockers is not None: - # Query blockers in the main process, since metadata cache - # queries may not work for some databases from within a - # subprocess. For example, sqlite is known to misbehave. + # Query blockers in the main process, since closing + # of file descriptors in the subprocess can prevent + # access to open database connections such as that + # used by the sqlite metadata cache module. blockers =3D self.blockers() mylink =3D self.dblink(self.mycat, self.mypkg, settings=3Dself.setting= s, treetype=3Dself.treetype, vartree=3Dself.vartree,