Rework package removal code
commit6b29374a60e1568ba626b88ca1b1da915ca0a438
authorDan McGee <dan@archlinux.org>
Fri, 23 Dec 2011 16:12:08 +0000 (23 10:12 -0600)
committerDan McGee <dan@archlinux.org>
Fri, 23 Dec 2011 20:37:03 +0000 (23 14:37 -0600)
tree23df40b76e5c11bb9faefb6d21a2d3438e04b2c9
parent92216c5864efccacf2daa3f4f15de3bb479054bb
Rework package removal code

Extract the actual unlinking of files into a new method, which
eliminates a goto used for flow control. Also fix up a few small issues
in the code:

* Unnecessary (unsigned long) cast, use '%zd' instead
* Total up errors returned from unlink_file calls and return to caller
* Be consistent with scriptlets- we run pre_remove on dbonly, so we
  should also run post_remove. Both can be disabled by way of the
  --noscriptlet argument.
* Don't pass an invalid pointer to oldpkg to the event callbacks;
  instead call the callback before we free the object.

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/remove.c