From: Michael Vogt Date: Thu, 18 Feb 2010 14:39:03 +0000 (+0100) Subject: merge from the lp:~donkult/apt/sid branch X-Git-Tag: 0.8.0~37 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/113942be71c90e7d6a9cff93cc05ac119db526de?ds=inline;hp=-c merge from the lp:~donkult/apt/sid branch --- 113942be71c90e7d6a9cff93cc05ac119db526de diff --combined apt-pkg/contrib/strutl.cc index 8e8820949,3bbaf5f30..1b9922a31 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@@ -1000,6 -1000,24 +1000,24 @@@ bool TokSplitString(char Tok,char *Inpu return true; } /*}}}*/ + // ExplodeString - Split a string up into a vector /*{{{*/ + // --------------------------------------------------------------------- + /* This can be used to split a given string up into a vector, so the + propose is the same as in the method above and this one is a bit slower + also, but the advantage is that we an iteratable vector */ + vector ExplodeString(string const &haystack, char const &split) + { + string::const_iterator start = haystack.begin(); + string::const_iterator end = start; + vector exploded; + do { + for (; end != haystack.end() && *end != split; ++end); + exploded.push_back(string(start, end)); + start = end + 1; + } while (end != haystack.end() && (++end) != haystack.end()); + return exploded; + } + /*}}}*/ // RegexChoice - Simple regex list/list matcher /*{{{*/ // --------------------------------------------------------------------- /* */ @@@ -1323,15 -1341,3 +1341,15 @@@ string URI::SiteOnly(const string &URI return U; } /*}}}*/ +// URI::NoUserPassword - Return the schema, site and path for the URI /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string URI::NoUserPassword(const string &URI) +{ + ::URI U(URI); + U.User.clear(); + U.Password.clear(); + U.Port = 0; + return U; +} + /*}}}*/ diff --combined apt-pkg/contrib/strutl.h index a1e7f3934,d65f975d2..e72288f4c --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@@ -59,6 -59,7 +59,7 @@@ bool StrToNum(const char *Str,unsigned bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); + vector ExplodeString(string const &haystack, char const &split); void ioprintf(ostream &out,const char *format,...) APT_FORMAT2; void strprintf(string &out,const char *format,...) APT_FORMAT2; char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3; @@@ -120,7 -121,6 +121,7 @@@ class UR inline void operator =(const string &From) {CopyFrom(From);}; inline bool empty() {return Access.empty();}; static string SiteOnly(const string &URI); + static string NoUserPassword(const string &URI); URI(string Path) {CopyFrom(Path);}; URI() : Port(0) {}; diff --combined apt-pkg/deb/dpkgpm.cc index 9d144a227,3dca2b209..fb6054f79 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@@ -550,31 -550,12 +550,31 @@@ void pkgDPkgPM::DoDpkgStatusFd(int stat dpkgbuf_pos = dpkgbuf+dpkgbuf_pos-p; } /*}}}*/ +// DPkgPM::WriteHistoryTag /*{{{*/ +void pkgDPkgPM::WriteHistoryTag(string tag, string value) +{ + if (value.size() > 0) + { + // poor mans rstrip(", ") + if (value[value.size()-2] == ',' && value[value.size()-1] == ' ') + value.erase(value.size() - 2, 2); + fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str()); + } +} /*}}}*/ // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() { string logdir = _config->FindDir("Dir::Log"); if(not FileExists(logdir)) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); + + // get current time + char timestr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(timestr, sizeof(timestr), "%F %T", tmp); + + // open terminal log string logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); if (!logfile_name.empty()) @@@ -584,70 -565,31 +584,70 @@@ return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str()); chmod(logfile_name.c_str(), 0600); - // output current time - char outstr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); - strftime(outstr, sizeof(outstr), "%F %T", tmp); - fprintf(term_out, "\nLog started: %s\n", outstr); + fprintf(term_out, "\nLog started: %s\n", timestr); } + + // write + string history_name = flCombine(logdir, + _config->Find("Dir::Log::History")); + if (!history_name.empty()) + { + 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; + for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) + { + if (Cache[I].NewInstall()) + install += I.Name() + string(" (") + Cache[I].CandVersion + string("), "); + else if (Cache[I].Upgrade()) + upgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + else if (Cache[I].Downgrade()) + downgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + else if (Cache[I].Delete()) + { + if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) + purge += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); + else + 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); + } + return true; } /*}}}*/ // DPkg::CloseLog /*{{{*/ bool pkgDPkgPM::CloseLog() { + char timestr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(timestr, sizeof(timestr), "%F %T", tmp); + if(term_out) { - char outstr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); - strftime(outstr, sizeof(outstr), "%F %T", tmp); fprintf(term_out, "Log ended: "); - fprintf(term_out, "%s", outstr); + fprintf(term_out, "%s", timestr); fprintf(term_out, "\n"); fclose(term_out); } term_out = NULL; + + if(history_out) + { + if (dpkg_error.size() > 0) + fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); + fprintf(history_out, "End-Date: %s\n", timestr); + fclose(history_out); + } + return true; } /*}}}*/ @@@ -1063,7 -1005,7 +1063,7 @@@ bool pkgDPkgPM::Go(int OutStatusFd // wait for input or output here FD_ZERO(&rfds); - if (!stdin_is_dev_null) + if (master >= 0 && !stdin_is_dev_null) FD_SET(0, &rfds); FD_SET(_dpkgin, &rfds); if(master >= 0) @@@ -1117,14 -1059,11 +1117,14 @@@ RunScripts("DPkg::Post-Invoke"); if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) - _error->Error("Sub-process %s received a segmentation fault.",Args[0]); + strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]); else if (WIFEXITED(Status) != 0) - _error->Error("Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status)); + strprintf(dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status)); else - _error->Error("Sub-process %s exited unexpectedly",Args[0]); + strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]); + + if(dpkg_error.size() > 0) + _error->Error(dpkg_error.c_str()); if(stopOnError) { diff --combined debian/changelog index 834c86fcc,dbeed4502..69edf559b --- a/debian/changelog +++ b/debian/changelog @@@ -15,34 -15,32 +15,52 @@@ apt (0.7.26) UNRELEASED; urgency=lo - allow also to skip the last patch if target is reached, thanks Bernhard R. Link! (Closes: #545699) * ftparchive/writer.{cc,h}: + - add --arch option for packages and contents commands + - if an arch is given accept only *_all.deb and *_arch.deb instead + of *.deb. Thanks Stephan Bosch for the patch! (Closes: #319710) - add APT::FTPArchive::AlwaysStat to disable the too aggressive caching if versions are build multiply times (not recommend) Patch by Christoph Goehre, thanks! (Closes: #463260) + * apt-pkg/deb/dpkgpm.cc: + - stdin redirected to /dev/null takes all CPU (Closes: #569488) + Thanks to Aurelien Jarno for providing (again) a patch! + * buildlib/apti18n.h.in, po/makefile: + - add ngettext support with P_() + * aptconfiguration.cc: + - include all existing Translation files in the Cache (Closes: 564137) + * debian/control: + - update with no changes to debian policy 3.8.4 + * doc/apt_preferences.5.xml: + - explicitly warn against careless use (Closes: #567669) + * debian/rules: + - remove creation of empty dir /usr/share/apt + * doc/apt-cdrom.8.xml: + - fix typo spotted by lintian: proc(c)eed [ Ivan Masár ] * Slovak translation update. Closes: #568294 + + [ Michael Vogt ] + * [BREAK] merged lp:~mvo/apt/history + - this writes a /var/log/apt/history tagfile that contains details + from the transaction (complements term.log) + * methods/http.cc: + - add cache-control headers even if no cache is given to allow + adding options for intercepting proxies + - add Acquire::http::ProxyAutoDetect configuration that + can be used to call a external helper to figure out the + proxy configuration and return it to apt via stdout + (this is a step towards WPAD and zeroconf/avahi support) + * abicheck/ + - add new abitest tester using the ABI Compliance Checker from + http://ispras.linuxfoundation.org/index.php/ABI_compliance_checker - -- David Kalnischkies Sat, 13 Feb 2010 01:42:50 +0100 + [ Robert Collins ] + * Change the package index Info methods to allow apt-cache policy to be + useful when using several different archives on the same host. + (Closes: #329814, LP: #22354) + + -- Michael Vogt Fri, 18 Dec 2009 16:54:18 +0100 apt (0.7.25.3) unstable; urgency=low @@@ -51,7 -49,7 +69,7 @@@ [ David Kalnischkies ] * apt-pkg/contrib/macros.h: - - install the header system.h with a new name to be able to use + - install the header system.h with a new name to be able to use it in other headers (Closes: #567662) * cmdline/acqprogress.cc: - Set Mode to Medium so that the correct prefix is used. @@@ -60,7 -58,7 +78,7 @@@ - generate sha1 and sha256 checksums for dsc (Closes: #567343) * cmdline/apt-get.cc: - don't mark as manually if in download only (Closes: #468180) - + -- Michael Vogt Mon, 01 Feb 2010 18:41:15 +0100 apt (0.7.25.2) unstable; urgency=low @@@ -84,7 -82,7 +102,7 @@@ packages that are not in the extended_states file yet (closes: #534920) * ftparchive/writer.{cc,h}: - - merge crash fix for apt-ftparchive on hurd, thanks to + - merge crash fix for apt-ftparchive on hurd, thanks to Samuel Thibault for the patch (closes: #566664) [ David Kalnischkies ] @@@ -123,7 -121,7 +141,7 @@@ apt (0.7.25.1) unstable; urgency=lo * French manpage translation update * Russian translation update by Yuri Kozlov Closes: #564171 - + [Chris Leick] * spot & fix various typos in all manpages * German manpage translation update