libalpm/remove: fix funny progress bar problem with empty packages
$ pacman -Rd kde-meta
Remove (15): kde-meta-kdewebdev-4.5-1 [0.00 MB] kde-meta-kdeutils-4.5-1 [0.00 MB]
kde-meta-kdetoys-4.5-1 [0.00 MB] kde-meta-kdesdk-4.5-1 [0.00 MB]
kde-meta-kdeplasma-addons-4.5-1 [0.00 MB] kde-meta-kdepim-4.5-1 [0.00 MB]
kde-meta-kdenetwork-4.5-1 [0.00 MB] kde-meta-kdemultimedia-4.5-1 [0.00 MB]
kde-meta-kdegraphics-4.5-1 [0.00 MB] kde-meta-kdegames-4.5-1 [0.00 MB]
kde-meta-kdeedu-4.5-1 [0.00 MB] kde-meta-kdebase-4.5-1 [0.00 MB]
kde-meta-kdeartwork-4.5-1 [0.00 MB] kde-meta-kdeadmin-4.5-1 [0.00 MB]
kde-meta-kdeaccessibility-4.5-1 [0.00 MB]
Total Removed Size: 0.06 MB
Do you want to remove these packages? [Y/n]
( 1/15) removing kde-meta-kdewebdev [------------------------] 100%
$ it stopped here..
On one side, libalpm did not initialize the progress bar at 0 percent.
So with meta-packages that have 0 files, there was only one progress bar
call with percent == 100.
On the other side, pacman callback kept track of the last percent that
it received. When there are only meta-packages, we always received only
100, so pacman believed the progress bar needed not update. Thus only
the first package was actually displayed.
A proper fix for the callback would be to keep track of last package
name to make sure the recorded prev percent applies.
But since we now specify that both Add and Remove should at least send
percent=0 at beginning and percent=100 at the end, there is no need
for that.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
1 files changed, 4 insertions, 0 deletions
@@ -414,6 +414,10 @@ int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db) alpm_list_t *newfiles; _alpm_log(PM_LOG_DEBUG, "removing %d files\n", filenum); + /* init progress bar */ + PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 0, + pkg_count, (pkg_count - targcount + 1)); + /* iterate through the list backwards, unlinking files */ newfiles = alpm_list_reverse(files); for(lp = newfiles; lp; lp = alpm_list_next(lp)) { |