]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
Enum fix
[apt.git] / apt-pkg / algorithms.cc
index 126318b59a8f265c8d107cefd1ab801113312876..350b574682a5881c5da7d9a4345904a9080e8257 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.cc,v 1.5 1998/10/08 04:54:58 jgg Exp $
+// $Id: algorithms.cc,v 1.8 1998/10/24 04:58:04 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -245,14 +245,17 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
         Cache.MarkInstall(I,false);
 
    pkgProblemResolver Fix(Cache);
         Cache.MarkInstall(I,false);
 
    pkgProblemResolver Fix(Cache);
-   
+
    // Hold back held packages.
    // Hold back held packages.
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   if (_config->FindB("APT::Ingore-Hold",false) == false)
    {
    {
-      if (I->SelectedState == pkgCache::State::Hold)
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       {
       {
-        Fix.Protect(I);
-        Cache.MarkKeep(I);
+        if (I->SelectedState == pkgCache::State::Hold)
+        {
+           Fix.Protect(I);
+           Cache.MarkKeep(I);
+        }
       }
    }
    
       }
    }
    
@@ -277,8 +280,9 @@ bool pkgAllUpgrade(pkgDepCache &Cache)
       if (Cache[I].Install() == true)
         Fix.Protect(I);
          
       if (Cache[I].Install() == true)
         Fix.Protect(I);
          
-      if (I->SelectedState == pkgCache::State::Hold)
-        continue;
+      if (_config->FindB("APT::Ingore-Hold",false) == false)
+        if (I->SelectedState == pkgCache::State::Hold)
+           continue;
       
       if (I->CurrentVer != 0 && Cache[I].InstallVer != 0)
         Cache.MarkInstall(I,false);
       
       if (I->CurrentVer != 0 && Cache[I].InstallVer != 0)
         Cache.MarkInstall(I,false);
@@ -713,7 +717,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                   ((Cache[End] & pkgDepCache::DepGNow) == 0 &&
                    End->Type != pkgCache::Dep::Conflicts))
               {
                   ((Cache[End] & pkgDepCache::DepGNow) == 0 &&
                    End->Type != pkgCache::Dep::Conflicts))
               {
-                 if ((Flags[I->ID] & Protected) != 0)
+                 if ((Flags[I->ID] & Protected) == Protected)
                     continue;
 
                  // See if a keep will do
                     continue;
 
                  // See if a keep will do
@@ -755,7 +759,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
            }
 
            // Hm, nothing can possibly satisify this dep. Nuke it.
            }
 
            // Hm, nothing can possibly satisify this dep. Nuke it.
-           if (VList[0] == 0 && End->Type != pkgCache::Dep::Conflicts)
+           if (VList[0] == 0 && End->Type != pkgCache::Dep::Conflicts &&
+               (Flags[I->ID] & Protected) != Protected)
            {
               Cache.MarkKeep(I);
               if (Cache[I].InstBroken() == false)
            {
               Cache.MarkKeep(I);
               if (Cache[I].InstBroken() == false)
@@ -903,7 +908,6 @@ bool pkgProblemResolver::ResolveByKeep()
         
         // Look at all the possible provides on this package
         pkgCache::Version **VList = End.AllTargets();
         
         // Look at all the possible provides on this package
         pkgCache::Version **VList = End.AllTargets();
-        bool Done = false;
         for (pkgCache::Version **V = VList; *V != 0; V++)
         {
            pkgCache::VerIterator Ver(Cache,*V);
         for (pkgCache::Version **V = VList; *V != 0; V++)
         {
            pkgCache::VerIterator Ver(Cache,*V);
@@ -942,3 +946,20 @@ bool pkgProblemResolver::ResolveByKeep()
    return true;
 }
                                                                        /*}}}*/
    return true;
 }
                                                                        /*}}}*/
+// ProblemResolver::InstallProtect - Install all protected packages    /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used to make sure protected packages are installed */
+void pkgProblemResolver::InstallProtect()
+{
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   {
+      if ((Flags[I->ID] & Protected) == Protected)
+      {
+        if ((Flags[I->ID] & ToRemove) == ToRemove)
+           Cache.MarkDelete(I);
+        else
+           Cache.MarkInstall(I,false);
+      }
+   }   
+}
+                                                                       /*}}}*/