1 |
commit: 4778b4b46260a7f585e30c712a1002361302f4db |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 1 20:07:53 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 1 20:07:53 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4778b4b4 |
7 |
|
8 |
unmerge: implicitly unmerge parent directories |
9 |
|
10 |
We can't necessarily assume that they are explicitly listed in |
11 |
CONTENTS. |
12 |
|
13 |
--- |
14 |
pym/portage/dbapi/vartree.py | 19 ++++++++++++++++--- |
15 |
1 files changed, 16 insertions(+), 3 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
18 |
index 2e5d873..77d0256 100644 |
19 |
--- a/pym/portage/dbapi/vartree.py |
20 |
+++ b/pym/portage/dbapi/vartree.py |
21 |
@@ -1785,7 +1785,7 @@ class dblink(object): |
22 |
mykeys.reverse() |
23 |
|
24 |
#process symlinks second-to-last, directories last. |
25 |
- mydirs = [] |
26 |
+ mydirs = set() |
27 |
ignored_unlink_errnos = ( |
28 |
errno.EBUSY, errno.ENOENT, |
29 |
errno.ENOTDIR, errno.EISDIR) |
30 |
@@ -1847,6 +1847,7 @@ class dblink(object): |
31 |
|
32 |
real_root = self.settings['ROOT'] |
33 |
real_root_len = len(real_root) - 1 |
34 |
+ eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1 |
35 |
|
36 |
for i, objkey in enumerate(mykeys): |
37 |
|
38 |
@@ -1872,6 +1873,18 @@ class dblink(object): |
39 |
os = portage.os |
40 |
perf_md5 = portage.checksum.perform_md5 |
41 |
|
42 |
+ # Try to unmerge parent directories of everything |
43 |
+ # listed in CONTENTS, since we can't necessarily |
44 |
+ # assume that directories are listed in CONTENTS. |
45 |
+ obj_split = obj.split(os.sep) |
46 |
+ obj_split.pop() |
47 |
+ while len(obj_split) > eroot_split_len: |
48 |
+ parent = os.sep.join(obj_split) |
49 |
+ if parent in mydirs: |
50 |
+ break |
51 |
+ mydirs.add(parent) |
52 |
+ obj_split.pop() |
53 |
+ |
54 |
file_data = pkgfiles[objkey] |
55 |
file_type = file_data[0] |
56 |
statobj = None |
57 |
@@ -1940,7 +1953,7 @@ class dblink(object): |
58 |
if lstatobj is None or not stat.S_ISDIR(lstatobj.st_mode): |
59 |
show_unmerge("---", unmerge_desc["!dir"], file_type, obj) |
60 |
continue |
61 |
- mydirs.append(obj) |
62 |
+ mydirs.add(obj) |
63 |
elif pkgfiles[objkey][0] == "sym": |
64 |
if not islink: |
65 |
show_unmerge("---", unmerge_desc["!sym"], file_type, obj) |
66 |
@@ -1992,7 +2005,7 @@ class dblink(object): |
67 |
elif pkgfiles[objkey][0] == "dev": |
68 |
show_unmerge("---", "", file_type, obj) |
69 |
|
70 |
- mydirs.sort() |
71 |
+ mydirs = sorted(mydirs) |
72 |
mydirs.reverse() |
73 |
|
74 |
for obj in mydirs: |