From 2165547badcc26be1a0fcb2944f11c0bfea25d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 27 May 2010 16:19:14 +0300 Subject: state: modify reinstallation prints To print upgrading if package is actually being changed instead of pure reinstall. --- src/state.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/state.c b/src/state.c index 37c29e5..f0561b6 100644 --- a/src/state.c +++ b/src/state.c @@ -569,8 +569,12 @@ static void apk_print_change(struct apk_database *db, msg = "Downgrading"; break; case APK_VERSION_EQUAL: - msg = "Re-installing"; - break; + if (newpkg == oldpkg) { + msg = "Re-installing"; + break; + } + /* fallthrough - equal version, but different + * package is counted as upgrade */ case APK_VERSION_GREATER: msg = "Upgrading"; break; @@ -689,19 +693,18 @@ static int cmp_downgrade(struct apk_change *change) static int cmp_upgrade(struct apk_change *change) { - int t; - if (change->newpkg == NULL || change->oldpkg == NULL) return 0; - t = apk_pkg_version_compare(change->newpkg, change->oldpkg); - if (t & APK_VERSION_GREATER) - return 1; + /* Count swapping package as upgrade too - this can happen if * same package version is used after it was rebuilt against * newer libraries. Basically, different (and probably newer) * package, but equal version number. */ - if ((t & APK_VERSION_EQUAL) && (change->newpkg != change->oldpkg)) + if ((apk_pkg_version_compare(change->newpkg, change->oldpkg) & + (APK_VERSION_GREATER | APK_VERSION_EQUAL)) && + (change->newpkg != change->oldpkg)) return 1; + return 0; } -- cgit v1.2.3