Author: jkupec Date: Thu Jun 19 13:31:47 2008 New Revision: 10400 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10400&view=rev Log: - zypp-refresh: don't accept files with GPG problems (bnc #398530), report an error instead. Modified: trunk/zypper/src/zypp-refresh.cc Modified: trunk/zypper/src/zypp-refresh.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypp-refresh.cc?rev=10400&r1=10399&r2=10400&view=diff ============================================================================== --- trunk/zypper/src/zypp-refresh.cc (original) +++ trunk/zypper/src/zypp-refresh.cc Thu Jun 19 13:31:47 2008 @@ -29,6 +29,9 @@ #define ZYPP_REFRESH_LOG "/var/log/zypp-refresh.log" +using namespace std; +using namespace zypp; + // keyring and digest callbacks: accept everything, but don't import any keys /////////////////////////////////////////////////////////////////// @@ -36,7 +39,7 @@ /////////////////////////////////////////////////////////////////// static bool readCallbackAnswer() - { return true; } + { return false; } /////////////////////////////////////////////////////////////////// // KeyRingReceive @@ -44,23 +47,23 @@ struct KeyRingReceive : public zypp::callback::ReceiveReportzypp::KeyRingReport { virtual bool askUserToAcceptUnsignedFile( const std::string &file ) - { return readCallbackAnswer(); } - virtual bool askUserToAcceptUnknownKey( const std::string &/*file*/, const std::string &/*id*/ ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing unsigned file " << file << endl; return readCallbackAnswer(); } + virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id ) + { cerr << ". Error:" << endl << "refusing unknown key, id: '" << id << "' from file '" << file << "'" << endl; return readCallbackAnswer(); } virtual bool askUserToTrustKey( const PublicKey &key ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "not trusting key '" << key << "'" << endl;return readCallbackAnswer(); } virtual bool askUserToAcceptVerificationFailed( const std::string &file, const PublicKey &key ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "verification of '" << file << "' with key '" << key << "' failed" << endl; return readCallbackAnswer(); } }; struct DigestReceive : public zypp::callback::ReceiveReportzypp::DigestReport { virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': no digest" << endl; return readCallbackAnswer(); } virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': unknown digest" << endl; return readCallbackAnswer(); } virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': wrong digest" << endl; return readCallbackAnswer(); } }; /////////////////////////////////////////////////////////////////// }; // namespace zypp @@ -84,9 +87,6 @@ ~DigestCallbacks() { _digestReport.disconnect(); } }; -using namespace std; -using namespace zypp; - int main(int argc, char **argv) { const char *logfile = getenv("ZYPP_LOGFILE"); @@ -153,20 +153,19 @@ try { - cout << "refreshing '" << it->alias() << "' ."; + cout << "refreshing '" << it->alias() << "' ." << flush; manager.refreshMetadata(*it); - cout << "."; + cout << "." << flush; manager.buildCache(*it); cout << ". Done." << endl; } catch (const Exception &excpt_r ) { - cerr << ". Error." << endl; - // translators the first %s is the repository name and the second is an error message cerr + << " Error:" << endl << str::form( - "Could not refresh repository '%s':\n%s", - it->name().c_str(), excpt_r.msg().c_str()) + "Could not refresh repository '%s':\n%s\n%s", + it->name().c_str(), excpt_r.msg().c_str(), excpt_r.historyAsString().c_str()) << endl; ++errcount; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org