]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
* apt-pkg/cacheset.cc:
[apt.git] / cmdline / apt-get.cc
index 38b93e7e586f85671c740d5ca35f3fc34f4050b4..c0e74b37b1601efae83d5540566ab0a8cdd91246 100644 (file)
@@ -25,6 +25,9 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
@@ -37,6 +40,7 @@
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/cachefile.h>
+#include <apt-pkg/cacheset.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/versionmatch.h>
@@ -45,7 +49,6 @@
 #include <apti18n.h>
 
 #include "acqprogress.h"
-#include "cacheset.h"
 
 #include <set>
 #include <locale.h>
@@ -63,6 +66,9 @@
 #include <regex.h>
 #include <sys/wait.h>
 #include <sstream>
+
+#define statfs statfs64
+#define statvfs statvfs64
                                                                        /*}}}*/
 
 #define RAMFS_MAGIC     0x858458f6
@@ -762,12 +768,14 @@ struct TryToInstall {
    pkgProblemResolver* Fix;
    bool FixBroken;
    unsigned long AutoMarkChanged;
+   APT::PackageSet doAutoInstallLater;
 
    TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM),
                        FixBroken(FixBroken), AutoMarkChanged(0) {};
 
    void operator() (pkgCache::VerIterator const &Ver) {
       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+
       Cache->GetDepCache()->SetCandidateVersion(Ver);
       pkgDepCache::StateCache &State = (*Cache)[Pkg];
 
@@ -798,8 +806,8 @@ struct TryToInstall {
 
         // Install it with autoinstalling enabled (if we not respect the minial
         // required deps or the policy)
-        if ((State.InstBroken() == true || State.InstPolicyBroken() == true) && FixBroken == false)
-           Cache->GetDepCache()->MarkInstall(Pkg,true);
+        if (FixBroken == false)
+           doAutoInstallLater.insert(Pkg);
       }
 
       // see if we need to fix the auto-mark flag
@@ -817,6 +825,17 @@ struct TryToInstall {
         AutoMarkChanged++;
       }
    }
+
+   void doAutoInstall() {
+      for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
+          P != doAutoInstallLater.end(); ++P) {
+        pkgDepCache::StateCache &State = (*Cache)[P];
+        if (State.InstBroken() == false && State.InstPolicyBroken() == false)
+           continue;
+        Cache->GetDepCache()->MarkInstall(P, true);
+      }
+      doAutoInstallLater.clear();
+   }
 };
                                                                        /*}}}*/
 // TryToRemove - Mark a package for removal                            /*{{{*/
@@ -1333,6 +1352,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
    } else if (Cache[Pkg].CandidateVer != 0) {
       TryToInstall InstallAction(Cache, Fix, BrokenFix);
       InstallAction(Cache[Pkg].CandidateVerIter(Cache));
+      InstallAction.doAutoInstall();
    } else
       return AllowFail;
 
@@ -1740,8 +1760,10 @@ bool DoInstall(CommandLine &CmdL)
 
       for (unsigned short i = 0; order[i] != 0; ++i)
       {
-        if (order[i] == MOD_INSTALL)
+        if (order[i] == MOD_INSTALL) {
            InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction);
+           InstallAction.doAutoInstall();
+        }
         else if (order[i] == MOD_REMOVE)
            RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction);
       }