]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/packagemanager.cc
- provide a {Package,Version}List similar to {Package,Version}Set
[apt.git] / apt-pkg / packagemanager.cc
index b9ef0f5d7c2644a258f1986ce82bb7bc4113a5c2..4f97627016009e5a4b3a2c19bde9367e482cac65 100644 (file)
@@ -404,22 +404,27 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
         
         /* If the dependany is still not satisfied, try, if possible, unpacking a package to satisfy it */
         if (InstallVer != 0 && Bad) {
-           Bad = false;
-           if (List->IsNow(DepPkg) && !List->IsFlag(DepPkg,pkgOrderList::Loop)) {
-              List->Flag(Pkg,pkgOrderList::Loop);
-              if (Debug) 
-                 cout << OutputInDepth(Depth) << "Unpacking " << DepPkg.Name() << " to avoid loop" << endl;
-              SmartUnPack(DepPkg, true, Depth + 1);
-              List->RmFlag(Pkg,pkgOrderList::Loop);
+           if (List->IsNow(DepPkg)) {
+              Bad = false;
+              if (List->IsFlag(Pkg,pkgOrderList::Loop))
+              {
+                 if (Debug)
+                    std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure" << std::endl;
+              }
+              else
+              {
+                 List->Flag(Pkg,pkgOrderList::Loop);
+                 if (Debug)
+                    cout << OutputInDepth(Depth) << "Unpacking " << DepPkg.Name() << " to avoid loop" << endl;
+                 SmartUnPack(DepPkg, true, Depth + 1);
+                 List->RmFlag(Pkg,pkgOrderList::Loop);
+              }
            }
         }
         
         if (Start==End) {
-           if (Bad && Debug) {
-              if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) {
-                  _error->Warning("Could not satisfy dependancies for %s",Pkg.Name());
-               } 
-           }
+           if (Bad && Debug && List->IsFlag(DepPkg,pkgOrderList::Loop) == false)
+                 std::clog << OutputInDepth(Depth) << "Could not satisfy dependancies for " << Pkg.Name() << std::endl;
            break;
         } else {
             Start++;
@@ -551,14 +556,6 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
       cout << endl;
    }
 
-   // Check if it is already unpacked
-   if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
-       Cache[Pkg].Keep() == true)
-   {
-      cout << OutputInDepth(Depth) << "SmartUnPack called on Package " << Pkg.Name() << " but its unpacked" << endl;
-      return false;
-   }
    VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
 
    /* PreUnpack Checks: This loop checks and attempts to rectify and problems that would prevent the package being unpacked.
@@ -768,7 +765,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
            return false;
       }
    }
-   else if (Install(Pkg,FileNames[Pkg->ID]) == false)
+   // packages which are already unpacked don't need to be unpacked again
+   else if (Pkg.State() != pkgCache::PkgIterator::NeedsConfigure && Install(Pkg,FileNames[Pkg->ID]) == false)
       return false;
 
    if (Immediate == true) {