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