summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/_sets/dbapi.py31
-rw-r--r--pym/portage/dbapi/bintree.py5
2 files changed, 36 insertions, 0 deletions
diff --git a/pym/portage/_sets/dbapi.py b/pym/portage/_sets/dbapi.py
index 362cc91c6..ce693c19c 100644
--- a/pym/portage/_sets/dbapi.py
+++ b/pym/portage/_sets/dbapi.py
@@ -209,6 +209,37 @@ class UnavailableSet(EverythingSet):
singleBuilder = classmethod(singleBuilder)
+class UnavailableBinaries(EverythingSet):
+
+ _operations = ('merge', 'unmerge',)
+
+ description = "Package set which contains all installed " + \
+ "packages for which corresponding binary packages " + \
+ "are not available."
+
+ def __init__(self, vardb, metadatadb=None):
+ super(UnavailableBinaries, self).__init__(vardb)
+ self._metadatadb = metadatadb
+
+ def _filter(self, atom):
+ inst_pkg = self._db.match(atom)
+ if not inst_pkg:
+ return False
+ inst_cpv = inst_pkg[0]
+ return not self._metadatadb.cpv_exists(inst_cpv)
+
+ def singleBuilder(cls, options, settings, trees):
+
+ metadatadb = options.get("metadata-source", "bintree")
+ if not metadatadb in trees:
+ raise SetConfigError(_("invalid value '%s' for option "
+ "metadata-source") % (metadatadb,))
+
+ return cls(trees["vartree"].dbapi,
+ metadatadb=trees[metadatadb].dbapi)
+
+ singleBuilder = classmethod(singleBuilder)
+
class CategorySet(PackageSet):
_operations = ["merge", "unmerge"]
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index dca683ee2..e24c2d0bf 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -64,6 +64,11 @@ class bindbapi(fakedbapi):
self.bintree.populate()
return fakedbapi.match(self, *pargs, **kwargs)
+ def cpv_exists(self, cpv):
+ if self.bintree and not self.bintree.populated:
+ self.bintree.populate()
+ return fakedbapi.cpv_exists(self, cpv)
+
def cpv_inject(self, cpv, **kwargs):
self._aux_cache.pop(cpv, None)
fakedbapi.cpv_inject(self, cpv, **kwargs)