[packagekit] yum backend ordering problem

Richard Hughes hughsient at gmail.com
Sun Oct 14 10:02:21 PDT 2007


Guys:

[madcat at colibri ~]$ /usr/share/PackageKit/helpers/yum/search-name.py none power
package available	kadu-powerkadu;0.5.0-4.fc8;i386;fedora  Powerkadu module for Kadu
package installed	powertop;1.8-1.fc8;i386;installed	Power consumption monitor
package available	gnome-power-manager;2.20.0-1.90.20071013svn.fc7.hughsie;i386;utopia     GNOME Power Manager
package available	gnome-power-manager-debuginfo;2.20.0-1.90.20071013svn.fc7.hughsie;i386;utopia   Debug information for package gnome-power-manager
package available	kpowersave;0.7.3-0.2svn20070828.fc8;i386;development    KPowersave is the KDE frontend for powermanagement
package available	powerman;1.0.25-2.fc7;i386;fedora	PowerMan - Power to the Cluster
package available	powermanga;0.90-1;i386;fedora   Arcade 2D shoot-them-up game
package available	kpowersave;0.7.3-0.2svn20070828.fc8;i386;fedora KPowersave is the KDE frontend for powermanagement
package available	gnome-power-manager;2.20.0-5.fc8;i386;fedora    GNOME Power Manager
package available	powertop;1.8-1.fc8;i386;fedora  Power consumption monitor
package installed	gnome-power-manager;2.20.0-5.fc8;i386;installed GNOME Power Manager
package available	powerman;1.0.25-2.fc7;i386;development  PowerMan - Power to the Cluster
package available	gnome-power-manager;2.20.0-5.fc8;i386;development	GNOME Power Manager
package available	powertop;1.8-1.fc8;i386;development     Power consumption monitor
package available	kadu-powerkadu;0.5.0-4.fc8;i386;development     Powerkadu module for Kadu
package available	powermanga;0.90-1;i386;development      Arcade 2D shoot-them-up game

The _do_search method has to return the installed packages _first_ and
then the available packages. This is done so we can filter on the
packages without the data so we don't show each installed package twice.

The code in question is:

        count = 1
        for (pkg,values) in res:
            if count > 100:
                break
            count+=1
            # are we installed?
            if pkg.repoid == 'installed':
                installed = INFO_INSTALLED
            else:
                installed = INFO_AVAILABLE

            if self._do_filtering(pkg,fltlist,installed):
                self._show_package(pkg, installed)

I naively wanted to make this:

        count = 1
        for (pkg,values) in res:
            if count > 100:
                break
            count+=1
            # are we installed?
            if pkg.repoid == 'installed':
                if self._do_filtering(pkg,fltlist,INFO_INSTALLED):
                    self._show_package(pkg, INFO_INSTALLED)

        count = 1
        for (pkg,values) in res:
            if count > 100:
                break
            count+=1
            # are we available?
            if pkg.repoid != 'installed':
                if self._do_filtering(pkg,fltlist,INFO_AVAILABLE):
                    self._show_package(pkg, INFO_AVAILABLE)

But this doesn't work - I guess the _do_filtering is modifying the list.
My python skills are weak, so help needed please. This needs to be fixed
before the release.

Richard.





More information about the PackageKit mailing list