]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
merged from the lp:~mvo/apt/libudev-dlopen branch
[apt.git] / apt-pkg / algorithms.cc
index a30a02edb86bf76d4a4bc4d9141cbfc8276a089d..a3963d546d17dd7baa41709819e6ef227ccb9872 100644 (file)
@@ -500,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);
 
@@ -513,6 +514,7 @@ void pkgProblemResolver::MakeScores()
          << "  Essentials => " << PrioEssentials << endl
          << "  InstalledAndNotObsolete => " << PrioInstalledAndNotObsolete << endl
          << "  Depends => " << PrioDepends << endl
+         << "  Recommends => " << PrioRecommends << endl
          << "  AddProtected => " << AddProtected << endl
          << "  AddEssential => " << AddEssential << endl;
 
@@ -551,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;
       }
    }   
    
@@ -572,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]);
@@ -1133,8 +1140,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
       return _error->Error(_("Unable to correct problems, you have held broken packages."));
    }
    
-   // set the auto-flags (mvo: I'm not sure if we _really_ need this, but
-   // I didn't managed 
+   // set the auto-flags (mvo: I'm not sure if we _really_ need this)
    pkgCache::PkgIterator I = Cache.PkgBegin();
    for (;I.end() != true; I++) {
       if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {