summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-06-29 18:40:42 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-06-29 18:40:42 +0200
commitd6ebeb21ddb3d8f3d485562cdac0e0878d50c936 (patch)
tree80ad403b4a4c8d22f2f7e8626fd765cadd83ef2e /apt-pkg
parentfa3b09450ed3da175f619ca77d9dceb9a6f81972 (diff)
* support IsAutoInstallOk in the resolver too
* honor the dpkg hold state in IsAutoInstallOk (closes: #64141)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc28
-rw-r--r--apt-pkg/depcache.cc2
2 files changed, 21 insertions, 9 deletions
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());
+ }
+ }
}
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 9f734cca2..8af6941cf 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1069,7 +1069,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
library can override this method to control the MarkInstall behaviour */
bool pkgDepCache::IsAutoInstallOk(const PkgIterator &Pkg, unsigned long Depth)
{
- return true;
+ return (Pkg->SelectedState != pkgCache::State::Hold);
}
/*}}}*/
// DepCache::SetReInstall - Set the reinstallation flag /*{{{*/