summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-07-14 21:28:50 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-07-14 21:28:50 +0200
commit8e7ac74ad9dbd15a874c66632f6da22f6b23d9c6 (patch)
tree9ca19909a123829858c8cb5e236f1b2341f996ed /apt-pkg/algorithms.cc
parent78485ab210b815c21ce55cb0cecb834ba5158e18 (diff)
parent118192bfd764d03af4cfcfc10eb9c38e7cc98721 (diff)
merge with debian-sid 0.8.15.2
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc40
1 files changed, 34 insertions, 6 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 2dae4258a..7c911b865 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1176,6 +1176,31 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
return true;
}
/*}}}*/
+
+// ProblemResolver::BreaksInstOrPolicy - Check if the given pkg is broken/*{{{*/
+// ---------------------------------------------------------------------
+/* This checks if the given package is broken either by a hard dependency
+ (InstBroken()) or by introducing a new policy breakage e.g. new
+ unsatisfied recommends for a package that was in "policy-good" state
+
+ Note that this is not perfect as it will ignore further breakage
+ for already broken policy (recommends)
+*/
+bool pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator I)
+{
+
+ // a broken install is always a problem
+ if (Cache[I].InstBroken() == true)
+ return true;
+
+ // a newly broken policy (recommends/suggests) is a problem
+ if (Cache[I].NowPolicyBroken() == false &&
+ Cache[I].InstPolicyBroken() == true)
+ return true;
+
+ return false;
+}
+
// ProblemResolver::ResolveByKeep - Resolve problems using keep /*{{{*/
// ---------------------------------------------------------------------
/* This is the work horse of the soft upgrade routine. It is very gental
@@ -1220,9 +1245,12 @@ bool pkgProblemResolver::ResolveByKeep()
{
pkgCache::PkgIterator I(Cache,*K);
- if (Cache[I].InstallVer == 0 || Cache[I].InstBroken() == false)
+ if (Cache[I].InstallVer == 0)
continue;
+ if (InstOrNewPolicyBroken(I) == false)
+ continue;
+
/* Keep the package. If this works then great, otherwise we have
to be significantly more agressive and manipulate its dependencies */
if ((Flags[I->ID] & Protected) == 0)
@@ -1230,7 +1258,7 @@ bool pkgProblemResolver::ResolveByKeep()
if (Debug == true)
clog << "Keeping package " << I.FullName(false) << endl;
Cache.MarkKeep(I, false, false);
- if (Cache[I].InstBroken() == false)
+ if (InstOrNewPolicyBroken(I) == false)
{
K = PList - 1;
continue;
@@ -1280,11 +1308,11 @@ bool pkgProblemResolver::ResolveByKeep()
Cache.MarkKeep(Pkg, false, false);
}
- if (Cache[I].InstBroken() == false)
+ if (InstOrNewPolicyBroken(I) == false)
break;
}
- if (Cache[I].InstBroken() == false)
+ if (InstOrNewPolicyBroken(I) == false)
break;
if (Start == End)
@@ -1292,11 +1320,11 @@ bool pkgProblemResolver::ResolveByKeep()
Start++;
}
- if (Cache[I].InstBroken() == false)
+ if (InstOrNewPolicyBroken(I) == false)
break;
}
- if (Cache[I].InstBroken() == true)
+ if (InstOrNewPolicyBroken(I) == true)
continue;
// Restart again.