summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-05-10 22:48:31 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-10 22:48:31 +0200
commiteb1000f6e5fa7035c764d0e7aa9ca71c7aa8d52d (patch)
tree9467822bf59614c6523b92592af860ac34e5bf64 /apt-pkg/edsp.cc
parent35664152e47a1d4d712fd52e0f0a2dc8ed359d32 (diff)
edsp: support generic and solver-specific configs
The spec was slightly inconsistent if the preferences setting is available only as generic or specific setting & the code only supported the specific one, while for the strict-pinning was only generic… As the usual pattern for apt is to have both options we adapt the spec and code to support both as well. This also adds a purely informal "Solver" field so in case the request is saved in a file, we know to which solver the sent preferences apply. Closes: 823918
Diffstat (limited to 'apt-pkg/edsp.cc')
-rw-r--r--apt-pkg/edsp.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 77928379f..e54f0d1df 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -288,14 +288,15 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
fprintf(output, "Dist-Upgrade: yes\n");
if (AutoRemove == true)
fprintf(output, "Autoremove: yes\n");
- if (_config->FindB("APT::Solver::Strict-Pinning", true) == false)
+ auto const solver = _config->Find("APT::Solver", "internal");
+ fprintf(output, "Solver: %s\n", solver.c_str());
+ auto const solverconf = std::string("APT::Solver::") + solver + "::";
+ if (_config->FindB(solverconf + "Strict-Pinning", _config->FindB("APT::Solver::Strict-Pinning", true)) == false)
fprintf(output, "Strict-Pinning: no\n");
- string solverpref("APT::Solver::");
- solverpref.append(_config->Find("APT::Solver", "internal")).append("::Preferences");
- if (_config->Exists(solverpref) == true)
- fprintf(output, "Preferences: %s\n", _config->Find(solverpref,"").c_str());
+ auto const solverpref = _config->Find(solverconf + "Preferences", _config->Find("APT::Solver::Preferences", ""));
+ if (solverpref.empty() == false)
+ fprintf(output, "Preferences: %s\n", solverpref.c_str());
fprintf(output, "\n");
-
return true;
}
/*}}}*/
@@ -468,6 +469,8 @@ bool EDSP::ReadRequest(int const input, std::list<std::string> &install,
std::string const archs = line.c_str() + 15;
_config->Set("APT::Architectures", SubstVar(archs, " ", ","));
}
+ else if (line.compare(0, 7, "Solver:") == 0)
+ ; // purely informational line
else
_error->Warning("Unknown line in EDSP Request stanza: %s", line.c_str());