summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-03-13 23:19:10 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2008-03-13 23:19:10 +0100
commit85bd111a9b0778ba6e2b8950d369aeca192f9555 (patch)
tree2bde17d83dd8a638db08edf921095c65d0335a8a /cmdline/apt-get.cc
parent9dbe6ae43a5a78f68a4863650a5d23eb9051d0f7 (diff)
cmdline/apt-get.cc:
- 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
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc29
1 files changed, 17 insertions, 12 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index fe9416f1a..3f9a5b248 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -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