summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-05-23 16:22:44 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-05-24 21:02:35 +0200
commit2ba86f95bfad4ec00a3b99b311d05c158162b25c (patch)
treef73160ad9a1a7e902b5e2aebca2ee2b3ac256a47 /apt-pkg/algorithms.cc
parent4f71dc657c34915508a9e34b000e1b577931655a (diff)
Allow pkgDepCache to be asked to check internal consistency
For speed reasons pkgDepCache initializes its state once and then has a battery of update calls you have to invoke in the right order to update the various states – all in the name of speed. In debug and/or simulation mode we can sacrifice this speed for a bit of extra checking though to verify that we haven't made some critical mistake like #961266.
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index f000b7f39..3fdb5116e 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -58,6 +58,8 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
string Jnk = "SIMULATE";
for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
FileNames[I] = Jnk;
+
+ Cache->CheckConsistency("simulate");
}
/*}}}*/
// Simulate::~Simulate - Destructor /*{{{*/
@@ -721,6 +723,9 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{
pkgDepCache::ActionGroup group(Cache);
+ if (Debug)
+ Cache.CheckConsistency("resolve start");
+
// Record which packages are marked for install
bool Again = false;
do
@@ -1152,6 +1157,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
}
}
+ if (Debug)
+ Cache.CheckConsistency("resolve done");
return true;
}
@@ -1211,6 +1218,9 @@ bool pkgProblemResolver::ResolveByKeepInternal()
{
pkgDepCache::ActionGroup group(Cache);
+ if (Debug)
+ Cache.CheckConsistency("keep start");
+
MakeScores();
/* We have to order the packages so that the broken fixing pass
@@ -1341,6 +1351,10 @@ bool pkgProblemResolver::ResolveByKeepInternal()
}
delete[] PList;
+
+ if (Debug)
+ Cache.CheckConsistency("keep done");
+
return true;
}
/*}}}*/