summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-12 07:16:18 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-12 07:16:18 +0000
commita0103e1e7e4a419d6e24f9dc8df0d3a66e6c3cbb (patch)
tree31fb2a703cc1605476cfc1243a5813162f5d7cd5
parentBug #265768 - Handle CacheError when deleting currupt cache inside (diff)
downloadportage-multirepo-a0103e1e7e4a419d6e24f9dc8df0d3a66e6c3cbb.tar.gz
portage-multirepo-a0103e1e7e4a419d6e24f9dc8df0d3a66e6c3cbb.tar.bz2
portage-multirepo-a0103e1e7e4a419d6e24f9dc8df0d3a66e6c3cbb.zip
Add a LibraryFileConsumerSet class that can be used to rebuild all packages
that consume one or more given files. Note: This does not detect libtool archive (*.la) files that consume the specified files (revdep-rebuild is able to detect them). svn path=/main/trunk/; revision=13333
-rw-r--r--pym/portage/sets/libs.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/pym/portage/sets/libs.py b/pym/portage/sets/libs.py
index 3722c846..1c5067eb 100644
--- a/pym/portage/sets/libs.py
+++ b/pym/portage/sets/libs.py
@@ -22,6 +22,39 @@ class LibraryConsumerSet(PackageSet):
rValue.add("%s/%s:%s" % (cat, pn, slot))
return rValue
+class LibraryFileConsumerSet(LibraryConsumerSet):
+
+ """
+ Note: This does not detect libtool archive (*.la) files that consume the
+ specified files (revdep-rebuild is able to detect them).
+ """
+
+ description = "Package set which contains all packages " + \
+ "that consume the specified library file(s)."
+
+ def __init__(self, vardbapi, files, **kargs):
+ super(LibraryFileConsumerSet, self).__init__(vardbapi, **kargs)
+ self.files = files
+
+ def load(self):
+ consumers = set()
+ for lib in self.files:
+ consumers.update(self.dbapi.linkmap.findConsumers(lib))
+
+ if not consumers:
+ return
+ self._setAtoms(self.mapPathsToAtoms(consumers))
+
+ def singleBuilder(cls, options, settings, trees):
+ import shlex
+ files = tuple(shlex.split(options.get("files", "")))
+ if not files:
+ raise SetConfigError("no files given")
+ debug = get_boolean(options, "debug", False)
+ return LibraryFileConsumerSet(trees["vartree"].dbapi,
+ files, debug=debug)
+ singleBuilder = classmethod(singleBuilder)
+
class PreservedLibraryConsumerSet(LibraryConsumerSet):
def load(self):
reg = self.dbapi.plib_registry
@@ -48,5 +81,6 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet):
def singleBuilder(cls, options, settings, trees):
debug = get_boolean(options, "debug", False)
- return PreservedLibraryConsumerSet(trees["vartree"].dbapi, debug)
+ return PreservedLibraryConsumerSet(trees["vartree"].dbapi,
+ debug=debug)
singleBuilder = classmethod(singleBuilder)