public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/portage/util/_dyn_libs/
@ 2013-05-01  4:01 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2013-05-01  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f3b2054cb599d6ef34612874b5e067f67667dcac
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 04:00:52 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  1 04:00:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f3b2054c

Use non-greedy findConsumers for bug #467896.

This fixes the preserve-libs display and @preserved-rebuild to omit
library consumers that are satisfied by alternative providers.

---
 pym/portage/_sets/libs.py                          |    9 +++++----
 pym/portage/util/_dyn_libs/LinkageMapELF.py        |   17 +++++++++++------
 .../util/_dyn_libs/display_preserved_libs.py       |    2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/pym/portage/_sets/libs.py b/pym/portage/_sets/libs.py
index a6433e8..022e076 100644
--- a/pym/portage/_sets/libs.py
+++ b/pym/portage/_sets/libs.py
@@ -1,4 +1,4 @@
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -49,7 +49,8 @@ class LibraryFileConsumerSet(LibraryConsumerSet):
 	def load(self):
 		consumers = set()
 		for lib in self.files:
-			consumers.update(self.dbapi._linkmap.findConsumers(lib))
+			consumers.update(
+				self.dbapi._linkmap.findConsumers(lib, greedy=False))
 
 		if not consumers:
 			return
@@ -77,10 +78,10 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet):
 				for lib in libs:
 					if self.debug:
 						print(lib)
-						for x in sorted(self.dbapi._linkmap.findConsumers(lib)):
+						for x in sorted(self.dbapi._linkmap.findConsumers(lib, greedy=False)):
 							print("    ", x)
 						print("-"*40)
-					consumers.update(self.dbapi._linkmap.findConsumers(lib))
+					consumers.update(self.dbapi._linkmap.findConsumers(lib, greedy=False))
 			# Don't rebuild packages just because they contain preserved
 			# libs that happen to be consumers of other preserved libs.
 			for libs in plib_dict.values():

diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index 8d0c09d..ffe4218 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -678,7 +678,7 @@ class LinkageMapELF(object):
 						rValue[soname].add(provider)
 		return rValue
 
-	def findConsumers(self, obj, exclude_providers=None):
+	def findConsumers(self, obj, exclude_providers=None, greedy=True):
 		"""
 		Find consumers of an object or object key.
 
@@ -715,6 +715,9 @@ class LinkageMapELF(object):
 			'/usr/lib/libssl.so.0.9.8'), and return True if the library is
 			owned by a provider which is planned for removal.
 		@type exclude_providers: collection
+		@param greedy: If True, then include consumers that are satisfied
+		by alternative providers, otherwise omit them. Default is True.
+		@type greedy: Boolean
 		@rtype: set of strings (example: set(['/bin/foo', '/usr/bin/bar']))
 		@return: The return value is a soname -> set-of-library-paths, where
 		set-of-library-paths satisfy soname.
@@ -769,16 +772,18 @@ class LinkageMapELF(object):
 		defpath_keys = set(self._path_key(x) for x in self._defpath)
 		satisfied_consumer_keys = set()
 		if soname_node is not None:
-			if exclude_providers is not None:
 				relevant_dir_keys = set()
 				for provider_key in soname_node.providers:
+					if not greedy and provider_key == obj_key:
+						continue
 					provider_objs = self._obj_properties[provider_key].alt_paths
 					for p in provider_objs:
 						provider_excluded = False
-						for excluded_provider_isowner in exclude_providers:
-							if excluded_provider_isowner(p):
-								provider_excluded = True
-								break
+						if exclude_providers is not None:
+							for excluded_provider_isowner in exclude_providers:
+								if excluded_provider_isowner(p):
+									provider_excluded = True
+									break
 						if not provider_excluded:
 							# This provider is not excluded. It will
 							# satisfy a consumer of this soname if it

diff --git a/pym/portage/util/_dyn_libs/display_preserved_libs.py b/pym/portage/util/_dyn_libs/display_preserved_libs.py
index 238274f..b16478d 100644
--- a/pym/portage/util/_dyn_libs/display_preserved_libs.py
+++ b/pym/portage/util/_dyn_libs/display_preserved_libs.py
@@ -31,7 +31,7 @@ def display_preserved_libs(vardb):
 				if f in consumer_map:
 					continue
 				consumers = []
-				for c in linkmap.findConsumers(f):
+				for c in linkmap.findConsumers(f, greedy=False):
 					# Filter out any consumers that are also preserved libs
 					# belonging to the same package as the provider.
 					if linkmap._obj_key(c) not in internal_plib_keys:


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/portage/util/_dyn_libs/
@ 2013-05-01  4:35 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2013-05-01  4:35 UTC (permalink / raw
  To: gentoo-commits

commit:     361706c50ca591c22ac3ca5fca6450a7cbe510d2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 04:00:52 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  1 04:33:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=361706c5

Use non-greedy findConsumers for bug #467896.

This fixes the preserve-libs display and @preserved-rebuild to omit
library consumers that are satisfied by alternative providers.

---
 pym/portage/_sets/libs.py                          |    9 +++++----
 pym/portage/util/_dyn_libs/LinkageMapELF.py        |   18 ++++++++++++------
 .../util/_dyn_libs/display_preserved_libs.py       |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/pym/portage/_sets/libs.py b/pym/portage/_sets/libs.py
index a6433e8..022e076 100644
--- a/pym/portage/_sets/libs.py
+++ b/pym/portage/_sets/libs.py
@@ -1,4 +1,4 @@
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -49,7 +49,8 @@ class LibraryFileConsumerSet(LibraryConsumerSet):
 	def load(self):
 		consumers = set()
 		for lib in self.files:
-			consumers.update(self.dbapi._linkmap.findConsumers(lib))
+			consumers.update(
+				self.dbapi._linkmap.findConsumers(lib, greedy=False))
 
 		if not consumers:
 			return
@@ -77,10 +78,10 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet):
 				for lib in libs:
 					if self.debug:
 						print(lib)
-						for x in sorted(self.dbapi._linkmap.findConsumers(lib)):
+						for x in sorted(self.dbapi._linkmap.findConsumers(lib, greedy=False)):
 							print("    ", x)
 						print("-"*40)
-					consumers.update(self.dbapi._linkmap.findConsumers(lib))
+					consumers.update(self.dbapi._linkmap.findConsumers(lib, greedy=False))
 			# Don't rebuild packages just because they contain preserved
 			# libs that happen to be consumers of other preserved libs.
 			for libs in plib_dict.values():

diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index 8d0c09d..3920f94 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -678,7 +678,7 @@ class LinkageMapELF(object):
 						rValue[soname].add(provider)
 		return rValue
 
-	def findConsumers(self, obj, exclude_providers=None):
+	def findConsumers(self, obj, exclude_providers=None, greedy=True):
 		"""
 		Find consumers of an object or object key.
 
