1 |
Author: volkmar |
2 |
Date: 2010-01-30 15:50:06 +0000 (Sat, 30 Jan 2010) |
3 |
New Revision: 15291 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/cache/flat_list.py |
7 |
Log: |
8 |
fix flat_list cache backend |
9 |
looks like it was outdated wrt. template cache backend |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/cache/flat_list.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/cache/flat_list.py 2010-01-30 14:46:50 UTC (rev 15290) |
15 |
+++ main/trunk/pym/portage/cache/flat_list.py 2010-01-30 15:50:06 UTC (rev 15291) |
16 |
@@ -22,21 +22,21 @@ |
17 |
'KEYWORDS', 'IUSE', 'UNUSED_00', |
18 |
'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES') |
19 |
|
20 |
- def __init__(self, label, auxdbkeys, **config): |
21 |
- super(database,self).__init__(label, auxdbkeys, **config) |
22 |
- self._base = os.path.join(self._base, |
23 |
+ def __init__(self, *args, **config): |
24 |
+ super(database,self).__init__(*args, **config) |
25 |
+ self.location = os.path.join(self.location, |
26 |
self.label.lstrip(os.path.sep).rstrip(os.path.sep)) |
27 |
|
28 |
if len(self._known_keys) > len(self.auxdbkey_order) + 2: |
29 |
raise Exception("less ordered keys then auxdbkeys") |
30 |
- if not os.path.exists(self._base): |
31 |
+ if not os.path.exists(self.location): |
32 |
self._ensure_dirs() |
33 |
|
34 |
|
35 |
def _getitem(self, cpv): |
36 |
d = {} |
37 |
try: |
38 |
- myf = codecs.open(_unicode_encode(os.path.join(self._base, cpv), |
39 |
+ myf = codecs.open(_unicode_encode(os.path.join(self.location, cpv), |
40 |
encoding=_encodings['fs'], errors='strict'), |
41 |
mode='r', encoding=_encodings['repo.content'], |
42 |
errors='replace') |
43 |
@@ -58,7 +58,7 @@ |
44 |
|
45 |
def _setitem(self, cpv, values): |
46 |
s = cpv.rfind("/") |
47 |
- fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:])) |
48 |
+ fp=os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:])) |
49 |
try: |
50 |
myf = codecs.open(_unicode_encode(fp, |
51 |
encoding=_encodings['fs'], errors='strict'), |
52 |
@@ -84,7 +84,7 @@ |
53 |
myf.close() |
54 |
self._ensure_access(fp, mtime=values["_mtime_"]) |
55 |
#update written. now we move it. |
56 |
- new_fp = os.path.join(self._base,cpv) |
57 |
+ new_fp = os.path.join(self.location,cpv) |
58 |
try: |
59 |
os.rename(fp, new_fp) |
60 |
except (OSError, IOError) as e: |
61 |
@@ -94,7 +94,7 @@ |
62 |
|
63 |
def _delitem(self, cpv): |
64 |
try: |
65 |
- os.remove(os.path.join(self._base,cpv)) |
66 |
+ os.remove(os.path.join(self.location,cpv)) |
67 |
except OSError as e: |
68 |
if errno.ENOENT == e.errno: |
69 |
raise KeyError(cpv) |
70 |
@@ -103,13 +103,13 @@ |
71 |
|
72 |
|
73 |
def __contains__(self, cpv): |
74 |
- return os.path.exists(os.path.join(self._base, cpv)) |
75 |
+ return os.path.exists(os.path.join(self.location, cpv)) |
76 |
|
77 |
|
78 |
def __iter__(self): |
79 |
"""generator for walking the dir struct""" |
80 |
- dirs = [self._base] |
81 |
- len_base = len(self._base) |
82 |
+ dirs = [self.location] |
83 |
+ len_base = len(self.location) |
84 |
while len(dirs): |
85 |
for l in os.listdir(dirs[0]): |
86 |
if l.endswith(".cpickle"): |