summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-10-11 05:59:11 +0000
committerMarius Mauch <genone@gentoo.org>2007-10-11 05:59:11 +0000
commit59daf6587b10d068c3427b657ebb21857bb9dac6 (patch)
treea6f8d7588e14eb00b10e6d1b67b300fb4d1ad6ea
parent86c8ae497f9a82fa976db5e1ffbd71f250d11ca1 (diff)
downloadportage-59daf6587b10d068c3427b657ebb21857bb9dac6.tar.gz
portage-59daf6587b10d068c3427b657ebb21857bb9dac6.tar.bz2
portage-59daf6587b10d068c3427b657ebb21857bb9dac6.zip
Add a set to group all consumers of missing libraries as a simple revdep-rebuild replacement
svn path=/main/trunk/; revision=8046
-rw-r--r--pym/portage/sets/__init__.py2
-rw-r--r--pym/portage/sets/dbapi.py56
2 files changed, 45 insertions, 13 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index 124e68924..dc281dea3 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -268,7 +268,7 @@ def make_default_config(settings, trees):
sc.set("user-sets", "multiset", "true")
sc.add_section("rebuild-needed")
- sc.set("rebuild-needed", "class", "portage.sets.dbapi.PreservedLibraryConsumerSet")
+ sc.set("rebuild-needed", "class", "portage.sets.dbapi.MissingLibraryConsumerSet")
return sc
diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py
index ed333ce00..fbff27054 100644
--- a/pym/portage/sets/dbapi.py
+++ b/pym/portage/sets/dbapi.py
@@ -5,6 +5,7 @@
from portage.versions import catsplit, catpkgsplit
from portage.sets import PackageSet, SetConfigError
from portage.dbapi.vartree import dblink
+from portage.util import grabfile
import os
@@ -109,32 +110,63 @@ class CategorySet(PackageSet):
return rValue
multiBuilder = classmethod(multiBuilder)
-class PreservedLibraryConsumerSet(PackageSet):
+class LibraryConsumerSet(PackageSet):
_operations = ["merge", "unmerge"]
-
+
def __init__(self, vardbapi):
- super(PreservedLibraryConsumerSet, self).__init__()
+ super(LibraryConsumerSet, self).__init__()
self.dbapi = vardbapi
+
+ def mapPathsToAtoms(self, paths):
+ rValue = set()
+ for cpv in self.dbapi.cpv_all():
+ mysplit = catsplit(cpv)
+ link = dblink(mysplit[0], mysplit[1], myroot=self.dbapi.root, \
+ mysettings=self.dbapi.settings, treetype='vartree', \
+ vartree=self.dbapi.vartree)
+ if paths.intersection(link.getcontents().keys()):
+ rValue.add("/".join(catpkgsplit(cpv)[:2]))
+ return rValue
+
+class PreservedLibraryConsumerSet(LibraryConsumerSet):
def load(self):
reg = self.dbapi.plib_registry
libmap = self.dbapi.libmap.get()
- atoms = set()
consumers = set()
if reg:
for libs in reg.getPreservedLibs().values():
for lib in libs:
paths = libmap.get(os.path.basename(lib), [])
consumers.update(paths)
- for cpv in self.dbapi.cpv_all():
- mysplit = catsplit(cpv)
- link = dblink(mysplit[0], mysplit[1], myroot=self.dbapi.root, \
- mysettings=self.dbapi.settings, treetype='vartree', \
- vartree=self.dbapi.vartree)
- if consumers.intersection(link.getcontents().keys()):
- atoms.add("/".join(catpkgsplit(cpv)[:2]))
- self._setAtoms(atoms)
+ else:
+ return
+ if not consumers:
+ return
+ self._setAtoms(self.mapPathsToAtoms(consumers))
def singleBuilder(cls, options, settings, trees):
return PreservedLibraryConsumerSet(trees["vartree"].dbapi)
singleBuilder = classmethod(singleBuilder)
+
+class MissingLibraryConsumerSet(LibraryConsumerSet):
+ _operations = ["merge", "unmerge"]
+
+ def load(self):
+ atoms = set()
+ consumers = set()
+ for lib in self.dbapi.libmap.get():
+ found=False
+ for searchdir in grabfile(os.path.join(os.sep, self.dbapi.root, "etc/ld.so.conf")):
+ if os.path.exists(os.path.join(searchdir, lib)):
+ found=True
+ break
+ if not found:
+ consumers.update(self.dbapi.libmap.get()[lib])
+ if not consumers:
+ return
+ self._setAtoms(self.mapPathsToAtoms(consumers))
+
+ def singleBuilder(cls, options, settings, trees):
+ return MissingLibraryConsumerSet(trees["vartree"].dbapi)
+ singleBuilder = classmethod(singleBuilder)