@@ -715,6 +715,9 @@ class LinkageMapELF(object):
 			'/usr/lib/libssl.so.0.9.8'), and return True if the library is
 			owned by a provider which is planned for removal.
 		@type exclude_providers: collection
+		@param greedy: If True, then include consumers that are satisfied
+		by alternative providers, otherwise omit them. Default is True.
+		@type greedy: Boolean
 		@rtype: set of strings (example: set(['/bin/foo', '/usr/bin/bar']))
 		@return: The return value is a soname -> set-of-library-paths, where
 		set-of-library-paths satisfy soname.
@@ -769,16 +772,19 @@ class LinkageMapELF(object):
 		defpath_keys = set(self._path_key(x) for x in self._defpath)
 		satisfied_consumer_keys = set()
 		if soname_node is not None:
-			if exclude_providers is not None:
+			if exclude_providers is not None or not greedy:
 				relevant_dir_keys = set()
 				for provider_key in soname_node.providers:
+					if not greedy and provider_key == obj_key:
+						continue
 					provider_objs = self._obj_properties[provider_key].alt_paths
 					for p in provider_objs:
 						provider_excluded = False
-						for excluded_provider_isowner in exclude_providers:
-							if excluded_provider_isowner(p):
-								provider_excluded = True
-								break
+						if exclude_providers is not None:
+							for excluded_provider_isowner in exclude_providers:
+								if excluded_provider_isowner(p):
+									provider_excluded = True
+									break
 						if not provider_excluded:
 							# This provider is not excluded. It will
 							# satisfy a consumer of this soname if it

diff --git a/pym/portage/util/_dyn_libs/display_preserved_libs.py b/pym/portage/util/_dyn_libs/display_preserved_libs.py
index 238274f..b16478d 100644
--- a/pym/portage/util/_dyn_libs/display_preserved_libs.py
+++ b/pym/portage/util/_dyn_libs/display_preserved_libs.py
@@ -31,7 +31,7 @@ def display_preserved_libs(vardb):
 				if f in consumer_map:
 					continue
 				consumers = []
-				for c in linkmap.findConsumers(f):
+				for c in linkmap.findConsumers(f, greedy=False):
 					# Filter out any consumers that are also preserved libs
 					# belonging to the same package as the provider.
 					if linkmap._obj_key(c) not in internal_plib_keys:


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-01  4:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01  4:35 [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/portage/util/_dyn_libs/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2013-05-01  4:01 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox