[Aptitude-devel] r2971 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver
Daniel Burrows
dburrows@costa.debian.org
Sat, 09 Apr 2005 19:30:31 +0000
Author: dburrows
Date: Sat Apr 9 19:30:27 2005
New Revision: 2971
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h
Log:
Fix several assertion failures in the glue code.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Apr 9 19:30:27 2005
@@ -2,6 +2,15 @@
* src/generic/problemresolver/aptitude_resolver.h:
+ Make sure to use the correct solver_iterator constructor variant
+ for each appropriate case.
+
+ In dep_iterator's ++, make sure to call normalize in *all*
+ cases, not just the case of advancing the dep ptr. For
+ Conflicts, always advance by exactly one step.
+
+ * src/generic/problemresolver/aptitude_resolver.h:
+
When normalizing solver-iterators, include the code to advance
the dependency inside the loop that runs till we run out of deps
(so the program doesn't go into an infinite loop..oops..).
Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h Sat Apr 9 19:30:27 2005
@@ -607,7 +607,10 @@
inline aptitude_resolver_dep::solver_iterator aptitude_resolver_dep::solvers_begin() const
{
- return solver_iterator(start);
+ if(start->Type != pkgCache::Dep::Conflicts)
+ return solver_iterator(start);
+ else
+ return solver_iterator(start, prv);
}
class aptitude_universe
@@ -682,8 +685,12 @@
prv_open=false;
++dep;
}
+ else
+ return;
}
+ assert(!prv_open);
+
// Now, if we ran our of deps, try to find another one.
while(dep.end() && !pkg.end())
{
@@ -708,9 +715,12 @@
}
}
- // Avoid direct self-deps. (self-conflicts in particular,
- // but a non-conflict self-dep is pointless)
- while(!dep.end() && dep.ParentPkg() == dep.TargetPkg())
+ // Avoid direct self-deps and non-critical
+ // deps. (self-conflicts in particular, but a non-conflict
+ // self-dep is pointless)
+ while(!dep.end() &&
+ (dep.ParentPkg() == dep.TargetPkg() ||
+ !dep.IsCritical()))
++dep;
}
}
@@ -751,17 +761,22 @@
// Otherwise just advance blindly.
else
{
- // Advance to the end of the OR...
- while(!dep.end() && (dep->CompareOp & pkgCache::Dep::Or))
- ++dep;
-
- // ...and beyond!
- if(!dep.end())
+ if(!dep.end() && dep->Type == pkgCache::Dep::Conflicts)
++dep;
-
- // Look for a valid dep.
- normalize();
+ else
+ {
+ // Advance to the end of the OR...
+ while(!dep.end() && (dep->CompareOp & pkgCache::Dep::Or))
+ ++dep;
+
+ // ...and beyond!
+ if(!dep.end())
+ ++dep;
+ }
}
+
+ // Look for a valid dep.
+ normalize();
}
bool end() const