]> git.saurik.com Git - apt.git/commitdiff
Added code to allow SmartConfigure to be called mutiple times on the same package...
authorChristopher Baines <cbaines8@gmail.com>
Fri, 12 Aug 2011 15:36:25 +0000 (16:36 +0100)
committerChristopher Baines <cbaines8@gmail.com>
Fri, 12 Aug 2011 15:36:25 +0000 (16:36 +0100)
apt-pkg/packagemanager.cc

index 8fc571f2f1f7e8d4877d5be6d8620fa2ec3a6415..7a0f11d85b06b7b177210f7d7a55adbdbe16299b 100644 (file)
@@ -324,7 +324,10 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
       VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
       clog << "SmartConfigure " << Pkg.Name() << InstallVer.VerStr() << endl;
    }
       VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
       clog << "SmartConfigure " << Pkg.Name() << InstallVer.VerStr() << endl;
    }
-   
+
+   // If this is true, only check and correct and dependancies without the Loop flag
+   bool PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop);
+
    VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
       
    /* Because of the ordered list, most dependancies should be unpacked, 
    VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
       
    /* Because of the ordered list, most dependancies should be unpacked, 
@@ -365,16 +368,19 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
            // Check if the version that is going to be installed will satisfy the dependancy
            if (Cache[DepPkg].InstallVer == *I) {
               if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) {
            // Check if the version that is going to be installed will satisfy the dependancy
            if (Cache[DepPkg].InstallVer == *I) {
               if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) {
+                 if (PkgLoop && List->IsFlag(DepPkg,pkgOrderList::Loop)) {
+                   // This dependancy has already been dealt with by another SmartConfigure on Pkg
+                   Bad = false;
+                   break;
+                 }
                  /* Check for a loop to prevent one forming
                     If A depends on B and B depends on A, SmartConfigure will
                     just hop between them if this is not checked */
                  /* Check for a loop to prevent one forming
                     If A depends on B and B depends on A, SmartConfigure will
                     just hop between them if this is not checked */
-                 if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) {
-                    List->Flag(Pkg,pkgOrderList::Loop);
-                    // If SmartConfigure was succesfull, Bad is false, so break
-                    Bad = !SmartConfigure(DepPkg);
-                    List->RmFlag(Pkg,pkgOrderList::Loop);
-                    if (!Bad) break;
-                 }
+                 List->Flag(Pkg,pkgOrderList::Loop);
+                 // If SmartConfigure was succesfull, Bad is false, so break
+                 Bad = !SmartConfigure(DepPkg);
+                 List->RmFlag(Pkg,pkgOrderList::Loop);
+                 if (!Bad) break;
               } else if (List->IsFlag(DepPkg,pkgOrderList::Configured)) {
                  Bad = false;
                  break;
               } else if (List->IsFlag(DepPkg,pkgOrderList::Configured)) {
                  Bad = false;
                  break;
@@ -389,7 +395,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
               List->Flag(Pkg,pkgOrderList::Loop);
               if (Debug) 
                  cout << "  Unpacking " << DepPkg.Name() << " to avoid loop" << endl;
               List->Flag(Pkg,pkgOrderList::Loop);
               if (Debug) 
                  cout << "  Unpacking " << DepPkg.Name() << " to avoid loop" << endl;
-              SmartUnPack(DepPkg, true);
+              SmartUnPack(DepPkg, false);
               List->RmFlag(Pkg,pkgOrderList::Loop);
            }
         }
               List->RmFlag(Pkg,pkgOrderList::Loop);
            }
         }
@@ -412,6 +418,8 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
          _error->Warning(_("Could not configure '%s'. "),Pkg.Name());
       return false;
    }
          _error->Warning(_("Could not configure '%s'. "),Pkg.Name());
       return false;
    }
+   
+   if (PkgLoop) return true;
 
    static std::string const conf = _config->Find("PackageManager::Configure","all");
    static bool const ConfigurePkgs = (conf == "all" || conf == "smart");
 
    static std::string const conf = _config->Find("PackageManager::Configure","all");
    static bool const ConfigurePkgs = (conf == "all" || conf == "smart");