1 |
commit: 28fb9337fabb90810585c87b35f0b3a73ed29821 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 25 04:36:36 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 25 04:36:36 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=28fb9337 |
7 |
|
8 |
vardbapi: use config._init_dirs() when necessary |
9 |
|
10 |
--- |
11 |
pym/portage/dbapi/vartree.py | 17 +++++++++++------ |
12 |
1 files changed, 11 insertions(+), 6 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
15 |
index e29d70e..0079e4f 100644 |
16 |
--- a/pym/portage/dbapi/vartree.py |
17 |
+++ b/pym/portage/dbapi/vartree.py |
18 |
@@ -39,7 +39,7 @@ from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_PRESERVE_LIBS |
19 |
from portage.dbapi import dbapi |
20 |
from portage.dep import _slot_separator |
21 |
from portage.exception import CommandNotFound, \ |
22 |
- InvalidData, InvalidPackageName, \ |
23 |
+ InvalidData, InvalidLocation, InvalidPackageName, \ |
24 |
FileNotFound, PermissionDenied, UnsupportedAPIException |
25 |
from portage.localization import _ |
26 |
from portage.util.movefile import movefile |
27 |
@@ -222,7 +222,11 @@ class vardbapi(dbapi): |
28 |
if self._fs_lock_count < 1: |
29 |
if self._fs_lock_obj is not None: |
30 |
raise AssertionError("already locked") |
31 |
- self._fs_lock_obj = lockfile(self._conf_mem_file) |
32 |
+ try: |
33 |
+ self._fs_lock_obj = lockfile(self._conf_mem_file) |
34 |
+ except InvalidLocation: |
35 |
+ self.settings._init_dirs() |
36 |
+ self._fs_lock_obj = lockfile(self._conf_mem_file) |
37 |
self._fs_lock_count += 1 |
38 |
|
39 |
def _fs_unlock(self): |
40 |
@@ -822,11 +826,12 @@ class vardbapi(dbapi): |
41 |
if incrementing: |
42 |
#increment counter |
43 |
counter += 1 |
44 |
- # use same permissions as config._init_dirs() |
45 |
- ensure_dirs(os.path.dirname(self._counter_path), |
46 |
- gid=portage_gid, mode=0o2750, mask=0o2) |
47 |
# update new global counter file |
48 |
- write_atomic(self._counter_path, str(counter)) |
49 |
+ try: |
50 |
+ write_atomic(self._counter_path, str(counter)) |
51 |
+ except InvalidLocation: |
52 |
+ self.settings._init_dirs() |
53 |
+ write_atomic(self._counter_path, str(counter)) |
54 |
self._cached_counter = counter |
55 |
finally: |
56 |
self.unlock() |