]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
* apt-pkg/deb/debversion.cc:
[apt.git] / apt-pkg / algorithms.cc
index 2ad0643199fac6f034a3f554a9c97012a4d57791..34da745dea5ac67a2b25c1e83d7478e96f0a7a27 100644 (file)
@@ -442,7 +442,6 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
    return true;
 }
                                                                        /*}}}*/
-
 // ProblemResolver::pkgProblemResolver - Constructor                   /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -501,6 +500,7 @@ void pkgProblemResolver::MakeScores()
    signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
    signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);
    signed short PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1);
+   signed short PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1);
    signed short AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000);
    signed short AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000);
 
@@ -514,6 +514,7 @@ void pkgProblemResolver::MakeScores()
          << "  Essentials => " << PrioEssentials << endl
          << "  InstalledAndNotObsolete => " << PrioInstalledAndNotObsolete << endl
          << "  Depends => " << PrioDepends << endl
+         << "  Recommends => " << PrioRecommends << endl
          << "  AddProtected => " << AddProtected << endl
          << "  AddEssential => " << AddEssential << endl;
 
@@ -552,8 +553,11 @@ void pkgProblemResolver::MakeScores()
       
       for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; D++)
       {
-        if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
-           Scores[D.TargetPkg()->ID]+= PrioDepends;
+        if (D->Type == pkgCache::Dep::Depends || 
+            D->Type == pkgCache::Dep::PreDepends)
+           Scores[D.TargetPkg()->ID] += PrioDepends;
+        else if (D->Type == pkgCache::Dep::Recommends)
+           Scores[D.TargetPkg()->ID] += PrioRecommends;
       }
    }   
    
@@ -573,7 +577,9 @@ void pkgProblemResolver::MakeScores()
       {
         // Only do it for the install version
         if ((pkgCache::Version *)D.ParentVer() != Cache[D.ParentPkg()].InstallVer ||
-            (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends))
+            (D->Type != pkgCache::Dep::Depends && 
+             D->Type != pkgCache::Dep::PreDepends &&
+             D->Type != pkgCache::Dep::Recommends))
            continue;    
         
         Scores[I->ID] += abs(OldScores[D.ParentPkg()->ID]);
@@ -985,26 +991,11 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                        // Consider other options
                        if (InOr == false)
                        {
-                          if (Cache.AutoInstOk(I, Cache[I].CandidateVerIter(Cache),Start) == true)
-                          {
-                             if (Debug == true)
-                                clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
-                             Cache.MarkDelete(I);
-                             if (Counter > 1)
-                             {
-                                if (Scores[Pkg->ID] > Scores[I->ID])
-                                   Scores[I->ID] = Scores[Pkg->ID];
-                             }
-                          } else {
-                             /* The dependency of the TargetPkg would be satisfiable with I but it is
-                                forbidden to install I automatical, so anything we can do is hold
-                                back the TargetPkg.
-                             */
-                             if (Debug == true)
-                                clog << "  Hold back " << Start.TargetPkg().Name() <<
-                                       " rather than change denied AutoInstall " << I.Name() << endl;
-                             Cache.MarkKeep(Start.TargetPkg());
-                          }
+                          if (Debug == true)
+                             clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+                          Cache.MarkDelete(I);
+                          if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
+                             Scores[I->ID] = Scores[Pkg->ID];
                        }
                     }
                  }
@@ -1323,7 +1314,6 @@ void pkgProblemResolver::InstallProtect()
    }   
 }
                                                                        /*}}}*/
-
 // PrioSortList - Sort a list of versions by priority                  /*{{{*/
 // ---------------------------------------------------------------------
 /* This is ment to be used in conjunction with AllTargets to get a list 
@@ -1354,7 +1344,6 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
    qsort(List,Count,sizeof(*List),PrioComp);
 }
                                                                        /*}}}*/
-
 // CacheFile::ListUpdate - update the cache files                      /*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple wrapper to update the cache. it will fetch stuff