bool pkgProblemResolver::Resolve(bool BrokenFix, OpProgress * const Progress)
{
std::string const solver = _config->Find("APT::Solver", "internal");
+ auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, 0, Progress);
if (solver != "internal")
- return EDSP::ResolveExternal(solver.c_str(), Cache, 0, Progress);
+ return ret;
return ResolveInternal(BrokenFix);
}
/*}}}*/
bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress)
{
std::string const solver = _config->Find("APT::Solver", "internal");
+ constexpr auto flags = EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE;
+ auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, flags, Progress);
if (solver != "internal")
- return EDSP::ResolveExternal(solver.c_str(), Cache,
- EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE,
- Progress);
+ return ret;
return ResolveByKeepInternal();
}
/*}}}*/
#include <apt-pkg/string_view.h>
#include <apt-pkg/pkgsystem.h>
+#include <sys/stat.h>
#include <ctype.h>
#include <stddef.h>
#include <string.h>
// EDSP::ResolveExternal - resolve problems by asking external for help {{{*/
bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
unsigned int const flags, OpProgress *Progress) {
+ if (strcmp(solver, "internal") == 0)
+ {
+ auto const dumpfile = _config->FindFile("Dir::Log::Solver");
+ if (dumpfile.empty())
+ return false;
+ auto const dumpdir = flNotFile(dumpfile);
+ FileFd output;
+ if (CreateAPTDirectoryIfNeeded(dumpdir, dumpdir) == false ||
+ output.Open(dumpfile, FileFd::WriteOnly | FileFd::Exclusive | FileFd::Create, FileFd::Extension, 0644) == false)
+ return _error->WarningE("EDSP::Resolve", _("Could not open file '%s'"), dumpfile.c_str());
+ bool Okay = EDSP::WriteRequest(Cache, output, flags, nullptr);
+ return Okay && EDSP::WriteScenario(Cache, output, nullptr);
+ }
int solver_in, solver_out;
pid_t const solver_pid = EDSP::ExecuteSolver(solver, &solver_in, &solver_out, true);
if (solver_pid == 0)
static bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress)
{
std::string const solver = _config->Find("APT::Solver", "internal");
+ auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, EDSP::Request::UPGRADE_ALL, Progress);
if (solver != "internal")
- return EDSP::ResolveExternal(solver.c_str(), Cache, EDSP::Request::UPGRADE_ALL, Progress);
+ return ret;
if (Progress != NULL)
Progress->OverallProgress(0, 100, 1, _("Calculating upgrade"));
static bool pkgAllUpgradeNoNewPackages(pkgDepCache &Cache, OpProgress * const Progress)
{
std::string const solver = _config->Find("APT::Solver", "internal");
+ constexpr auto flags = EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE;
+ auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, flags, Progress);
if (solver != "internal")
- return EDSP::ResolveExternal(solver.c_str(), Cache,
- EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE,
- Progress);
+ return ret;
if (Progress != NULL)
Progress->OverallProgress(0, 100, 1, _("Calculating upgrade"));
static bool pkgAllUpgradeWithNewPackages(pkgDepCache &Cache, OpProgress * const Progress)
{
std::string const solver = _config->Find("APT::Solver", "internal");
+ constexpr auto flags = EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_REMOVE;
+ auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, flags, Progress);
if (solver != "internal")
- return EDSP::ResolveExternal(solver.c_str(), Cache,
- EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_REMOVE,
- Progress);
+ return ret;
if (Progress != NULL)
Progress->OverallProgress(0, 100, 1, _("Calculating upgrade"));