X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/8e99b22c31eb47d0422e9a69e83dc99bb315ded8..bbd8308cc01941e51e2cbcf88168a5560abe6042:/apt-pkg/edsp.cc diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 55bc0fcbd..ef2401f9e 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -439,7 +439,7 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FileFd &output, OpProgress *Progres Progress->Progress(p); } } - return true; + return Okay; } /*}}}*/ // EDSP::WriteLimitedScenario - to the given file descriptor /*{{{*/ @@ -911,14 +911,14 @@ bool EDSP::WriteSolutionStanza(FileFd &output, char const * const Type, pkgCache /*}}}*/ // EDSP::WriteProgess - pulse to the given file descriptor /*{{{*/ bool EDSP::WriteProgress(unsigned short const percent, const char* const message, FILE* output) { - fprintf(output, "Progress: %s\n", TimeRFC1123(time(NULL)).c_str()); + fprintf(output, "Progress: %s\n", TimeRFC1123(time(NULL), true).c_str()); fprintf(output, "Percentage: %d\n", percent); fprintf(output, "Message: %s\n\n", message); fflush(output); return true; } bool EDSP::WriteProgress(unsigned short const percent, const char* const message, FileFd &output) { - return WriteOkay(output, "Progress: ", TimeRFC1123(time(NULL)), "\n", + return WriteOkay(output, "Progress: ", TimeRFC1123(time(NULL), true), "\n", "Percentage: ", percent, "\n", "Message: ", message, "\n\n") && output.Flush(); } @@ -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 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 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); @@ -1284,7 +1308,7 @@ bool EIPP::WriteScenario(pkgDepCache &Cache, FileFd &output, OpProgress * const continue; forAllInterestingVersions(Cache, Pkg, WriteVersion); } - return true; + return Okay; } /*}}}*/ // EIPP::ReadResponse - from the given file descriptor /*{{{*/ @@ -1361,7 +1385,7 @@ bool EIPP::ReadResponse(int const input, pkgPackageManager * const PM, OpProgres else if (strcmp(type, "Remove") == 0) PM->Remove(Pkg, PM->Cache[Pkg].Purge()); } - return true; + return in.Failed() == false; } /*}}}*/ bool EIPP::ReadRequest(int const input, std::list> &actions,/*{{{*/ @@ -1417,9 +1441,6 @@ bool EIPP::ReadRequest(int const input, std::list> &actions,/*{{{*/