Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Sun, 08 May 2011 04:54:08
Message-Id: bc5d73fa3db0569c55d48c2e738f12742579536c.zmedico@gentoo
1 commit: bc5d73fa3db0569c55d48c2e738f12742579536c
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 8 03:05:21 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun May 8 04:35:09 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bc5d73fa
7
8 vardbapi: acquire lock during counter_tick_core
9
10 ---
11 pym/portage/dbapi/vartree.py | 26 +++++++++++++++++---------
12 1 files changed, 17 insertions(+), 9 deletions(-)
13
14 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
15 index bc9916e..2708e43 100644
16 --- a/pym/portage/dbapi/vartree.py
17 +++ b/pym/portage/dbapi/vartree.py
18 @@ -779,17 +779,25 @@ class vardbapi(dbapi):
19 to the global file. Returns new counter value.
20
21 @param myroot: ignored, self._eroot is used instead
22 + @param mycpv: ignored
23 """
24 myroot = None
25 - counter = self.get_counter_tick_core(mycpv=mycpv) - 1
26 - if incrementing:
27 - #increment counter
28 - counter += 1
29 - # use same permissions as config._init_dirs()
30 - ensure_dirs(os.path.dirname(self._counter_path),
31 - gid=portage_gid, mode=0o2750, mask=0o2)
32 - # update new global counter file
33 - write_atomic(self._counter_path, str(counter))
34 + mycpv = None
35 +
36 + self.lock()
37 + try:
38 + counter = self.get_counter_tick_core() - 1
39 + if incrementing:
40 + #increment counter
41 + counter += 1
42 + # use same permissions as config._init_dirs()
43 + ensure_dirs(os.path.dirname(self._counter_path),
44 + gid=portage_gid, mode=0o2750, mask=0o2)
45 + # update new global counter file
46 + write_atomic(self._counter_path, str(counter))
47 + finally:
48 + self.unlock()
49 +
50 return counter
51
52 def _dblink(self, cpv):