{
if (_gopts.no_gpg_checks)
{
- MIL << "Accepting unsigned file (" << file << ")" << endl;
+ MIL << "Accepting unsigned file (" << file << ")" << std::endl;
Zypper::instance()->out().warning(boost::str(
boost::format(_("Accepting an unsigned file %s.")) % file),
Out::HIGH);
{
if (_gopts.no_gpg_checks)
{
- MIL << "Accepting file signed with an unknown key (" << file << "," << id << ")" << endl;
+ MIL << "Accepting file signed with an unknown key (" << file << "," << id << ")" << std::endl;
Zypper::instance()->out().warning(boost::str(boost::format(
_("Accepting file %s signed with an unknown key %s."))
% file % id));
if (_gopts.no_gpg_checks)
{
MIL << boost::format("Automatically trusting key id %s, %s, fingerprint %s")
- % keyid % keyname % fingerprint << endl;
+ % keyid % keyname % fingerprint << std::endl;
Zypper::instance()->out().info(boost::str(boost::format(
_("Automatically trusting key id %s, %s, fingerprint %s"))
% keyid % keyname % fingerprint));
MIL << boost::format(
"Ignoring failed signature verification for %s"
" with public key id %s, %s, fingerprint %s")
- % file % keyid % keyname % fingerprint << endl;
+ % file % keyid % keyname % fingerprint << std::endl;
Zypper::instance()->out().warning(boost::str(boost::format(
_("Ignoring failed signature verification for %s"
" with public key id %s, %s, fingerprint %s!\n"
{
WAR << boost::format(
"Ignoring failed digest verification for %s (expected %s, found %s).")
- % file % requested % found << endl;
+ % file % requested % found << std::endl;
Zypper::instance()->out().warning(boost::str(boost::format(
_("Ignoring failed digest verification for %s (expected %s, found %s)."))
% file % requested % found),
Zypper::instance()->out().prompt(
PROMPT_AUTH_USERNAME, description, PromptOptions(_("User Name"), 0));
- string username;
+ std::string username;
std::cin >> username;
auth_data_ptr->setUserName(username);
Zypper::instance()->out().prompt(
PROMPT_AUTH_PASSWORD, description, PromptOptions(_("Password"), 0));
- string password;
+ std::string password;
std::cin >> password;
if (password.empty()) return false;
auth_data_ptr->setPassword(password);
public:
MediaCallbacks()
{
- MIL << "Set media callbacks.." << endl;
+ MIL << "Set media callbacks.." << std::endl;
_mediaChangeReport.connect();
_mediaDownloadReport.connect();
_mediaAuthenticationReport.connect();
{
_delta = filename;
_delta_size = downloadsize;
- ostringstream s;
+ std::ostringstream s;
s << _("Downloading delta") << ": "
<< _delta << ", " << _delta_size;
Zypper::instance()->out().info(s.str());
virtual bool progressDeltaDownload( int value )
{
// seems this is never called, the progress is reported by the media backend anyway
- INT << "not impelmented" << endl;
+ INT << "not impelmented" << std::endl;
// TranslatorExplanation This text is a progress display label e.g. "Downloading delta [42%]"
//display_step( "apply-delta", ~("Downloading delta") /*+ _delta.asString()*/, value );
return true;
virtual void startDeltaApply( const zypp::Pathname & filename )
{
_delta = filename.basename();
- ostringstream s;
+ std::ostringstream s;
// translators: this text is a progress display label e.g. "Applying delta foo [42%]"
s << _("Applying delta") << ": " << _delta;
_label_apply_delta = s.str();
{
_patch = filename.basename();
_patch_size = downloadsize;
- ostringstream s;
+ std::ostringstream s;
s << _("Downloading patch rpm") << ": " << _patch << ", " << _patch_size;
Zypper::instance()->out().info(s.str());
}
virtual bool progressPatchDownload( int value )
{
// seems this is never called, the progress is reported by the media backend anyway
- INT << "not impelmented" << endl;
+ INT << "not impelmented" << std::endl;
// TranslatorExplanation This text is a progress display label e.g. "Applying patch rpm [42%]"
//display_step( "apply-delta", _("Applying patch rpm") /* + _patch.asString() */, value );
return true;
_url = url;
Zypper & zypper = *Zypper::instance();
- ostringstream s;
+ std::ostringstream s;
s << boost::format(_("Downloading %s %s-%s.%s"))
% kind_to_string_localized(_resolvable_ptr->kind(), 1)
% _resolvable_ptr->name()
virtual bool progress(int value, zypp::Resolvable::constPtr /*resolvable_ptr*/)
{
// seems this is never called, the progress is reported by the media backend anyway
- INT << "not impelmented" << endl;
+ INT << "not impelmented" << std::endl;
// TranslatorExplanation This text is a progress display label e.g. "Downloading [42%]"
// display_step( "download-resolvable", ~("Downloading") /* + resolvable_ptr->name() */, value );
return true;
virtual Action problem( zypp::Resolvable::constPtr resolvable_ptr, Error /*error*/, const std::string & description )
{
Zypper::instance()->out().error(description);
- DBG << "error report" << endl;
+ DBG << "error report" << std::endl;
Action action = (Action) read_action_ari(PROMPT_ARI_RPM_DOWNLOAD_PROBLEM, ABORT);
if (action == DownloadResolvableReport::RETRY)
#include <iostream>
#include <sstream>
+#include <ctime>
#include <boost/format.hpp>
#include "zypp/ZYppCallbacks.h"
#include "zypp/Package.h"
#include "zypp/Patch.h"
-//#include "zypp/target/rpm/RpmCallbacks.h"
#include "../Zypper.h"
#include "../prompt.h"
-using namespace std;
+
+static bool report_again(timespec * last)
+{
+ // don't report more often than 5 times per sec
+ timespec now;
+ clock_gettime(CLOCK_REALTIME, &now);
+ if (now.tv_sec > last->tv_sec ||
+ (now.tv_sec == last->tv_sec && now.tv_nsec > last->tv_nsec + 200000000L))
+ {
+ *last = now;
+ return true;
+ }
+ else
+ return false;
+}
///////////////////////////////////////////////////////////////////
namespace ZmartRecipients
virtual bool show( zypp::Patch::constPtr & patch )
{
Out & out = Zypper::instance()->out();
- ostringstream s;
+ std::ostringstream s;
s << patch; // [patch]important-patch-101 \todo make some meaningfull message out of this
out.info(s.str(), Out::HIGH);
out.info(patch->message());
_label = boost::str(
// TranslatorExplanation speaking of a script - "Running: script file name (package name, script dir)"
boost::format(_("Running: %s (%s, %s)")) % path_r.basename() % package->name() % path_r.dirname());
- cout << _label << endl;
+ std::cout << _label << std::endl;
}
/**
static bool was_ping_before = false;
if (kind == PING)
{
- cout << "." << flush;
+ std::cout << "." << std::flush;
was_ping_before = true;
}
else
{
if (was_ping_before)
- cout << endl;
- cout << output;
+ std::cout << std::endl;
+ std::cout << output;
was_ping_before = false;
}
struct RemoveResolvableReportReceiver : public zypp::callback::ReceiveReport<zypp::target::rpm::RemoveResolvableReport>
{
std::string _label;
+ timespec _last_reported;
virtual void start( zypp::Resolvable::constPtr resolvable )
{
+ ::clock_gettime(CLOCK_REALTIME, &_last_reported);
// translators: This text is a progress display label e.g. "Removing packagename-x.x.x [42%]"
_label = boost::str(boost::format(_("Removing %s-%s"))
% resolvable->name() % resolvable->edition());
virtual bool progress(int value, zypp::Resolvable::constPtr resolvable)
{
+ // don't report too often
+ if (!report_again(&_last_reported))
+ return true;
+
Zypper::instance()->out().progress("remove-resolvable", _label, value);
return true;
}
virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description )
{
Zypper::instance()->out().progressEnd("remove-resolvable", _label, true);
- ostringstream s;
+ std::ostringstream s;
s << boost::format(_("Removal of %s failed:")) % resolvable << std::endl;
s << zcb_error2str(error, description);
Zypper::instance()->out().error(s.str());
}
};
-ostream& operator << (ostream& stm, zypp::target::rpm::InstallResolvableReport::RpmLevel level) {
+std::ostream & operator << (std::ostream & stm,
+ zypp::target::rpm::InstallResolvableReport::RpmLevel level)
+{
static const char * level_s[] = {
// TranslatorExplanation --nodeps and --force are options of the rpm command, don't translate
//! \todo use format
{
zypp::Resolvable::constPtr _resolvable;
std::string _label;
-
+ timespec _last_reported;
+
void display_step( zypp::Resolvable::constPtr resolvable, int value )
{
}
virtual void start( zypp::Resolvable::constPtr resolvable )
{
+ clock_gettime(CLOCK_REALTIME, &_last_reported);
_resolvable = resolvable;
// TranslatorExplanation This text is a progress display label e.g. "Installing foo-1.1.2 [42%]"
_label = boost::str(boost::format(_("Installing: %s-%s"))
virtual bool progress(int value, zypp::Resolvable::constPtr resolvable)
{
+ // don't report too often
+ if (!report_again(&_last_reported))
+ return true;
+
Zypper::instance()->out().progress("install-resolvable", _label, value);
return true;
}
}
Zypper::instance()->out().progressEnd("install-resolvable", _label, true);
- ostringstream s;
+ std::ostringstream s;
s << boost::format(_("Installation of %s-%s failed:")) % resolvable->name() % resolvable->edition() << std::endl;
s << level << " " << zcb_error2str(error, description);
Zypper::instance()->out().error(s.str());
if (error != NO_ERROR && level < RPM_NODEPS_FORCE)
{
DBG << "level < RPM_NODEPS_FORCE: aborting without displaying an error"
- << endl;
+ << std::endl;
return;
}