]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/packagemanager.cc
merge with lp:~mvo/apt/debian-sid
[apt.git] / apt-pkg / packagemanager.cc
index d6172c6c4c8cd82197b1dd9c95467ab2666ccf3b..cc9ce21c7fbbe1413f7ce54a33405ce984cc28a8 100644 (file)
@@ -26,7 +26,7 @@
 #include <apti18n.h>    
 #include <iostream>
 #include <fcntl.h> 
-
+                                                                       /*}}}*/
 using namespace std;
 
 // PM::PackageManager - Constructor                                    /*{{{*/
@@ -117,7 +117,40 @@ bool pkgPackageManager::FixMissing()
    return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;   
 }
                                                                        /*}}}*/
+// PM::ImmediateAdd - Add the immediate flag recursivly                        /*{{{*/
+// ---------------------------------------------------------------------
+/* This adds the immediate flag to the pkg and recursively to the
+   dependendies 
+ */
+void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer)
+{
+   DepIterator D;
+   
+   if(UseInstallVer)
+   {
+      if(Cache[I].InstallVer == 0)
+        return;
+      D = Cache[I].InstVerIter(Cache).DependsList(); 
+   } else {
+      if (I->CurrentVer == 0)
+        return;
+      D = I.CurrentVer().DependsList(); 
+   }
 
+   for ( /* nothing */  ; D.end() == false; D++)
+      if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
+      {
+        if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
+        {
+           if(Debug)
+              clog << "ImmediateAdd(): Adding Immediate flag to " << I.Name() << endl;
+           List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
+           ImmediateAdd(D.TargetPkg(), UseInstallVer);
+        }
+      }
+   return;
+}
+                                                                       /*}}}*/
 // PM::CreateOrderList - Create the ordering class                     /*{{{*/
 // ---------------------------------------------------------------------
 /* This populates the ordering list with all the packages that are
@@ -144,21 +177,15 @@ bool pkgPackageManager::CreateOrderList()
           (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) &&
          NoImmConfigure == false)
       {
+        if(Debug)
+           clog << "CreateOrderList(): Adding Immediate flag for " << I.Name() << endl;
         List->Flag(I,pkgOrderList::Immediate);
-        
-        // Look for other packages to make immediate configurea
-        if (Cache[I].InstallVer != 0)
-           for (DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); 
-                D.end() == false; D++)
-              if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
-                 List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
+
+        // Look for other install packages to make immediate configurea
+        ImmediateAdd(I, true);
         
         // And again with the current version.
-        if (I->CurrentVer != 0)
-           for (DepIterator D = I.CurrentVer().DependsList(); 
-                D.end() == false; D++)
-              if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
-                 List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
+        ImmediateAdd(I, false);
       }
       
       // Not interesting
@@ -637,10 +664,6 @@ pkgPackageManager::DoInstallPostFork(int statusFd)
       if(goResult == false) 
         return Failed;
 
-      // if all was fine update the state file
-      if(Res == Completed) {
-        Cache.writeStateFile(NULL);
-      }
       return Res;
 };