From d6ebeb21ddb3d8f3d485562cdac0e0878d50c936 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Jun 2009 18:40:42 +0200 Subject: * support IsAutoInstallOk in the resolver too * honor the dpkg hold state in IsAutoInstallOk (closes: #64141) --- apt-pkg/algorithms.cc | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 4b1bb4430..db370a044 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -985,15 +985,27 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) // Consider other options if (InOr == false) { - if (Debug == true) - clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl; - Cache.MarkDelete(I); - if (Counter > 1) + if (Cache.IsAutoInstallOk(I) == true) { - if (Scores[Pkg->ID] > Scores[I->ID]) - Scores[I->ID] = Scores[Pkg->ID]; - } - } + if (Debug == true) + clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl; + Cache.MarkDelete(I); + if (Counter > 1) + { + if (Scores[Pkg->ID] > Scores[I->ID]) + Scores[I->ID] = Scores[Pkg->ID]; + } + } else { + /* The dependency of the TargetPkg would be satisfiable with I but it is + forbidden to install I automatical, so anything we can do is hold + back the TargetPkg. + */ + if (Debug == true) + clog << " Hold back " << Start.TargetPkg().Name() << + " rather than change denied AutoInstall " << I.Name() << endl; + Cache.MarkKeep(Start.TargetPkg()); + } + } } } -- cgit v1.2.3