[packagekit] PackageKit Apt backend

Sebastian Heinlein glatzor at ubuntu.com
Wed Oct 17 08:52:22 PDT 2007


Am Mittwoch, den 17.10.2007, 16:15 +0200 schrieb Tom Parker: 
> On 17/10/2007, Sebastian Heinlein <glatzor at ubuntu.com> wrote:
> > I just made a rough look at the current apt backend of PackageKit, I was
> > wondering why you use sqlite to create another package cache? Are the
> > speed improvements so dramatically?
> 
> Yes, the speed improvements are dramatic. The problem is that
> PackageKit currently loads and unloads the backends for each task.
> Major reason for this is to remove as much of the task management
> stuff from backends as possible - they are created purely for a single
> task, and they can avoid having to deal with multiple tasks running at
> the same time, which is all dealt with by the PackageKit core.
> 
> The problem is that libapt (which I was using before) has to do a
> *vast* amount of text parsing (sifting through everything in
> /var/lib/apt/lists) every time it initialises which means there's a
> 2-3 second delay (even on my pretty fast machine) before we can even
> start thinking about performing a query, and for searches this is
> annoying. The sqlite cache drops this to <1s (~0.7s on my system
> currently, but there's probably optimisations still available), which
> makes cool things like find-as-you-type feasible.

You can avoid opening the dependency cache even in the python bindings:

#!/usr/bin/env python
import apt_pkg
from apt.progress import OpProgress

searchTerm = "xterm"

progress = OpProgress()
cache = apt_pkg.GetCache(progress)

for pkg in cache.Packages:
    if pkg.Name == searchTerm:
        print pkg.Name 

The time output running the whole python script:

real    0m0.551s
user    0m0.504s
sys     0m0.036s

Additionally find as you type searches should always have got a short delay
before performing the search. So if we take a dealy of an half second we
would end up with a response time of about one second. That seems to be ok.

> * do get_depends (which may involve designing a simple package
> resolver - which should not delete anything - again with the simple
> cases. If you can't resolve without deleting, fail)

There is no need to reinvent the whell. Take a look at
apt.cache.Cache._depcache.DelCount after marking your changes.
Furthermore AppInstall.AppInstall.tryInstall() of gnome-app-install my
provide a good base.

> > Furthermore we are going to discuss the implementation of PackageKit at
> > our next UDS in Boston:
> >
> > https://wiki.ubuntu.com/PackageKit
> 
> Funky. I'm currently resident in the Netherlands, so I can't be along
> for that [...]

I think that there will be a way to attend the session using VoIP.

Cheers,

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.freedesktop.org/archives/packagekit/attachments/20071017/0af39cdc/attachment.pgp 


More information about the PackageKit mailing list