summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2008-12-15 00:01:25 +0000
committerJason Woodward2008-12-15 00:01:25 +0000
commitbf022cccab63d64f3d1e32b261d032676dd517d6 (patch)
treed83200e67990c5e3e9452a20d735c600aa85f78b
parent42173b7f4c38769a4bde2606ffb3e44898634408 (diff)
downloadgslapt-bf022cccab63d64f3d1e32b261d032676dd517d6.tar.gz
determine possible downgrades even with respect to priorities and allow the package action menu to provide a downgrade option
-rw-r--r--ChangeLog2
-rw-r--r--src/callbacks.c24
2 files changed, 15 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 3acecef..8bfc3e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
0.5.1 Dec 14, 2008
+ * determine possible downgrades even with respect to priorities and allow
+ the package action menu to provide a downgrade option
* better status labels in the package description when upgrading, installing,
reinstalling, and dowgrading packages
* updated for libslapt 0.10.1 compatibility
diff --git a/src/callbacks.c b/src/callbacks.c
index fbd9e96..f35c7da 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -2878,21 +2878,23 @@ static void build_package_action_menu (slapt_pkg_info_t *pkg)
if (slapt_get_exact_pkg(all,pkg->name,pkg->version) != NULL)
is_downloadable = 1;
- newest_installed = slapt_get_newest_pkg(installed,pkg->name);
- if (newest_installed != NULL && slapt_cmp_pkgs(pkg,newest_installed) < 0) {
- is_downgrade = 1;
- } else if (newest_installed != NULL && slapt_cmp_pkgs(pkg,newest_installed) == 0) {
- /*
- maybe this isn't the exact installed package, but it's different enough
- to warrant reinstall-ability
- */
- is_installed = 1;
- }
-
upgrade_pkg = slapt_get_newest_pkg(all,pkg->name);
if (upgrade_pkg != NULL && slapt_cmp_pkgs(pkg,upgrade_pkg) < 0)
is_newest = 0;
+ if ((newest_installed = slapt_get_newest_pkg(installed,pkg->name)) != NULL) {
+ /* if pkg is not the newest available version and the version is actually
+ less (disregarding priority) then we consider this a downgrade */
+ if (is_newest == 0 && slapt_cmp_pkg_versions(pkg->version,newest_installed->version) < 0) {
+ is_downgrade = 1;
+ } else if (slapt_cmp_pkgs(pkg,newest_installed) == 0) {
+ /* maybe this isn't the exact installed package, but it's different enough
+ to warrant reinstall-ability... it is questionable if this is ever
+ reached */
+ is_installed = 1;
+ }
+ }
+
if ( slapt_is_excluded(global_config,pkg) == 1
|| slapt_get_exact_pkg(trans->exclude_pkgs,pkg->name,pkg->version) != NULL) {
is_exclude = 1;