]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
fix partial (206 and 416) support in https
[apt.git] / apt-pkg / algorithms.cc
index c2c38e7287efca121603a7d70e04ae617bd3af2f..69d4acd83d621a8776d4124940f8fb8b1d697d56 100644 (file)
@@ -456,6 +456,49 @@ bool pkgAllUpgrade(pkgDepCache &Cache)
         Cache.MarkInstall(I, false, 0, false);
    }
       
+   return Fix.ResolveByKeep();
+}
+                                                                       /*}}}*/
+// AllUpgradeNoDelete - Upgrade without removing packages              /*{{{*/
+// ---------------------------------------------------------------------
+/* Right now the system must be consistent before this can be called.
+ * Upgrade as much as possible without deleting anything (useful for
+ * stable systems)
+ */
+bool pkgAllUpgradeNoDelete(pkgDepCache &Cache)
+{
+   pkgDepCache::ActionGroup group(Cache);
+
+   pkgProblemResolver Fix(&Cache);
+
+   if (Cache.BrokenCount() != 0)
+      return false;
+
+   // provide the initial set of stuff we want to upgrade by marking
+   // all upgradable packages for upgrade
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+   {
+      if (I->CurrentVer != 0 && Cache[I].InstallVer != 0)
+      {
+         if (_config->FindB("APT::Ignore-Hold",false) == false)
+            if (I->SelectedState == pkgCache::State::Hold)
+               continue;
+
+        Cache.MarkInstall(I, false, 0, false);
+      }
+   }
+
+   // then let auto-install loose
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+      if (Cache[I].Install())
+        Cache.MarkInstall(I, true, 0, false);
+
+   // ... but it may remove stuff, we we need to clean up afterwards again
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+      if (Cache[I].Delete() == true)
+        Cache.MarkKeep(I, false, false);
+
+   // resolve remaining issues via keep
    return Fix.ResolveByKeep();
 }
                                                                        /*}}}*/
@@ -550,14 +593,12 @@ void pkgProblemResolver::MakeScores()
    unsigned long Size = Cache.Head().PackageCount;
    memset(Scores,0,sizeof(*Scores)*Size);
 
-   // Maps to pkgCache::State::VerPriority
-   //   which is "Important Required Standard Optional Extra"
-   // (yes, that is confusing, the order of pkgCache::State::VerPriority
-   //  needs to be adjusted but that requires a ABI break)
+   // maps to pkgCache::State::VerPriority: 
+   //    Required Important Standard Optional Extra
    int PrioMap[] = {
       0,
-      _config->FindI("pkgProblemResolver::Scores::Important",2),
       _config->FindI("pkgProblemResolver::Scores::Required",3),
+      _config->FindI("pkgProblemResolver::Scores::Important",2),
       _config->FindI("pkgProblemResolver::Scores::Standard",1),
       _config->FindI("pkgProblemResolver::Scores::Optional",-1),
       _config->FindI("pkgProblemResolver::Scores::Extra",-2)
@@ -846,7 +887,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    while (Again == true);
 
    if (Debug == true) {
-      clog << "Starting, broken count: " << Cache.BrokenCount() << endl;
+      clog << "Starting pkgProblemResolver with broken count: " 
+           << Cache.BrokenCount() << endl;
    }
    
    MakeScores();
@@ -876,7 +918,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    }
 
    if (Debug == true) {
-      clog << "Starting 2, broken count: " << Cache.BrokenCount() << endl;
+      clog << "Starting 2 pkgProblemResolver with broken count: " 
+           << Cache.BrokenCount() << endl;
    }
 
    /* Now consider all broken packages. For each broken package we either
@@ -1442,9 +1485,11 @@ bool pkgProblemResolver::ResolveByKeepInternal()
    return true;
 }
                                                                        /*}}}*/
-// ProblemResolver::InstallProtect - Install all protected packages    /*{{{*/
+// ProblemResolver::InstallProtect - deprecated cpu-eating no-op       /*{{{*/
 // ---------------------------------------------------------------------
-/* This is used to make sure protected packages are installed */
+/* Actions issued with FromUser bit set are protected from further
+   modification (expect by other calls with FromUser set) nowadays , so we
+   don't need to reissue actions here, they are already set in stone. */
 void pkgProblemResolver::InstallProtect()
 {
    pkgDepCache::ActionGroup group(Cache);