summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-25 18:37:55 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-25 23:12:38 -0700
commitea942032976b5bfa9673d650726bcbeab8414583 (patch)
tree3b7d66f39e564ef1c75f45278c1b111a43ec1d34
parentcd6304f1245df0265d8f73f68d45a382a8f8ac1d (diff)
downloadportage-ea942032976b5bfa9673d650726bcbeab8414583.tar.gz
portage-ea942032976b5bfa9673d650726bcbeab8414583.tar.bz2
portage-ea942032976b5bfa9673d650726bcbeab8414583.zip
counter_tick: respect incrementing param always
Every package install must have a unique counter, since a slotmove update can move two packages into the same SLOT and in that case it's important that both packages have different COUNTER metadata.
-rw-r--r--pym/portage/dbapi/vartree.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4c7dd1459..b75d69a38 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -773,27 +773,31 @@ class vardbapi(dbapi):
def counter_tick_core(self, myroot=None, incrementing=1, mycpv=None):
"""
This method will grab the next COUNTER value and record it back
- to the global file. Returns new counter value.
+ to the global file. Note that every package install must have
+ a unique counter, since a slotmove update can move two packages
+ into the same SLOT and in that case it's important that both
+ packages have different COUNTER metadata.
@param myroot: ignored, self._eroot is used instead
@param mycpv: ignored
+ @rtype: int
+ @returns: new counter value
"""
myroot = None
mycpv = None
self.lock()
try:
counter = self.get_counter_tick_core() - 1
- if self._cached_counter != counter:
- if incrementing:
- #increment counter
- counter += 1
- # update new global counter file
- try:
- write_atomic(self._counter_path, str(counter))
- except InvalidLocation:
- self.settings._init_dirs()
- write_atomic(self._counter_path, str(counter))
- self._cached_counter = counter
+ if incrementing:
+ #increment counter
+ counter += 1
+ # update new global counter file
+ try:
+ write_atomic(self._counter_path, str(counter))
+ except InvalidLocation:
+ self.settings._init_dirs()
+ write_atomic(self._counter_path, str(counter))
+ self._cached_counter = counter
finally:
self.unlock()