Gentoo Archives: gentoo-commits

From: "Marius Mauch (genone)" <genone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10200 - main/trunk/pym/portage/dbapi
Date: Mon, 05 May 2008 08:58:08
Message-Id: E1JswWM-0001R7-4P@stork.gentoo.org
1 Author: genone
2 Date: 2008-05-05 08:58:05 +0000 (Mon, 05 May 2008)
3 New Revision: 10200
4
5 Modified:
6 main/trunk/pym/portage/dbapi/vartree.py
7 Log:
8 fix preserve_libs logic to properly account for the current package instance
9
10 Modified: main/trunk/pym/portage/dbapi/vartree.py
11 ===================================================================
12 --- main/trunk/pym/portage/dbapi/vartree.py 2008-05-05 06:36:27 UTC (rev 10199)
13 +++ main/trunk/pym/portage/dbapi/vartree.py 2008-05-05 08:58:05 UTC (rev 10200)
14 @@ -132,13 +132,16 @@
15 self._obj_properties = {}
16 self._defpath = getlibpaths()
17
18 - def rebuild(self):
19 + def rebuild(self, include_file=None):
20 libs = {}
21 obj_properties = {}
22 lines = []
23 for cpv in self._dbapi.cpv_all():
24 lines += grabfile(self._dbapi.getpath(cpv, filename="NEEDED.ELF.2"))
25 -
26 +
27 + if include_file:
28 + lines += grabfile(include_file)
29 +
30 # have to call scanelf for preserved libs here as they aren't
31 # registered in NEEDED.ELF.2 files
32 if self._dbapi.plib_registry and self._dbapi.plib_registry.getPreservedLibs():
33 @@ -187,10 +190,11 @@
34 def findProviders(self, obj):
35 if not self._libs:
36 self.rebuild()
37 - obj = os.path.realpath(obj)
38 rValue = {}
39 if obj not in self._obj_properties:
40 - raise KeyError("%s not in object list" % obj)
41 + obj = os.path.realpath(obj)
42 + if obj not in self._obj_properties:
43 + raise KeyError("%s not in object list" % obj)
44 arch, needed, path, soname = self._obj_properties[obj]
45 path.extend(self._defpath)
46 path = [os.path.realpath(x) for x in path]
47 @@ -208,7 +212,10 @@
48 def findConsumers(self, obj):
49 if not self._libs:
50 self.rebuild()
51 - obj = os.path.realpath(obj)
52 + if obj not in self._obj_properties:
53 + obj = os.path.realpath(obj)
54 + if obj not in self._obj_properties:
55 + raise KeyError("%s not in object list" % obj)
56 rValue = set()
57 for soname in self._libs:
58 for arch in self._libs[soname]:
59 @@ -1653,10 +1660,10 @@
60
61 return False
62
63 - def _preserve_libs(self, srcroot, destroot, mycontents, counter):
64 + def _preserve_libs(self, srcroot, destroot, mycontents, counter, inforoot):
65 # read global reverse NEEDED map
66 linkmap = self.vartree.dbapi.linkmap
67 - linkmap.rebuild()
68 + linkmap.rebuild(include_file=os.path.join(inforoot, "NEEDED.ELF.2"))
69 liblist = linkmap.listLibraryObjects()
70
71 # get list of libraries from old package instance
72 @@ -1664,12 +1671,13 @@
73 old_libs = set(old_contents).intersection(liblist)
74
75 # get list of libraries from new package instance
76 - mylibs = set(mycontents).intersection(liblist)
77 -
78 + mylibs = set([os.path.join(os.sep, x) for x in mycontents]).intersection(liblist)
79 +
80 # check which libs are present in the old, but not the new package instance
81 candidates = old_libs.difference(mylibs)
82 +
83 for x in old_contents:
84 - if os.path.islink(x) and os.path.realpath(x) in candidates:
85 + if os.path.islink(x) and os.path.realpath(x) in candidates and x not in mycontents:
86 candidates.add(x)
87
88 # ignore any libs that are only internally used by the package
89 @@ -1701,6 +1709,7 @@
90 for c in linkmap.findConsumers(lib):
91 localkeep = True
92 providers = linkmap.findProviders(c)
93 +
94 for soname in providers:
95 if lib in providers[soname]:
96 for p in providers[soname]:
97 @@ -2044,7 +2053,7 @@
98
99 # Preserve old libs if they are still in use
100 if slot_matches and "preserve-libs" in self.settings.features:
101 - self._preserve_libs(srcroot, destroot, myfilelist+mylinklist, counter)
102 + self._preserve_libs(srcroot, destroot, myfilelist+mylinklist, counter, inforoot)
103
104 # check for package collisions
105 collisions = self._collision_protect(srcroot, destroot, others_in_slot,
106
107 --
108 gentoo-commits@l.g.o mailing list