[packagekit] Time to search for a file in the yum backend
Tim Lauridsen
tim.lauridsen at googlemail.com
Thu Jan 31 23:22:20 PST 2008
Tim Lauridsen wrote:
> Richard Hughes wrote:
>> It seems to take a long time to search for a file in the yum backend:
>>
>> [hughsie at hughsie-laptop PackageKit]$ time rpm -qf /usr/share/applications/gnome-ekiga.desktop
>> ekiga-2.0.11-1.fc8
>>
>> real 0m0.091s
>> user 0m0.026s
>> sys 0m0.005s
>> [hughsie at hughsie-laptop PackageKit]$ pkcon search file /usr/share/applications/gnome-ekiga.desktop
>> installed ekiga i386 2.0.11-1.fc8 installed A Gnome based SIP/H323 teleconferencing application
>> search-file runtime was 73.0 seconds
>>
>> Surely we can just check the rpmdb before we check the repos? checking
>> the rpmdb ~ 1 second, checking using yum takes over 1 minute.
>>
>> Thanks.
>>
>> Richard.
>>
>>
>> _______________________________________________
>> PackageKit mailing list
>> PackageKit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/packagekit
>
> try to run
> sudo ./search-file.py none /usr/share/applications/gnome-ekiga.desktop
> in the yum helper dir.
> The you will see what is going on.
> the install pkg will be signaled pretty fast, and if metadata is upto
> date, the the available pkg will be returned in a couple of sec, but the
> the search continues for a while before completing.
>
> It sucks, it is done in a very basic way.
>
> for pkg in all_pkg:
> for f in pkg.filelist:
> if f == match:
> signal pkg
>
> This it not the fastest way in the world :)
>
> It shall be remade to use some of the yum provide command it will be
> much faster. I give it a try.
>
> Tim
> _______________________________________________
> PackageKit mailing list
> PackageKit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/packagekit
Ok, that was a real easy one to fix.
now the code look something like this
#search installed
matches = self.yumbase.rpmdb.searchFiles(match)
for pkg in matches:
signal pkg
#search available
matches = self.yumbase.pkgSack.searchFiles(match)
for pkg in matches:
signal pkg
Much faster
Tim.
More information about the PackageKit
mailing list