void display_progress (const string& s, int percent) {
static AliveCursor cursor;
- cerr_v << CLEARLN << cursor++ << " " << s << "[" << percent << "%]" << flush;
+ cout_v << CLEARLN << cursor++ << " " << s << "[" << percent << "%]" << flush;
}
void display_done () {
- cerr_v << endl;
+ cout_v << endl;
}
//template<typename Action>
//Action ...
int read_action_ari (int default_action) {
- cerr << _("(A)bort, (R)etry, (I)gnore?") << " "; // don't translate letters in parentheses!!
+ cout << _("(A)bort, (R)etry, (I)gnore?") << " "; // don't translate letters in parentheses!!
// non-interactive mode
if (gSettings.non_interactive) {
#include <string>
#include <zypp/Resolvable.h>
-// trying to compile for 10.1 where the callbacks had different signatures
-#ifdef LIBZYPP_1xx
-typedef std::string cbstring;
-typedef zypp::Url cbUrl;
-#else
-typedef const std::string& cbstring;
-typedef const zypp::Url& cbUrl;
-#endif
-
/*
enum Error {
NO_ERROR,
#include <stdlib.h>
#include <iostream>
+#include <boost/format.hpp>
+
#include <zypp/base/Logger.h>
#include <zypp/ZYppCallbacks.h>
#include <zypp/Pathname.h>
struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport<MediaChangeReport>
{
- virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, cbstring description )
+ virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, const std::string & description )
{
cout << "Please insert media [" << description << "] # " << mediumNr << ". Retry [y/n]: " << endl;
if (readBoolAnswer())
// progress for downloading a file
struct DownloadProgressReportReceiver : public zypp::callback::ReceiveReport<zypp::media::DownloadProgressReport>
{
- virtual void start( cbUrl file, zypp::Pathname localfile )
+ virtual void start( const zypp::Url & file, zypp::Pathname localfile )
{
- cerr_v << "Downloading: "
- << file << " to " << localfile << std::endl;
+ cout_v << CLEARLN << _("Downloading: ") << file;
+ cout_vv << " to " << localfile;
+ cout_v << std::endl;
}
- virtual bool progress(int value, cbUrl /*file*/)
+ virtual bool progress(int value, const zypp::Url & /*file*/)
{
display_progress ("Downloading", value);
return true;
}
- virtual DownloadProgressReport::Action problem( cbUrl /*file*/, DownloadProgressReport::Error error, cbstring description )
+ virtual DownloadProgressReport::Action problem( const zypp::Url & /*file*/, DownloadProgressReport::Error error, const std::string & description )
{
display_done ();
display_error (error, description);
return DownloadProgressReport::ABORT;
}
- virtual void finish( cbUrl /*file*/, Error error, cbstring konreason )
+ virtual void finish( const zypp::Url & /*file*/, Error error, const std::string & konreason )
{
display_done ();
display_error (error, konreason);
}
};
-
+
///////////////////////////////////////////////////////////////////
}; // namespace ZmartRecipients
///////////////////////////////////////////////////////////////////
return true;
}
- virtual Action problem( zypp::target::rpm::ScanDBReport::Error error, cbstring description )
+ virtual Action problem( zypp::target::rpm::ScanDBReport::Error error, const std::string & description )
{
return zypp::target::rpm::ScanDBReport::problem( error, description );
}
- virtual void finish( Error error, cbstring reason )
+ virtual void finish( Error error, const std::string & reason )
{
display_done ();
display_error (error, reason);
return true;
}
- virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, cbstring description )
+ virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description )
{
cerr << resolvable << endl;
display_error (error, description);
return (Action) read_action_ari ();
}
- virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, cbstring reason )
+ virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason )
{
display_done ();
display_error (error, reason);
return true;
}
- virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, cbstring description, RpmLevel level )
+ virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description, RpmLevel level )
{
cerr << resolvable << " " << description << std::endl;
cerr << level;
return (Action) read_action_ari ();
}
- virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, cbstring reason, RpmLevel level )
+ virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason, RpmLevel level )
{
display_done ();
if (error != NO_ERROR) {
cout << "Determining " << url << " source type..." << endl;
}
- virtual void failedProbe( const zypp::Url &/*url*/, cbstring type )
+ virtual void failedProbe( const zypp::Url &/*url*/, const std::string & type )
{
cout << ".. not " << type << endl;
}
- virtual void successProbe( const zypp::Url &url, cbstring type )
+ virtual void successProbe( const zypp::Url &url, const std::string & type )
{
cout << url << " is type " << type << endl;
}
- virtual void finish(const zypp::Url &/*url*/, Error error, cbstring reason )
+ virtual void finish(const zypp::Url &/*url*/, Error error, const std::string & reason )
{
if ( error == INVALID )
{
virtual bool progress(const zypp::Url &/*url*/, int /*value*/)
{ return true; }
- virtual Action problem( const zypp::Url &/*url*/, Error error, cbstring description )
+ virtual Action problem( const zypp::Url &/*url*/, Error error, const std::string & description )
{
display_done ();
display_error (error, description);
return true;
}
- virtual void problemDeltaDownload( cbstring description )
+ virtual void problemDeltaDownload( const std::string & description )
{
std::cerr << description << std::endl;
}
display_step( "Applying delta " /* + _delta.asString()*/, value );
}
- virtual void problemDeltaApply( cbstring description )
+ virtual void problemDeltaApply( const std::string & description )
{
std::cerr << description << std::endl;
}
return true;
}
- virtual void problemPatchDownload( cbstring description )
+ virtual void problemPatchDownload( const std::string & description )
{
std::cerr << description << std::endl;
}
}
- virtual void start( zypp::Resolvable::constPtr resolvable_ptr, cbUrl url )
+ virtual void start( zypp::Resolvable::constPtr resolvable_ptr, const zypp::Url & url )
{
_resolvable_ptr = resolvable_ptr;
_url = url;
return true;
}
- virtual Action problem( zypp::Resolvable::constPtr resolvable_ptr, Error /*error*/, cbstring description )
+ virtual Action problem( zypp::Resolvable::constPtr resolvable_ptr, Error /*error*/, const std::string & description )
{
std::cerr << description << std::endl;
return (Action) read_action_ari(ABORT);
}
- virtual void finish( zypp::Resolvable::constPtr /*resolvable_ptr*/, Error error, cbstring reason )
+ virtual void finish( zypp::Resolvable::constPtr /*resolvable_ptr*/, Error error, const std::string & reason )
{
display_done ();
display_error (error, reason);
#ifndef LIBZYPP_1xx
struct SourceReportReceiver : public zypp::callback::ReceiveReport<zypp::source::SourceReport>
{
- virtual void start( zypp::Source_Ref source, cbstring task )
+ virtual void start( zypp::Source_Ref source, const std::string & task )
{
_task = task;
_source = source;
return true;
}
- virtual Action problem( zypp::Source_Ref /*source*/, Error error, cbstring description )
+ virtual Action problem( zypp::Source_Ref /*source*/, Error error, const std::string & description )
{
display_done ();
display_error (error, description);
return (Action) read_action_ari ();
}
- virtual void finish( zypp::Source_Ref /*source*/, cbstring task, Error error, cbstring reason )
+ virtual void finish( zypp::Source_Ref /*source*/, const std::string & task, Error error, const std::string & reason )
{
display_step(100);
// many of these, avoid newline