[Aptitude-devel] r2940 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver
Daniel Burrows
dburrows@costa.debian.org
Fri, 08 Apr 2005 01:14:37 +0000
Author: dburrows
Date: Fri Apr 8 01:14:35 2005
New Revision: 2940
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
Log:
Fix the assertion failure and touch up debug output. It pretends to
solve the test problem now, but that's a lie.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Fri Apr 8 01:14:35 2005
@@ -2,6 +2,12 @@
* src/generic/problemresolver/problemresolver.h, src/generic/problemresolver/test.cc:
+ Fix the assertion failure: when trying to nullify the LHS of a
+ depends, install everything *but* the depending version. Also
+ touched up the debug output.
+
+ * src/generic/problemresolver/problemresolver.h, src/generic/problemresolver/test.cc:
+
Fix the segfault by adding the missing "&", and tweak the output
code a bit.
Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h Fri Apr 8 01:14:35 2005
@@ -378,11 +378,13 @@
void dump(std::ostream &out)
{
- out << "< ";
+ out << "<";
for(typename std::map<package, action>::const_iterator i=get_actions().begin();
i!=get_actions().end(); ++i)
{
- out << i->first.get_name() << " -> " << i->second.ver.get_name() << " ";
+ if(i!=get_actions().begin())
+ out << ", ";
+ out << i->first.get_name() << ":=" << i->second.ver.get_name();
}
out << ">";
}
@@ -556,14 +558,18 @@
version sol_version=s.version_of(source_package);
// If the source of the dependency was not modified and is
- // presently installed, try installing a different version.
+ // presently installed, try installing a *different version*.
if(sol_version==source_version)
{
if(source_version == source_package.current_version())
{
for(typename package::version_iterator vi=source_package.versions_begin();
vi!=source_package.versions_end(); ++vi)
- try_install(s, *vi);
+ if(*vi != source_version)
+ {
+ std::cout << "Trying to resolve " << d << " by installing " << (*vi).get_package().get_name() << " version " << (*vi).get_name() << std::endl;
+ try_install(s, *vi);
+ }
}
}
// Ok, the LHS *is* satisfied; hence the RHS must fail (since the
@@ -572,7 +578,10 @@
{
for(typename dep::solver_iterator si=d.solvers_begin();
si!=d.solvers_end(); ++si)
- try_install(s, *si);
+ {
+ std::cout << "Trying to resolve " << d << " by installing " << (*si).get_package().get_name() << " version " << (*si).get_name() << std::endl;
+ try_install(s, *si);
+ }
}
}
@@ -675,13 +684,17 @@
s.dump(std::cout);
- std::cout << " with broken deps [ ";
+ std::cout << " with broken deps [";
for(typename std::vector<dep>::const_iterator i=s.get_broken().begin();
i!=s.get_broken().end(); ++i)
- std::cout << *i << ", ";
+ {
+ if(i!=s.get_broken().begin())
+ std::cout << ", ";
+ std::cout << *i;
+ }
- std::cout << " ], score " << s.get_score() << std::endl;
+ std::cout << "], score " << s.get_score() << std::endl;
// If all dependencies are satisfied, we found a solution.
if(s.get_broken().empty())
Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc (original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc Fri Apr 8 01:14:35 2005
@@ -600,10 +600,14 @@
ostream &operator<<(ostream &out, const dummy_resolver::dep &d)
{
- out << d.get_source().get_name() << " -> { ";
+ out << d.get_source().get_package().get_name() << " " << d.get_source().get_name() << " -> {";
for(dummy_resolver::dep::solver_iterator i=d.solvers_begin();
i!=d.solvers_end(); ++i)
- out << (*i).get_name() << ", ";
+ {
+ if(i!=d.solvers_begin())
+ out << ", ";
+ out << (*i).get_package().get_name() << " " << (*i).get_name();
+ }
out << "}";
return out;