[packagekit] Callbacks on script completion/task finish

Tom Parker palfrey at tevp.net
Tue Nov 20 05:22:18 PST 2007


I'm possibly attacking this one from the wrong direction, so let's see
if anyone else has a better idea. What I want to do is be able to run
a python script that updates the apt cache (which we've already got)
and once that's finished, call a C function that does something with
the updated cache e.g. make a secondary sqlite cache from the updated
primary cache.

Got a few ideas about how to do this, all of which have problems
1) Write my own version of pk_backend_spawn_helper that calls my C
function when we get the finished signal, before doing all the tidy-up
stuff. Can possibly be made less awful by re-using as many of the
little functions in pk-backend.c as possible.
2) Add another argument to pk_backend_spawn_helper.
3) Add some form of "callback-on-finish" support, either to
pk_backend_finished or to pk_backend_spawn_finished_cb
4) Figure out how to implement the C function in python, and just get
the update script to call that (but that will be pretty slow for the
stuff I might want to do in C).

Any thoughts here? Is this sort of thing useful to any other backend writers?

Tom



More information about the PackageKit mailing list