keep installed packages with unchanged version/release (#162972)
authorKlaus Kaempf <kkaempf@suse.de>
Tue, 4 Apr 2006 14:35:12 +0000 (14:35 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Tue, 4 Apr 2006 14:35:12 +0000 (14:35 +0000)
zypp/solver/detail/ResolverUpgrade.cc

index 6b9a8442243762122a5826c9054dcfc25b137e41..0c6d7d1d2bbfa15e7dd12e8cdbfd0d073d0d29c8 100644 (file)
@@ -438,18 +438,20 @@ MIL << "split matched !" << endl;
       PoolItem_Ref candidate (cand_it->second);
 
       if ( ! candidate.status().isToBeInstalled() ) {
-
-       if ( installed->edition().compare (candidate->edition()) < 0 ) {        // new edition
+       int cmp = installed->edition().compare( candidate->edition() );
+       if ( cmp < 0 ) {                                                // new edition
          candidate.status().setToBeInstalled(ResStatus::APPL_HIGH);
          MIL << " ==> INSTALL (new version): " << candidate << endl;
          ++opt_stats_r.chk_to_update;
-       } else {                                                                // older or equal edition
+       } else {                                                        // older or equal edition
          // check whether to downgrade:
 
-         if (!downgrade_allowed (installed, candidate, target)) {
-           MIL << " ==> (keep installed)" << candidate << endl;
+         if (cmp == 0                                                  // equal
+             || !downgrade_allowed (installed, candidate, target))     //  or downgrade not allowed
+         {     
+           MIL << " ==> (keep installed)" << candidate << endl;        // keep installed
            ++opt_stats_r.chk_to_keep_installed;
-         } else {
+         } else {                                                      // older and downgrade allowed
            candidate.status().setToBeInstalled(ResStatus::APPL_HIGH);
            MIL << " ==> INSTALL (SuSE version downgrade): " << candidate << endl;
            ++opt_stats_r.chk_to_downgrade;