From e3edde79ba4ccf903434812328a00308452bcd72 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 22 Nov 2008 21:58:37 +0000 Subject: Add new @unavailable package set which contains all installed packages for which there are no visible ebuilds corresponding to the same $CATEGORY/$PN:$SLOT. svn path=/main/trunk/; revision=12043 --- cnf/sets.conf | 8 ++++---- doc/config/sets.docbook | 15 +++++++++++++++ pym/portage/sets/dbapi.py | 27 +++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/cnf/sets.conf b/cnf/sets.conf index 84f6a6e62..36e2f7f45 100644 --- a/cnf/sets.conf +++ b/cnf/sets.conf @@ -59,8 +59,8 @@ class = portage.sets.dbapi.OwnerSet world-candidate = False files = /lib/modules -# Installed packages for which the highest visible ebuild -# version is lower than the currently installed version. -[downgrade] -class = portage.sets.dbapi.DowngradeSet +# Installed packages for which there are no visible ebuilds +# corresponding to the same $CATEGORY/$PN:$SLOT. +[unavailable] +class = portage.sets.dbapi.UnavailableSet world-candidate = False diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook index d993024bd..dc26b1a0c 100644 --- a/doc/config/sets.docbook +++ b/doc/config/sets.docbook @@ -522,6 +522,20 @@ + + portage.sets.dbapi.UnavailableSet + + Package set which contains all installed + packages for which there are no visible ebuilds + corresponding to the same $CATEGORY/$PN:$SLOT. + This class supports the following options: + + metadata-source: Optional, defaults to + "porttree". Specifies the repository to use for getting the metadata + to check. + + + portage.sets.dbapi.DowngradeSet @@ -571,6 +585,7 @@ live-rebuild: uses VariableSet module-rebuild: uses OwnerSet downgrade: uses DowngradeSet + unavailable: uses UnavailableSet Additionally the default configuration includes a multi set section based on the StaticFileSet defaults that creates a set for each diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index 877c45cee..65d05a2ae 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -179,6 +179,33 @@ class DowngradeSet(PackageSet): singleBuilder = classmethod(singleBuilder) +class UnavailableSet(EverythingSet): + + _operations = ["unmerge"] + + description = "Package set which contains all installed " + \ + "packages for which there are no visible ebuilds " + \ + "corresponding to the same $CATEGORY/$PN:$SLOT." + + def __init__(self, vardb, metadatadb=None): + super(UnavailableSet, self).__init__(vardb) + self._metadatadb = metadatadb + + def _filter(self, atom): + return not self._metadatadb.match(atom) + + def singleBuilder(cls, options, settings, trees): + + metadatadb = options.get("metadata-source", "porttree") + 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"] -- cgit v1.2.3-1-g7c22