summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-24 21:36:36 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-25 23:12:38 -0700
commited640f020b59d46876e74aae9e347242744442b3 (patch)
tree4be555cf443fe006f108ab8c214631a2e8f9eea1 /pym
parent665e83018b7bcce3d9412c83d84c408ce8def256 (diff)
downloadportage-ed640f020b59d46876e74aae9e347242744442b3.tar.gz
portage-ed640f020b59d46876e74aae9e347242744442b3.tar.bz2
portage-ed640f020b59d46876e74aae9e347242744442b3.zip
vardbapi: use config._init_dirs() when necessary
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/vartree.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1db7d9e57..aa57ab74f 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -37,7 +37,7 @@ from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_PRESERVE_LIBS
from portage.dbapi import dbapi
from portage.exception import CommandNotFound, \
- InvalidData, InvalidPackageName, \
+ InvalidData, InvalidLocation, InvalidPackageName, \
FileNotFound, PermissionDenied, UnsupportedAPIException
from portage.localization import _
from portage.util.movefile import movefile
@@ -787,11 +787,12 @@ class vardbapi(dbapi):
if incrementing:
#increment counter
counter += 1
- # use same permissions as config._init_dirs()
- ensure_dirs(os.path.dirname(self._counter_path),
- gid=portage_gid, mode=0o2750, mask=0o2)
# update new global counter file
- write_atomic(self._counter_path, str(counter))
+ 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()