Add new @unavailable package set which contains all installed
authorZac Medico <zmedico@gentoo.org>
Sat, 22 Nov 2008 21:58:37 +0000 (21:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 22 Nov 2008 21:58:37 +0000 (21:58 -0000)
packages for which there are no visible ebuilds corresponding
to the same $CATEGORY/$PN:$SLOT.

svn path=/main/trunk/; revision=12043

cnf/sets.conf
doc/config/sets.docbook
pym/portage/sets/dbapi.py

index 84f6a6e6201cdc7032ad508116df32ca1d7332a7..36e2f7f45cb084eaf8525fae91cf4b715dd1138f 100644 (file)
@@ -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
index d993024bd392151fe8caf13fe0b7673226e4f529..dc26b1a0c80665a6345ee2743d825d591ffdf222 100644 (file)
                </itemizedlist>
                </para>
                </sect2>
+               <sect2 id='config-set-classes-UnavailableSet'>
+               <title>portage.sets.dbapi.UnavailableSet</title>
+               <para>
+               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:
+               <itemizedlist>
+               <listitem><varname>metadata-source</varname>: Optional, defaults to
+               "porttree". Specifies the repository to use for getting the metadata
+               to check.</listitem>
+               </itemizedlist>
+               </para>
+               </sect2>
                <sect2 id='config-set-classes-DowngradeSet'>
                <title>portage.sets.dbapi.DowngradeSet</title>
                <para>
        <listitem><varname>live-rebuild</varname>: uses <classname>VariableSet</classname></listitem>
        <listitem><varname>module-rebuild</varname>: uses <classname>OwnerSet</classname></listitem>
        <listitem><varname>downgrade</varname>: uses <classname>DowngradeSet</classname></listitem>
+       <listitem><varname>unavailable</varname>: uses <classname>UnavailableSet</classname></listitem>
        </itemizedlist>
        Additionally the default configuration includes a multi set section based on
        the <classname>StaticFileSet</classname> defaults that creates a set for each 
index 877c45ceeca36b2856f0bf20fe811b546208003d..65d05a2aefe8572dea1f6d6982eadc5aa56f10f8 100644 (file)
@@ -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"]