diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-07-05 15:44:53 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-07-05 20:44:45 +0200 |
commit | 1b50bba6571661d1ddc1db808bd618bd0de3cae4 (patch) | |
tree | a923709a8fdbbba52d0ce7570123bd89d03f286e /apt-pkg | |
parent | 5958c7497eea24d55ff305764f058ba1ae836200 (diff) |
EIPP/EDSP log can't be written is a warning, not an error
If other logs can't be written this is a warning to,
so for consistency sake translate the errors to warnings.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/edsp.cc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 50db7e05c..ef2401f9e 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -1026,8 +1026,20 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache, 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) + _error->PushToStack(); + bool errored_out = CreateAPTDirectoryIfNeeded(dumpdir, dumpdir) == false || + output.Open(dumpfile, FileFd::WriteOnly | FileFd::Exclusive | FileFd::Create, FileFd::Extension, 0644) == false; + std::vector<std::string> downgrademsgs; + while (_error->empty() == false) + { + std::string msg; + _error->PopMessage(msg); + downgrademsgs.emplace_back(std::move(msg)); + } + _error->RevertToStack(); + for (auto && msg : downgrademsgs) + _error->Warning("%s", msg.c_str()); + if (errored_out) 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); @@ -1081,8 +1093,20 @@ bool EIPP::OrderInstall(char const * const solver, pkgPackageManager * const PM, 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) + _error->PushToStack(); + bool errored_out = CreateAPTDirectoryIfNeeded(dumpdir, dumpdir) == false || + output.Open(dumpfile, FileFd::WriteOnly | FileFd::Exclusive | FileFd::Create, FileFd::Extension, 0644) == false; + std::vector<std::string> downgrademsgs; + while (_error->empty() == false) + { + std::string msg; + _error->PopMessage(msg); + downgrademsgs.emplace_back(std::move(msg)); + } + _error->RevertToStack(); + for (auto && msg : downgrademsgs) + _error->Warning("%s", msg.c_str()); + if (errored_out) return _error->WarningE("EIPP::OrderInstall", _("Could not open file '%s'"), dumpfile.c_str()); bool Okay = EIPP::WriteRequest(PM->Cache, output, flags, nullptr); return Okay && EIPP::WriteScenario(PM->Cache, output, nullptr); |