-DLOCALEDIR=\\\"${CMAKE_INSTALL_PREFIX}/share/locale\\\"
)
-SET( zypper_SRCS
- zypper.cc
- zypper-command.cc
- zypper-getopt.cc
- zypper-sources.cc
- zypper-misc.cc
- zypper-utils.cc
- zypper-search.cc
- zypper-info.cc
- zypper-tabulator.cc
- zypper-callbacks.cc
-)
-
SET (zypper_HEADERS
zypper.h
zypper-command.h
zypper-source-callbacks.h
)
+SET( zypper_SRCS
+ zypper.cc
+ zypper-command.cc
+ zypper-getopt.cc
+ zypper-sources.cc
+ zypper-misc.cc
+ zypper-utils.cc
+ zypper-search.cc
+ zypper-info.cc
+ zypper-tabulator.cc
+ zypper-callbacks.cc
+ ${zypper_HEADERS}
+)
+
+
+
ADD_EXECUTABLE( zypper ${zypper_SRCS} )
TARGET_LINK_LIBRARIES( zypper ${ZYPP_LIBRARY} ${READLINE_LIBRARY} )
#include <zypp/ZYppCallbacks.h>
#include <zypp/Pathname.h>
#include <zypp/KeyRing.h>
+#include <zypp/Repository.h>
#include <zypp/Digest.h>
#include <zypp/Url.h>
using zypp::media::MediaChangeReport;
using zypp::media::DownloadProgressReport;
+using zypp::Repository;
///////////////////////////////////////////////////////////////////
namespace ZmartRecipients
{
struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport<MediaChangeReport>
- {/*
- virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, const std::string & description )
- {
+ {
+ virtual MediaChangeReport::Action requestMedia( Repository repo,
+ unsigned mediumNr,
+ MediaChangeReport::Error error,
+ const std::string & description )
+ {
cout << "Please insert media [" << description << "] # " << mediumNr << ". Retry [y/n]: " << endl;
if (readBoolAnswer())
return MediaChangeReport::RETRY;
else
return MediaChangeReport::ABORT;
-
}
- */
};
// progress for downloading a file
public:
MediaCallbacks()
{
+ MIL << "Set media callbacks.." << endl;
_mediaChangeReport.connect();
_mediaDownloadReport.connect();
}
extern RuntimeData gData;
extern Settings gSettings;
+// return the default value on input failure
+// TODO make this locale dependent?
+bool read_bool_with_default (bool defval) {
+ istream & stm = cin;
+
+ string c = "";
+ while (stm.good () && c != "y" && c != "Y" && c != "N" && c != "n")
+ c = zypp::str::getline (stm, zypp::str::TRIM);
+
+ if (c == "y" || c == "Y")
+ return true;
+ else if (c == "n" || c == "N")
+ return false;
+ else
+ return defval;
+}
+
+// Read an answer (ynYN)
+// Defaults to 'false'
+bool readBoolAnswer()
+{
+ return read_bool_with_default (false);
+}
+
void cond_init_target () {
static bool done = false;