diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-05-27 16:19:14 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-05-27 16:19:14 +0300 |
commit | 2165547badcc26be1a0fcb2944f11c0bfea25d8a (patch) | |
tree | 57a45244b6f210f08afcb188ecaf98e4089589f3 | |
parent | 4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03 (diff) | |
download | apk-tools-2165547badcc26be1a0fcb2944f11c0bfea25d8a.tar.gz apk-tools-2165547badcc26be1a0fcb2944f11c0bfea25d8a.tar.bz2 apk-tools-2165547badcc26be1a0fcb2944f11c0bfea25d8a.tar.xz apk-tools-2165547badcc26be1a0fcb2944f11c0bfea25d8a.zip |
state: modify reinstallation prints
To print upgrading if package is actually being changed instead of
pure reinstall.
-rw-r--r-- | src/state.c | 19 |
1 files changed, 11 insertions, 8 deletions
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; } |