##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/edsp.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/cacheset.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/version.h>
#include <apt-pkg/policy.h>
#include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
-#include <apti18n.h>
#include <limits>
-
#include <stdio.h>
+
+#include <string>
+
+#include <apti18n.h>
/*}}}*/
+using std::string;
+
// we could use pkgCache::DepType and ::Priority, but these would be localized stringsā¦
const char * const EDSP::PrioMap[] = {0, "important", "required", "standard",
"optional", "extra"};
if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
fprintf(output, "Essential: yes\n");
fprintf(output, "Section: %s\n", Ver.Section());
- if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+ if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
fprintf(output, "Multi-Arch: allowed\n");
- else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
fprintf(output, "Multi-Arch: foreign\n");
- else if (Ver->MultiArch == pkgCache::Version::Same)
+ else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
fprintf(output, "Multi-Arch: same\n");
signed short Pin = std::numeric_limits<signed short>::min();
for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) {
bool orGroup = false;
for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
{
- // Ignore implicit dependencies for multiarch here
- if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+ if (Dep.IsMultiArchImplicit() == true)
continue;
if (orGroup == false)
dependencies[Dep->Type].append(", ");
string provides;
for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
{
- // Ignore implicit provides for multiarch here
- if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+ if (Prv.IsMultiArchImplicit() == true)
continue;
provides.append(", ").append(Prv.Name());
}
bool orGroup = false;
for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
{
- // Ignore implicit dependencies for multiarch here
- if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+ if (Dep.IsMultiArchImplicit() == true)
continue;
if (orGroup == false)
{
string provides;
for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
{
- // Ignore implicit provides for multiarch here
- if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+ if (Prv.IsMultiArchImplicit() == true)
continue;
if (pkgset.find(Prv.ParentPkg()) == pkgset.end())
continue;
if (_config->FindB("APT::Solver::Strict-Pinning", true) == false)
fprintf(output, "Strict-Pinning: no\n");
string solverpref("APT::Solver::");
- solverpref.append(_config->Find("APT::Solver::Name", "internal")).append("::Preferences");
+ solverpref.append(_config->Find("APT::Solver", "internal")).append("::Preferences");
if (_config->Exists(solverpref) == true)
fprintf(output, "Preferences: %s\n", _config->Find(solverpref,"").c_str());
fprintf(output, "\n");
}
continue;
} else if (section.Exists("Error") == true) {
+ std::string msg = SubstVar(SubstVar(section.FindS("Message"), "\n .\n", "\n\n"), "\n ", "\n");
+ if (msg.empty() == true) {
+ msg = _("External solver failed without a proper error message");
+ _error->Error("%s", msg.c_str());
+ } else
+ _error->Error("External solver failed with: %s", msg.substr(0,msg.find('\n')).c_str());
+ if (Progress != NULL)
+ Progress->Done();
std::cerr << "The solver encountered an error of type: " << section.FindS("Error") << std::endl;
std::cerr << "The following information might help you to understand what is wrong:" << std::endl;
- std::cerr << SubstVar(SubstVar(section.FindS("Message"), "\n .\n", "\n\n"), "\n ", "\n") << std::endl << std::endl;
- break;
+ std::cerr << msg << std::endl << std::endl;
+ return false;
} else if (section.Exists("Autoremove") == true)
type = "Autoremove";
else
if (Progress != NULL)
Progress->OverallProgress(25, 100, 75, _("Execute external solver"));
if (EDSP::ReadResponse(solver_out, Cache, Progress) == false)
- return _error->Error("Reading solver response failed");
+ return false;
return true;
}