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: Thu, 26 May 2011 01:39:46
Message-Id: 87cf046b84f153a9e35fb3d248c50479312076a5.zmedico@gentoo
1 commit: 87cf046b84f153a9e35fb3d248c50479312076a5
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 01:37:55 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 01:37:55 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=87cf046b
7
8 counter_tick: respect incrementing param always
9
10 Every package install must have a unique counter, since a slotmove
11 update can move two packages into the same SLOT and in that case it's
12 important that both packages have different COUNTER metadata.
13
14 ---
15 pym/portage/dbapi/vartree.py | 28 ++++++++++++++++------------
16 1 files changed, 16 insertions(+), 12 deletions(-)
17
18 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
19 index 62a2332..47952e7 100644
20 --- a/pym/portage/dbapi/vartree.py
21 +++ b/pym/portage/dbapi/vartree.py
22 @@ -812,27 +812,31 @@ class vardbapi(dbapi):
23 def counter_tick_core(self, myroot=None, incrementing=1, mycpv=None):
24 """
25 This method will grab the next COUNTER value and record it back
26 - to the global file. Returns new counter value.
27 + to the global file. Note that every package install must have
28 + a unique counter, since a slotmove update can move two packages
29 + into the same SLOT and in that case it's important that both
30 + packages have different COUNTER metadata.
31
32 @param myroot: ignored, self._eroot is used instead
33 @param mycpv: ignored
34 + @rtype: int
35 + @returns: new counter value
36 """
37 myroot = None
38 mycpv = None
39 self.lock()
40 try:
41 counter = self.get_counter_tick_core() - 1
42 - if self._cached_counter != counter:
43 - if incrementing:
44 - #increment counter
45 - counter += 1
46 - # update new global counter file
47 - try:
48 - write_atomic(self._counter_path, str(counter))
49 - except InvalidLocation:
50 - self.settings._init_dirs()
51 - write_atomic(self._counter_path, str(counter))
52 - self._cached_counter = counter
53 + if incrementing:
54 + #increment counter
55 + counter += 1
56 + # update new global counter file
57 + try:
58 + write_atomic(self._counter_path, str(counter))
59 + except InvalidLocation:
60 + self.settings._init_dirs()
61 + write_atomic(self._counter_path, str(counter))
62 + self._cached_counter = counter
63 finally:
64 self.unlock()