[packagekit] Canceling background transaction

Zhang, Qiang Z qiang.z.zhang at intel.com
Tue Mar 15 00:41:28 PDT 2011

>> I'm proposing we cancel non-interactive tasks if an interactive task
>> is present.
>That would be really nice. I have hit this issue before and wanted to jump to the front of the queue.
Very great!

>> It'll be up to the session program to reschedule the
>> non-interactive task when convenient. This would mean special casing
>> the ErrorCode of CANCELLED_PRIORITY (better names welcomed) and just
>> rescheduling the action straight away. In the case of packagekit-glib,
>> this would be automatic.
>> Comments?

>What about extending this idea to include the SuggestDaemonQuit dbus method. The use case is that when someone tries to manually use the native package management tool (in our case via libzypp) we make this call and it works great if packagekitd is in idle mode. However we still get semi frequent complaints when a user tries a manual native command and a background task is using the packagekitd daemon so it won't quit. Essentially the same logical scenario as above - we still lock out the user for a background task that could be run later.
>Could SuggestDaemonQuit check for only non-interactive transactions running and if so cancel them and exit. Then also instead of having the session program immediately reschedule the action, delay a short while and then reschedule (ie a couple minutes to give the user a chance to finish their manual work).

This ideal need support of backend, so if backend does not support cancel, this still can't work well.
AFAIK, zypp backend can't support cancel feature, and zypp is wrote in c++ and launch a thread for most of operations, so it's not very easy to implement cancel. Aptcc backend is also written in c++ and only support cancel for install/download/remove operations.

Cancel operations is very important in Package Management, so could we discuss how to implement cancel for backends which don't use PkBackendSpawn, such as zypp, apt, etc.

I have reviewed the implementation of aptcc, and have wrote a raw patch for zypp to implement cancel for download/install packages. In this patch, I put core code in an process, which is forked in a thread, and I remember the sub process ID, and once user want to cancel a transaction, we can simply call ' kill (child_pid, SIGINT)' to kill the sub process.

Any other good way to implement cancel operation for backends?


PackageKit mailing list
PackageKit at lists.freedesktop.org

More information about the PackageKit mailing list