]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
* debian/changelog: updated credits
[apt.git] / apt-pkg / algorithms.cc
index ddfda754daaf6809ce48d328961c859564ccc9fc..b21fcbb2f9b4e9a8d51553b5877bd3b45cc90054 100644 (file)
@@ -14,9 +14,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/algorithms.h"
-#endif 
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
@@ -26,6 +23,8 @@
     
 #include <apti18n.h>
 #include <sys/types.h>
     
 #include <apti18n.h>
 #include <sys/types.h>
+#include <cstdlib>
+#include <algorithm>
 #include <iostream>
                                                                        /*}}}*/
 using namespace std;
 #include <iostream>
                                                                        /*}}}*/
 using namespace std;
@@ -509,8 +508,10 @@ void pkgProblemResolver::MakeScores()
         Score += PrioMap[Cache[I].InstVerIter(Cache)->Priority];
       
       /* This helps to fix oddball problems with conflicting packages
         Score += PrioMap[Cache[I].InstVerIter(Cache)->Priority];
       
       /* This helps to fix oddball problems with conflicting packages
-         on the same level. We enhance the score of installed packages */
-      if (I->CurrentVer != 0)
+         on the same level. We enhance the score of installed packages 
+        if those are not obsolete
+      */
+      if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable())
         Score += 1;
    }
 
         Score += 1;
    }
 
@@ -804,7 +805,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
            continue;
         
         if (Debug == true)
            continue;
         
         if (Debug == true)
-           cout << "Investigating " << I.Name() << endl;
+           clog << "Investigating " << I.Name() << endl;
         
         // Isolate the problem dependency
         PackageKill KillList[100];
         
         // Isolate the problem dependency
         PackageKill KillList[100];
@@ -859,7 +860,12 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               OldEnd = LEnd;
            }
            else
               OldEnd = LEnd;
            }
            else
+            {
               Start++;
               Start++;
+              // We only worry about critical deps.
+              if (Start.IsCritical() != true)
+                  continue;
+            }
 
            // Dep is ok
            if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
 
            // Dep is ok
            if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
@@ -986,6 +992,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                     }
                     if (Debug)
                        clog << "  Will not break " << Pkg.Name() << " as stated in Breaks field in " << I.Name() <<endl;
                     }
                     if (Debug)
                        clog << "  Will not break " << Pkg.Name() << " as stated in Breaks field in " << I.Name() <<endl;
+                    Cache.MarkKeep(I, false, false);
                     continue;
                  }
 
                     continue;
                  }