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 1QIw0O-00065s-9K for garchives@archives.gentoo.org; Sun, 08 May 2011 04:54:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6A9661C06A; Sun, 8 May 2011 04:53:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3A8101C076 for ; Sun, 8 May 2011 04:53:51 +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 B61C41B405D for ; Sun, 8 May 2011 04:53:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1C6AF45B07 for ; Sun, 8 May 2011 04:53:50 +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/vartree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: bc5d73fa3db0569c55d48c2e738f12742579536c Date: Sun, 8 May 2011 04:53:50 +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: 92c2c3dae4a0c47e73eba8450750c2e5 commit: bc5d73fa3db0569c55d48c2e738f12742579536c Author: Zac Medico gentoo org> AuthorDate: Sun May 8 03:05:21 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun May 8 04:35:09 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dbc5d73fa vardbapi: acquire lock during counter_tick_core --- pym/portage/dbapi/vartree.py | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index bc9916e..2708e43 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -779,17 +779,25 @@ class vardbapi(dbapi): to the global file. Returns new counter value. =20 @param myroot: ignored, self._eroot is used instead + @param mycpv: ignored """ myroot =3D None - counter =3D self.get_counter_tick_core(mycpv=3Dmycpv) - 1 - if incrementing: - #increment counter - counter +=3D 1 - # use same permissions as config._init_dirs() - ensure_dirs(os.path.dirname(self._counter_path), - gid=3Dportage_gid, mode=3D0o2750, mask=3D0o2) - # update new global counter file - write_atomic(self._counter_path, str(counter)) + mycpv =3D None + + self.lock() + try: + counter =3D self.get_counter_tick_core() - 1 + if incrementing: + #increment counter + counter +=3D 1 + # use same permissions as config._init_dirs() + ensure_dirs(os.path.dirname(self._counter_path), + gid=3Dportage_gid, mode=3D0o2750, mask=3D0o2) + # update new global counter file + write_atomic(self._counter_path, str(counter)) + finally: + self.unlock() + return counter =20 def _dblink(self, cpv):