Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/portage/util/_dyn_libs/
Date: Wed, 01 May 2013 04:01:16
Message-Id: 1367380852.f3b2054cb599d6ef34612874b5e067f67667dcac.zmedico@gentoo
1 commit: f3b2054cb599d6ef34612874b5e067f67667dcac
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 1 04:00:52 2013 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed May 1 04:00:52 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f3b2054c
7
8 Use non-greedy findConsumers for bug #467896.
9
10 This fixes the preserve-libs display and @preserved-rebuild to omit
11 library consumers that are satisfied by alternative providers.
12
13 ---
14 pym/portage/_sets/libs.py | 9 +++++----
15 pym/portage/util/_dyn_libs/LinkageMapELF.py | 17 +++++++++++------
16 .../util/_dyn_libs/display_preserved_libs.py | 2 +-
17 3 files changed, 17 insertions(+), 11 deletions(-)
18
19 diff --git a/pym/portage/_sets/libs.py b/pym/portage/_sets/libs.py
20 index a6433e8..022e076 100644
21 --- a/pym/portage/_sets/libs.py
22 +++ b/pym/portage/_sets/libs.py
23 @@ -1,4 +1,4 @@
24 -# Copyright 2007-2012 Gentoo Foundation
25 +# Copyright 2007-2013 Gentoo Foundation
26 # Distributed under the terms of the GNU General Public License v2
27
28 from __future__ import print_function
29 @@ -49,7 +49,8 @@ class LibraryFileConsumerSet(LibraryConsumerSet):
30 def load(self):
31 consumers = set()
32 for lib in self.files:
33 - consumers.update(self.dbapi._linkmap.findConsumers(lib))
34 + consumers.update(
35 + self.dbapi._linkmap.findConsumers(lib, greedy=False))
36
37 if not consumers:
38 return
39 @@ -77,10 +78,10 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet):
40 for lib in libs:
41 if self.debug:
42 print(lib)
43 - for x in sorted(self.dbapi._linkmap.findConsumers(lib)):
44 + for x in sorted(self.dbapi._linkmap.findConsumers(lib, greedy=False)):
45 print(" ", x)
46 print("-"*40)
47 - consumers.update(self.dbapi._linkmap.findConsumers(lib))
48 + consumers.update(self.dbapi._linkmap.findConsumers(lib, greedy=False))
49 # Don't rebuild packages just because they contain preserved
50 # libs that happen to be consumers of other preserved libs.
51 for libs in plib_dict.values():
52
53 diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
54 index 8d0c09d..ffe4218 100644
55 --- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
56 +++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
57 @@ -678,7 +678,7 @@ class LinkageMapELF(object):
58 rValue[soname].add(provider)
59 return rValue
60
61 - def findConsumers(self, obj, exclude_providers=None):
62 + def findConsumers(self, obj, exclude_providers=None, greedy=True):
63 """
64 Find consumers of an object or object key.
65
66 @@ -715,6 +715,9 @@ class LinkageMapELF(object):
67 '/usr/lib/libssl.so.0.9.8'), and return True if the library is
68 owned by a provider which is planned for removal.
69 @type exclude_providers: collection
70 + @param greedy: If True, then include consumers that are satisfied
71 + by alternative providers, otherwise omit them. Default is True.
72 + @type greedy: Boolean
73 @rtype: set of strings (example: set(['/bin/foo', '/usr/bin/bar']))
74 @return: The return value is a soname -> set-of-library-paths, where
75 set-of-library-paths satisfy soname.
76 @@ -769,16 +772,18 @@ class LinkageMapELF(object):
77 defpath_keys = set(self._path_key(x) for x in self._defpath)
78 satisfied_consumer_keys = set()
79 if soname_node is not None:
80 - if exclude_providers is not None:
81 relevant_dir_keys = set()
82 for provider_key in soname_node.providers:
83 + if not greedy and provider_key == obj_key:
84 + continue
85 provider_objs = self._obj_properties[provider_key].alt_paths
86 for p in provider_objs:
87 provider_excluded = False
88 - for excluded_provider_isowner in exclude_providers:
89 - if excluded_provider_isowner(p):
90 - provider_excluded = True
91 - break
92 + if exclude_providers is not None:
93 + for excluded_provider_isowner in exclude_providers:
94 + if excluded_provider_isowner(p):
95 + provider_excluded = True
96 + break
97 if not provider_excluded:
98 # This provider is not excluded. It will
99 # satisfy a consumer of this soname if it
100
101 diff --git a/pym/portage/util/_dyn_libs/display_preserved_libs.py b/pym/portage/util/_dyn_libs/display_preserved_libs.py
102 index 238274f..b16478d 100644
103 --- a/pym/portage/util/_dyn_libs/display_preserved_libs.py
104 +++ b/pym/portage/util/_dyn_libs/display_preserved_libs.py
105 @@ -31,7 +31,7 @@ def display_preserved_libs(vardb):
106 if f in consumer_map:
107 continue
108 consumers = []
109 - for c in linkmap.findConsumers(f):
110 + for c in linkmap.findConsumers(f, greedy=False):
111 # Filter out any consumers that are also preserved libs
112 # belonging to the same package as the provider.
113 if linkmap._obj_key(c) not in internal_plib_keys: