1 |
Author: zmedico |
2 |
Date: 2008-05-05 04:50:23 +0000 (Mon, 05 May 2008) |
3 |
New Revision: 10193 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/pym/portage.py |
7 |
Log: |
8 |
Bug #220171 - Filter out 'lost+found' directories in vardbapi.cpv_all() |
9 |
in order to avoid fatal 'Permission denied' errors. Currently, CVS and |
10 |
names beginning with '.' are also filtered. (trunk r10192) |
11 |
|
12 |
|
13 |
Modified: main/branches/2.1.2/pym/portage.py |
14 |
=================================================================== |
15 |
--- main/branches/2.1.2/pym/portage.py 2008-05-05 04:44:30 UTC (rev 10192) |
16 |
+++ main/branches/2.1.2/pym/portage.py 2008-05-05 04:50:23 UTC (rev 10193) |
17 |
@@ -6512,6 +6512,12 @@ |
18 |
return fakedbapi.cpv_all(self) |
19 |
|
20 |
class vardbapi(dbapi): |
21 |
+ |
22 |
+ _excluded_dirs = ["CVS", "lost+found"] |
23 |
+ _excluded_dirs = [re.escape(x) for x in _excluded_dirs] |
24 |
+ _excluded_dirs = re.compile(r'^(\..*|' + \ |
25 |
+ "|".join(_excluded_dirs) + r')$') |
26 |
+ |
27 |
""" |
28 |
The categories parameter is unused since the dbapi class |
29 |
now has a categories property that is generated from the |
30 |
@@ -6711,10 +6717,12 @@ |
31 |
returnme = [] |
32 |
basepath = os.path.join(self.root, VDB_PATH) + os.path.sep |
33 |
for x in listdir(basepath, EmptyOnError=1, ignorecvs=1, dirsonly=1): |
34 |
+ if self._excluded_dirs.match(x) is not None: |
35 |
+ continue |
36 |
if not self._category_re.match(x): |
37 |
continue |
38 |
for y in listdir(basepath+x,EmptyOnError=1): |
39 |
- if y.startswith("."): |
40 |
+ if self._excluded_dirs.match(y) is not None: |
41 |
continue |
42 |
subpath = x+"/"+y |
43 |
# -MERGING- should never be a cpv, nor should files. |
44 |
|
45 |
-- |
46 |
gentoo-commits@l.g.o mailing list |