diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-11-22 21:58:37 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-11-22 21:58:37 +0000 |
commit | e3edde79ba4ccf903434812328a00308452bcd72 (patch) | |
tree | 9f84a3abf642278a2b20f66d9dc1f33395e8d4ef | |
parent | 7084ae3b52fbf81b3b452cfa6f5de2a05ecedd69 (diff) | |
download | portage-e3edde79ba4ccf903434812328a00308452bcd72.tar.gz portage-e3edde79ba4ccf903434812328a00308452bcd72.tar.bz2 portage-e3edde79ba4ccf903434812328a00308452bcd72.zip |
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
-rw-r--r-- | cnf/sets.conf | 8 | ||||
-rw-r--r-- | doc/config/sets.docbook | 15 | ||||
-rw-r--r-- | 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 @@ </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> @@ -571,6 +585,7 @@ <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 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"] |