}
/*}}}*/
// DPkgPM::WriteHistoryTag /*{{{*/
-void pkgDPkgPM::WriteHistoryTag(string tag, string value)
+void pkgDPkgPM::WriteHistoryTag(FILE *history_out, string tag, string value)
{
if (value.size() > 0)
{
_config->Find("Dir::Log::History"));
if (!history_name.empty())
{
- history_out = fopen(history_name.c_str(),"a");
+ FILE *history_out = fopen(history_name.c_str(),"a");
chmod(history_name.c_str(), 0644);
fprintf(history_out, "\nStart-Date: %s\n", timestr);
string remove, purge, install, upgrade, downgrade;
remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), ");
}
}
- WriteHistoryTag("Install", install);
- WriteHistoryTag("Upgrade", upgrade);
- WriteHistoryTag("Downgrade",downgrade);
- WriteHistoryTag("Remove",remove);
- WriteHistoryTag("Purge",purge);
- fflush(history_out);
+ WriteHistoryTag(history_out, "Install", install);
+ WriteHistoryTag(history_out, "Upgrade", upgrade);
+ WriteHistoryTag(history_out, "Downgrade",downgrade);
+ WriteHistoryTag(history_out, "Remove",remove);
+ WriteHistoryTag(history_out, "Purge",purge);
+ fclose(history_out);
}
return true;
}
term_out = NULL;
- if(history_out)
+ string history_name = flCombine(_config->FindDir("Dir::Log"),
+ _config->Find("Dir::Log::History"));
+ if (!history_name.empty())
{
- if (dpkg_error.size() > 0)
- fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
+ FILE *history_out = fopen(history_name.c_str(),"a");
fprintf(history_out, "End-Date: %s\n", timestr);
fclose(history_out);
}
if(stopOnError)
RunScripts("DPkg::Post-Invoke");
+ string dpkg_error;
if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV)
strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
else if (WIFEXITED(Status) != 0)
strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
if(dpkg_error.size() > 0)
+ {
_error->Error(dpkg_error.c_str());
+ string history_name = flCombine(_config->FindDir("Dir::Log"),
+ _config->Find("Dir::Log::History"));
+ if (!history_name.empty())
+ {
+ FILE *history_out = fopen(history_name.c_str(),"a");
+ fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
+ fclose(history_out);
+ }
+ }
if(stopOnError)
{
bool Debug;
bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
- void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
+ // binary-compat change, fix on next abi break
+ void ImmediateAdd(PkgIterator P, bool UseInstallVer) {
+ ImmediateAdd(P, UseInstallVer, 0);
+ }
+ void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth);
virtual OrderResult OrderInstall();
bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
bool CreateOrderList();