]> git.saurik.com Git - apt.git/commitdiff
cmdline/apt-get.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Thu, 13 Mar 2008 22:19:10 +0000 (23:19 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Thu, 13 Mar 2008 22:19:10 +0000 (23:19 +0100)
- install tasks in two passes, first without dependency auto-install,
  the with it. this ensure that we do not run in a situation were
  a task packages A dependens on B|C and C is part of the task but
  B gets installed too because of the greedy nature of apt

cmdline/apt-get.cc
debian/changelog

index fe9416f1a575528f934137e0df5964f585ec15d3..3f9a5b24885198658734ba15738ee8eac15b45db 100644 (file)
@@ -1495,19 +1495,24 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
    
    bool found = false;
    bool res = true;
-   for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
+
+   // two runs, first ignore dependencies, second install any missing
+   for(int IgnoreBroken=1; IgnoreBroken >= 0; IgnoreBroken--)
    {
-      pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
-      if(ver.end())
-        continue;
-      pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
-      parser.GetRec(start,end);
-      strncpy(buf, start, end-start);
-      buf[end-start] = 0x0;
-      if (regexec(&Pattern,buf,0,0,0) != 0)
-        continue;
-      res &= TryToInstall(Pkg,Cache,Fix,Remove,true,ExpectedInst);
-      found = true;
+      for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
+      {
+        pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
+        if(ver.end())
+           continue;
+        pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
+        parser.GetRec(start,end);
+        strncpy(buf, start, end-start);
+        buf[end-start] = 0x0;
+        if (regexec(&Pattern,buf,0,0,0) != 0)
+           continue;
+        res &= TryToInstall(Pkg,Cache,Fix,Remove,IgnoreBroken,ExpectedInst);
+        found = true;
+      }
    }
    
    // now let the problem resolver deal with any issues
index da4779f8b178210d54411bc19a5ea38634a05be9..5a4051f4d2f9aa1e96e018aa41afe6cb1778aca4 100644 (file)
@@ -19,7 +19,8 @@ apt (0.7.12) UNRELEASED; urgency=low
     - remember hosts with Resolve failures or connect Timeouts
   * cmdline/apt-get.cc:
     - fix incorrect help output for -f (LP: #57487)
-    - run the problemResolver after a task was installed
+    - do two passes when installing tasks, first ignoring dependencies,
+      then resolving them and run the problemResolver at the end
       so that it can correct any missing dependencies
   * debian/apt.cron.daily:
     - sleep random amount of time (default within 0-30min) before