1 |
Author: zmedico |
2 |
Date: 2008-10-29 00:07:34 +0000 (Wed, 29 Oct 2008) |
3 |
New Revision: 11742 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dbapi/vartree.py |
7 |
Log: |
8 |
Fix interaction between LinkageMap.rebuild() and the package replacement |
9 |
process in order to avoid problems with stale or unaccounted NEEDED. This |
10 |
solves a LinkageMap corruption issue which caused findConsumers to return |
11 |
false positive inside dblink.unmerge(). |
12 |
|
13 |
|
14 |
Modified: main/trunk/pym/portage/dbapi/vartree.py |
15 |
=================================================================== |
16 |
--- main/trunk/pym/portage/dbapi/vartree.py 2008-10-28 23:15:24 UTC (rev 11741) |
17 |
+++ main/trunk/pym/portage/dbapi/vartree.py 2008-10-29 00:07:34 UTC (rev 11742) |
18 |
@@ -218,13 +218,15 @@ |
19 |
def __str__(self): |
20 |
return str(sorted(self.alt_paths)) |
21 |
|
22 |
- def rebuild(self, include_file=None): |
23 |
+ def rebuild(self, exclude_pkgs=None, include_file=None): |
24 |
root = self._root |
25 |
libs = {} |
26 |
obj_key_cache = {} |
27 |
obj_properties = {} |
28 |
lines = [] |
29 |
for cpv in self._dbapi.cpv_all(): |
30 |
+ if exclude_pkgs is not None and cpv in exclude_pkgs: |
31 |
+ continue |
32 |
lines += self._dbapi.aux_get(cpv, ["NEEDED.ELF.2"])[0].split('\n') |
33 |
# Cache NEEDED.* files avoid doing excessive IO for every rebuild. |
34 |
self._dbapi.flush_cache() |
35 |
@@ -1938,8 +1940,12 @@ |
36 |
if retval != os.EX_OK: |
37 |
writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1) |
38 |
|
39 |
- # regenerate reverse NEEDED map |
40 |
- self.vartree.dbapi.linkmap.rebuild() |
41 |
+ # Skip this if another package in the same slot has just been |
42 |
+ # merged on top of this package, since the other package has |
43 |
+ # already called LinkageMap.rebuild() and passed it's NEEDED file |
44 |
+ # in as an argument. |
45 |
+ if not others_in_slot: |
46 |
+ self.vartree.dbapi.linkmap.rebuild(exclude_pkgs=(self.mycpv,)) |
47 |
|
48 |
# remove preserved libraries that don't have any consumers left |
49 |
# Since preserved libraries can be consumers of other preserved |
50 |
@@ -1961,11 +1967,6 @@ |
51 |
preserved_node.alt_paths.add(f) |
52 |
preserved_nodes.add(preserved_node) |
53 |
for c in self.vartree.dbapi.linkmap.findConsumers(f): |
54 |
- if self.isowner(c, root): |
55 |
- # TODO: Remove this case since it shouldn't be |
56 |
- # necessary. This seems to be a false positive |
57 |
- # returned from LinkageMap.findConsumers(). |
58 |
- continue |
59 |
consumer_node = LinkageMap._LibGraphNode(c, root) |
60 |
if not consumer_node.file_exists(): |
61 |
continue |
62 |
@@ -3126,6 +3127,10 @@ |
63 |
gid=portage_gid, mode=02750, mask=02) |
64 |
writedict(cfgfiledict, conf_mem_file) |
65 |
|
66 |
+ exclude_pkgs = set(dblnk.mycpv for dblnk in others_in_slot) |
67 |
+ self.vartree.dbapi.linkmap.rebuild(exclude_pkgs=exclude_pkgs, |
68 |
+ include_file=os.path.join(inforoot, "NEEDED.ELF.2")) |
69 |
+ |
70 |
# These caches are populated during collision-protect and the data |
71 |
# they contain is now invalid. It's very important to invalidate |
72 |
# the contents_inodes cache so that FEATURES=unmerge-orphans |