Please read the http://frugalware.org/docs/bugs page if you are new to bugreporting!
FS#2598 - libpacman support for cancelling downloading of packages
Attached to Project:
Frugalware
Opened by Priyank (priyank) - Saturday, 24 November 2007, 20:49 GMT+2
Last edited by Priyank (priyank) - Saturday, 24 November 2007, 20:50 GMT+2
Opened by Priyank (priyank) - Saturday, 24 November 2007, 20:49 GMT+2
Last edited by Priyank (priyank) - Saturday, 24 November 2007, 20:50 GMT+2
|
DetailsIt would be good to have some kind of functionality in the libpacman library to cancel fetching of a package. This is very useful (and needed) for a frontend like Gfpm where the user might want to cancel the process of fetching the packages from the servers.
|
This task depends upon
here is how it is possible to interrupt a download.
first call pacman_trans_release(), that'll give you a PM_ERR_TRANS_DOWNLOADING error. that means the following:
1) a download was in progress
2) you should return 0 (it means an error there) in the download callback next time.
then pacman_trans_commit() will return with a PM_ERR_RETRIEVE error, and you can call pacman_trans_release() which will return no error.
if something is not obvious, here are the two relevant commits from pacman-g2.git:
libpacman change (not too interesting):
http://frugalware.org/pipermail/frugalware-git/2008-April/010388.html
pacman-g2 change (you should do something like this):
http://frugalware.org/pipermail/frugalware-git/2008-April/010387.html
feel free to close this bug once it works in gfpm as well :)
Because of this, pacman_trans_commit() never returns, and eventually, it doesn't work.
$ sudo ./pacman-g2 -Sccw kernel-source
Do you want to remove all packages from cache? [Y/n]
removing all packages from cache... done.
resolving dependencies... done.
Targets: kernel-source-2.6.24-5
Total Package Size: 43.3 MB
Total Uncompressed Package Size: 243.1 MB
Proceed with download? [Y/n]
:: Retrieving packages from frugalware-current...
(1/1) kernel-source-2.6. [######## ] 54% 24112K 0.0K/s 00:00:00
[14:46:42] warning: failed to retrieve some files from frugalware-current
error: failed to commit transaction (coult not retrieve the file)
errors occurred, no packages were upgraded.
so pacman_trans_commit() returns PM_ERR_RETRIEVE after i return 0 in the callback.
how does this work in gfpm? do you have a callback function when the user presses the "cancel" button and then you set some variable to let the download callback know about it should return 0?
thanks