]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
Fixed or handling bug
[apt.git] / apt-pkg / algorithms.cc
index 596473a6526055fc1544999d022289b3ae7e6ee9..7f7cb204faaaff8527d8bbbf5a6a5e115863b3bf 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.cc,v 1.26 1999/10/22 04:05:47 jgg Exp $
+// $Id: algorithms.cc,v 1.31 2000/10/03 23:59:05 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -284,7 +284,7 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
    pkgProblemResolver Fix(Cache);
 
    // Hold back held packages.
-   if (_config->FindB("APT::Ingore-Hold",false) == false)
+   if (_config->FindB("APT::Ignore-Hold",false) == false)
    {
       for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       {
@@ -574,7 +574,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
               /* We let the algorithm deal with conflicts on its next iteration,
                it is much smarter than us */
               if (Start->Type == pkgCache::Dep::Conflicts)
-                 continue;
+                 break;
               
               if (Debug == true)
                  clog << "    Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
@@ -719,6 +719,9 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
         if (Cache[I].InstallVer == 0 || Cache[I].InstBroken() == false)
            continue;
         
+        if (Debug == true)
+           cout << "Investigating " << I.Name() << endl;
+        
         // Isolate the problem dependency
         PackageKill KillList[100];
         PackageKill *LEnd = KillList;
@@ -731,6 +734,13 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
         for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
              D.end() == false || InOr == true;)
         {
+           // We only worry about critical deps.
+           if (D.IsCritical() != true)
+           {
+              D++;
+              continue;
+           }
+           
            // Compute a single dependency element (glob or)
            if (Start == End)
            {
@@ -738,22 +748,30 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               if (InOr == true)
               {
                  if (OldEnd == LEnd && OrOp == OrRemove)
-                    Cache.MarkDelete(I);
+                 {
+                    if ((Flags[I->ID] & Protected) != Protected)
+                    {
+                       if (Debug == true)
+                          clog << "  Or group remove for " << I.Name() << endl;
+                       Cache.MarkDelete(I);
+                    }               
+                 }               
                  if (OldEnd == LEnd && OrOp == OrKeep)
+                 {
+                    if (Debug == true)
+                       clog << "  Or group keep for " << I.Name() << endl;
                     Cache.MarkKeep(I);
+                 }               
               }
               
               OrOp = OrRemove;
               D.GlobOr(Start,End);
               InOr = Start != End;
+              cout << Start.TargetPkg().Name() << ',' << End.TargetPkg().Name() << ',' << InOr << endl;
               OldEnd = LEnd;
            }       
            else
               Start++;
-
-           // We only worry about critical deps.
-           if (End.IsCritical() != true)
-              continue;
            
            // Dep is ok
            if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
@@ -799,7 +817,11 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                  if ((Flags[I->ID] & Protected) == Protected)
                  {
                     if (DoUpgrade(Pkg) == true)
+                    {
                        Scores[Pkg->ID] = Scores[I->ID];
+                       break;
+                    }
+                    
                     continue;
                  }
                  
@@ -842,6 +864,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               }
               else
               {
+                 if (Debug == true)
+                    clog << "  Added " << Pkg.Name() << " to the remove list" << endl;
                  // Skip adding to the kill list if it is protected
                  if ((Flags[Pkg->ID] & Protected) != 0)
                     continue;