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:35:30
Message-Id: 1367382811.361706c50ca591c22ac3ca5fca6450a7cbe510d2.zmedico@gentoo
1 commit: 361706c50ca591c22ac3ca5fca6450a7cbe510d2
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:33:31 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=361706c5
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 | 18 ++++++++++++------
16 .../util/_dyn_libs/display_preserved_libs.py | 2 +-
17 3 files changed, 18 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..3920f94 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,19 @@ 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 + if exclude_providers is not None or not greedy:
82 relevant_dir_keys = set()
83 for provider_key in soname_node.providers:
84 + if not greedy and provider_key == obj_key:
85 + continue
86 provider_objs = self._obj_properties[provider_key].alt_paths
87 for p in provider_objs:
88 provider_excluded = False
89 - for excluded_provider_isowner in exclude_providers:
90 - if excluded_provider_isowner(p):
91 - provider_excluded = True
92 - break
93 + if exclude_providers is not None:
94 + for excluded_provider_isowner in exclude_providers:
95 + if excluded_provider_isowner(p):
96 + provider_excluded = True
97 + break
98 if not provider_excluded:
99 # This provider is not excluded. It will
100 # satisfy a consumer of this soname if it
101
102 diff --git a/pym/portage/util/_dyn_libs/display_preserved_libs.py b/pym/portage/util/_dyn_libs/display_preserved_libs.py
103 index 238274f..b16478d 100644
104 --- a/pym/portage/util/_dyn_libs/display_preserved_libs.py
105 +++ b/pym/portage/util/_dyn_libs/display_preserved_libs.py
106 @@ -31,7 +31,7 @@ def display_preserved_libs(vardb):
107 if f in consumer_map:
108 continue
109 consumers = []
110 - for c in linkmap.findConsumers(f):
111 + for c in linkmap.findConsumers(f, greedy=False):
112 # Filter out any consumers that are also preserved libs
113 # belonging to the same package as the provider.
114 if linkmap._obj_key(c) not in internal_plib_keys: