pacman/src
Xavier Chantry 44a57c890b callback.c : fallback to normal download with bogus size
When using totaldownload, we might get into some weird situations where
xfered>total because of bogus CSIZE database entries.

This code adds a sanity check and fallbacks to normal download progress if
needed.

Here is an example using totaldownload on a database with wrong CSIZE, for a
total download of ~26 MB.

Before :

 gnome-desktop-2.28....  1144,3K  678,3K/s 00:00:02 [#################]   4%
 gnome-panel-2.28.0-...     4,2M  887,7K/s 00:00:05 [#################]  16%
 gnome-applets-2.28....    13,6M 1083,0K/s 00:00:13 [#################]  52%
 gnome-backgrounds-2...    22,9M  964,0K/s 00:00:24 [#################]  87%
 gnome-settings-daem...    23,6M  938,5K/s 00:00:26 [#################]  90%
 gnome-control-cente...    26,1M  946,1K/s 00:00:28 [#################] 100%
 gnome-icon-theme-2....    27,7M 1465,0K/s 1193046:28:15 [#######----------] gnome-icon-theme-2....    28,0M 1502,2K/s 1193046:28:15 [########---------] gnome-icon-theme-2....    28,4M 1582,2K/s 1193046:28:15 [##########-------] gnome-icon-theme-2....    28,7M 1603,4K/s 1193046:28:15 [############-----] gnome-icon-theme-2....    29,0M 1604,5K/s 1193046:28:15 [##############---] gnome-icon-theme-2....    29,3M 1621,0K/s 1193046:28:14 [################-] gnome-icon-theme-2....    29,6M 1434,8K/s 1193046:28:14 [#################] gnome-icon-theme-2....    29,6M  974,2K/s 00:00:31 [#################] 113%

After :

 gnome-desktop-2.28....  1144,3K 1038,7K/s 00:00:01 [#################]   4%
 gnome-panel-2.28.0-...     4,2M  988,4K/s 00:00:04 [#################]  16%
 gnome-applets-2.28....    13,6M 1190,4K/s 00:00:12 [#################]  52%
 gnome-backgrounds-2...    22,9M 1242,9K/s 00:00:19 [#################]  87%
 gnome-settings-daem...    23,6M 1193,9K/s 00:00:20 [#################]  90%
 gnome-control-cente...     2,5M 1347,4K/s 00:00:02 [#################] 100%
 gnome-icon-theme-2....     3,5M 1205,4K/s 00:00:03 [#################] 100%

Note that gnome-control-center resetted to normal progress mode
(2,5M is the package size, not the total size)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-04 09:32:02 -05:00
..
pacman callback.c : fallback to normal download with bogus size 2009-10-04 09:32:02 -05:00
util testdb : less verbose 2009-08-18 20:42:29 -05:00