diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-05-27 16:01:29 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-05-27 16:01:29 +0300 |
commit | 4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03 (patch) | |
tree | b21db8657b0ac0773c2ec37ecf90bcc7253a6e60 | |
parent | 4a21764ee110c46dea75be85eb7a55cd60fab819 (diff) | |
download | apk-tools-4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03.tar.gz apk-tools-4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03.tar.bz2 apk-tools-4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03.tar.xz apk-tools-4fde5f101ad7a11dbbcdf855b8b2053aa9f8fa03.zip |
state: show changed packages as upgrades
If version is equal, but package contents are different we should
show the package being upgraded.
-rw-r--r-- | src/state.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c index 9204228..37c29e5 100644 --- a/src/state.c +++ b/src/state.c @@ -689,10 +689,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; - if (apk_pkg_version_compare(change->newpkg, change->oldpkg) - & APK_VERSION_GREATER) + 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)) return 1; return 0; } |