From da9ed163ca5ebe6dd33fda2679107bcbd3ffaa71 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 30 Apr 2006 10:58:28 +0200 Subject: * string i18n handling fixes (debian bug #349298) --- apt-inst/deb/dpkgdb.cc | 2 +- methods/gpgv.cc | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/apt-inst/deb/dpkgdb.cc b/apt-inst/deb/dpkgdb.cc index c6a0e80e6..718e1ab98 100644 --- a/apt-inst/deb/dpkgdb.cc +++ b/apt-inst/deb/dpkgdb.cc @@ -383,7 +383,7 @@ bool debDpkgDB::ReadyFileList(OpProgress &Progress) return _error->Error(_("The pkg cache must be initialized first")); if (FList != 0) { - Progress.OverallProgress(1,1,1,_("Reading file list")); + Progress.OverallProgress(1,1,1,_("Reading file listing")); return true; } diff --git a/methods/gpgv.cc b/methods/gpgv.cc index a114ad797..75335b9b8 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -11,6 +11,7 @@ #include #include #include +#include #define GNUPGPREFIX "[GNUPG:]" #define GNUPGBADSIG "[GNUPG:] BADSIG" @@ -20,7 +21,7 @@ class GPGVMethod : public pkgAcqMethod { private: - const char *VerifyGetSigners(const char *file, const char *outfile, + string VerifyGetSigners(const char *file, const char *outfile, vector &GoodSigners, vector &BadSigners, vector &NoPubKeySigners); @@ -32,11 +33,15 @@ class GPGVMethod : public pkgAcqMethod GPGVMethod() : pkgAcqMethod("1.0",SingleInstance | SendConfig) {}; }; -const char *GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, +string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, vector &GoodSigners, vector &BadSigners, vector &NoPubKeySigners) { + // setup a (empty) stringstream for formating the return value + std::stringstream ret; + res.str(""); + if (_config->FindB("Debug::Acquire::gpgv", false)) { std::cerr << "inside VerifyGetSigners" << std::endl; @@ -54,9 +59,11 @@ const char *GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, std::cerr << "Keyring path: " << pubringpath << std::endl; } - if (stat(pubringpath.c_str(), &buff) != 0) - return (string("Couldn't access keyring: ") + strerror(errno)).c_str(); - + if (stat(pubringpath.c_str(), &buff) != 0) + { + ioprintf(ret, _("Couldn't access keyring: '%s'"), strerror(errno)); + return ret.str(); + } if (pipe(fd) < 0) { return "Couldn't create pipe"; @@ -65,7 +72,7 @@ const char *GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, pid = fork(); if (pid < 0) { - return (string("Couldn't spawn new process") + strerror(errno)).c_str(); + return string("Couldn't spawn new process") + strerror(errno); } else if (pid == 0) { @@ -189,7 +196,7 @@ const char *GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, { if (GoodSigners.empty()) return _("Internal error: Good signature, but could not determine key fingerprint?!"); - return NULL; + return ""; } else if (WEXITSTATUS(status) == 1) { @@ -197,9 +204,8 @@ const char *GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, } else if (WEXITSTATUS(status) == 111) { - // FIXME String concatenation considered harmful. - return (string(_("Could not execute ")) + gpgvpath + - string(_(" to verify signature (is gnupg installed?)"))).c_str(); + ioprintf(ret, _("Could not execute '%s' to verify signature (is gnupg installed?)"), gpgvpath.c_str()); + return ret.str(); } else { @@ -221,8 +227,8 @@ bool GPGVMethod::Fetch(FetchItem *Itm) URIStart(Res); // Run gpgv on file, extract contents and get the key ID of the signer - const char *msg = VerifyGetSigners(Path.c_str(), Itm->DestFile.c_str(), - GoodSigners, BadSigners, NoPubKeySigners); + string msg = VerifyGetSigners(Path.c_str(), Itm->DestFile.c_str(), + GoodSigners, BadSigners, NoPubKeySigners); if (GoodSigners.empty() || !BadSigners.empty() || !NoPubKeySigners.empty()) { string errmsg; -- cgit v1.2.3 From b2c220756c2c571595765ca23da48c611b88d057 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 1 May 2006 16:17:08 +0200 Subject: * methods/gpgv.cc: typo --- methods/gpgv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 75335b9b8..ba7389cba 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -40,7 +40,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, { // setup a (empty) stringstream for formating the return value std::stringstream ret; - res.str(""); + ret.str(""); if (_config->FindB("Debug::Acquire::gpgv", false)) { -- cgit v1.2.3 From e86080159e32b2dd2354c037441a49f1ee0a62dd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 1 May 2006 16:38:49 +0200 Subject: * debian/postinst: - check for exmaple sources.list before coping it (Bug#361130) --- debian/postinst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/postinst b/debian/postinst index 891792111..1588f5241 100755 --- a/debian/postinst +++ b/debian/postinst @@ -12,7 +12,10 @@ set -e create_apt_conf () { - cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list + EXAMPLE_SOURCE=/usr/share/doc/apt/examples/sources.list + if [ -f $EXAMPLE_SOURCE ]; then + cp $EXAMPLE_SOURCE /etc/apt/sources.list + fi } check_apt_conf () -- cgit v1.2.3