diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-05-10 18:51:29 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-05-10 18:51:29 +0200 |
commit | f1bdfe81560b110dbf1ee6f5f7fa8c98423ef345 (patch) | |
tree | f813d28c771668e5ad55d2d0b08accb10987379b | |
parent | c34ea12ad509cb34c954ed574a301c3cbede55ec (diff) |
fix order of CurrentURI and UsedMirror in Status() and Log()
-rw-r--r-- | apt-pkg/acquire-method.cc | 38 | ||||
-rw-r--r-- | apt-pkg/acquire-method.h | 3 | ||||
-rw-r--r-- | debian/changelog | 3 |
3 files changed, 25 insertions, 19 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 2f29f7932..e9e102488 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -23,7 +23,6 @@ #include <apt-pkg/hashes.h> #include <iostream> -#include <stdarg.h> #include <stdio.h> #include <sys/signal.h> /*}}}*/ @@ -375,23 +374,34 @@ int pkgAcqMethod::Run(bool Single) return 0; } /*}}}*/ -// AcqMethod::Log - Send a log message /*{{{*/ +// AcqMethod::PrintStatus - privately really send a log/status message /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqMethod::Log(const char *Format,...) +void pkgAcqMethod::PrintStatus(char const * const header, const char* Format, + va_list &args) const { string CurrentURI = "<UNKNOWN>"; if (Queue != 0) CurrentURI = Queue->Uri; - fprintf(stdout, "101 Log\nURI: %s\nUsedMirror: %s\nMessage: ", - UsedMirror.c_str(), CurrentURI.c_str()); - + if (UsedMirror.empty() == true) + fprintf(stdout, "%s\nURI: %s\nMessage: ", + header, CurrentURI.c_str()); + else + fprintf(stdout, "%s\nURI: %s\nUsedMirror: %s\nMessage: ", + header, CurrentURI.c_str(), UsedMirror.c_str()); + vfprintf(stdout,Format,args); + std::cout << "\n\n" << std::flush; +} + /*}}}*/ +// AcqMethod::Log - Send a log message /*{{{*/ +// --------------------------------------------------------------------- +/* */ +void pkgAcqMethod::Log(const char *Format,...) +{ va_list args; va_start(args,Format); - vfprintf(stdout,Format,args); + PrintStatus("101 Log", Format, args); va_end(args); - - std::cout << "\n\n" << std::flush; } /*}}}*/ // AcqMethod::Status - Send a status message /*{{{*/ @@ -399,18 +409,10 @@ void pkgAcqMethod::Log(const char *Format,...) /* */ void pkgAcqMethod::Status(const char *Format,...) { - string CurrentURI = "<UNKNOWN>"; - if (Queue != 0) - CurrentURI = Queue->Uri; - fprintf(stdout, "102 Status\nURI: %s\nUsedMirror: %s\nMessage: ", - UsedMirror.c_str(), CurrentURI.c_str()); - va_list args; va_start(args,Format); - vfprintf(stdout,Format,args); + PrintStatus("102 Status", Format, args); va_end(args); - - std::cout << "\n\n" << std::flush; } /*}}}*/ // AcqMethod::Redirect - Send a redirect message /*{{{*/ diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 03851e823..72efa8065 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -23,6 +23,7 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> +#include <stdarg.h> class Hashes; class pkgAcqMethod @@ -78,6 +79,8 @@ class pkgAcqMethod bool MediaFail(string Required,string Drive); virtual void Exit() {}; + void PrintStatus(char const * const header, const char* Format, va_list &args) const; + public: enum CnfFlags {SingleInstance = (1<<0), Pipeline = (1<<1), SendConfig = (1<<2), diff --git a/debian/changelog b/debian/changelog index 125fa7f70..9f4edc0ee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low * apt-pkg/acquire-method.cc: - write directly to stdout instead of creating the message in memory first before writing to avoid hitting limits + - fix order of CurrentURI and UsedMirror in Status() and Log() * apt-pkg/orderlist.cc: - let VisitRProvides report if the calls were successful * apt-pkg/deb/dpkgpm.cc: @@ -53,7 +54,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low - dequote URL taken from Location in redirects as we will otherwise quote an already quoted string in the request later (Closes: #602412) - -- David Kalnischkies <kalnischkies@gmail.com> Tue, 10 May 2011 15:49:19 +0200 + -- David Kalnischkies <kalnischkies@gmail.com> Tue, 10 May 2011 18:51:15 +0200 apt (0.8.14.1) unstable; urgency=low |