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 1QKOPV-0003ZK-0o for garchives@archives.gentoo.org; Thu, 12 May 2011 05:26:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E5A831C090; Thu, 12 May 2011 05:24:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B8E241C089 for ; Thu, 12 May 2011 05:24: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 703121B401E for ; Thu, 12 May 2011 05:24:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id BD09680062 for ; Thu, 12 May 2011 05:24: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: <32c4d1d7f05b8ab10a97a5ef965be14a8dd7e10b.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:2.1.9 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: 32c4d1d7f05b8ab10a97a5ef965be14a8dd7e10b Date: Thu, 12 May 2011 05:24: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: 60e9bc782d6b8462f434d9f31ca2be5c commit: 32c4d1d7f05b8ab10a97a5ef965be14a8dd7e10b Author: Zac Medico gentoo org> AuthorDate: Sun May 8 03:05:21 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu May 12 05:17:11 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D32c4d1d7 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 1b13e13..1302556 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -776,17 +776,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):