#ifndef ZYPP_ZYPPCALLBACKS_H
#define ZYPP_ZYPPCALLBACKS_H
+#include "zypp/base/EnumClass.h"
#include "zypp/Callback.h"
+#include "zypp/UserData.h"
#include "zypp/Resolvable.h"
#include "zypp/RepoInfo.h"
#include "zypp/Pathname.h"
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ {
+ class Queue;
+ class FileConflicts;
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+
struct ProgressReport : public callback::ReportBase
{
virtual void start( const ProgressData &/*task*/ )
INVALID // the downloaded file is invalid
};
+ /** Hint that package is available in the local cache (no download needed).
+ * This will be the only trigger for an already cached package.
+ */
+ virtual void infoInCache( Resolvable::constPtr res_r, const Pathname & localfile_r )
+ {}
+
virtual void start(
Resolvable::constPtr /*resolvable_ptr*/
, const Url &/*url*/
virtual void finishDeltaApply()
{}
- // Dowmload patch rpm:
- // - path below url reported on start()
- // - expected download size (0 if unknown)
- // - download is interruptable
- virtual void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
- {}
-
- virtual bool progressPatchDownload( int /*value*/ )
- { return true; }
-
- virtual void problemPatchDownload( const std::string &/*description*/ )
- {}
-
- virtual void finishPatchDownload()
- {}
-
-
// return false if the download should be aborted right now
virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable_ptr*/)
{ return true; }
, const std::string &/*description*/
) { return ABORT; }
+
+ /** Detail information about the result of a performed pkgGpgCheck.
+ *
+ * Userdata sent:
+ * \param "Package" Package::constPtr of the package
+ * \param "Localpath" Pathname to downloaded package on disk
+ * \param "CheckPackageResult" RpmDb::CheckPackageResult of signature check
+ * \param "CheckPackageDetail" RpmDb::CheckPackageDetail logmessages of rpm signature check
+ *
+ * Userdata accepted:
+ * \param "Action" DownloadResolvableReport::Action user advice how to behave on error (ABORT).
+ * If you set just an empty value here, a default probelm report will be triggered.
+ */
+ virtual void pkgGpgCheck( const UserData & userData_r = UserData() )
+ {}
+
virtual void finish(Resolvable::constPtr /*resolvable_ptr*/
, Error /*error*/
, const std::string &/*reason*/
) { return ABORT; }
};
+ ///////////////////////////////////////////////////////////////////
+ /// \class ScopedDisableMediaChangeReport
+ /// \brief Temporarily disable MediaChangeReport
+ /// Sometimes helpful to suppress interactive messages connected to
+ /// MediaChangeReport while fallback URLs are avaialble.
+ struct ScopedDisableMediaChangeReport
+ {
+ /** Disbale MediaChangeReport if \a condition_r is \c true.*/
+ ScopedDisableMediaChangeReport( bool condition_r = true );
+ private:
+ shared_ptr<callback::TempConnect<media::MediaChangeReport> > _guard;
+ };
+
// progress for downloading a file
struct DownloadProgressReport : public callback::ReportBase
{
};
///////////////////////////////////////////////////////////////////
+ /// \class FindFileConflictstReport
+ /// \brief Check for package file conflicts in commit (after download)
+ ///
+ /// File conflict check requires that all packages are downloaded and
+ /// now available in the cache (need to access the filelists). Missing
+ /// packages are omitted from check and their number is reported in
+ /// \a noFilelist_r. This usually happens if download mode 'as-needed'
+ /// is used.
+ ///////////////////////////////////////////////////////////////////
+ struct FindFileConflictstReport : public callback::ReportBase
+ {
+ /**
+ * \param progress_r Progress counter for packages to check.
+ * \return \c true to continue, \c false upon user abort request.
+ */
+ virtual bool start( const ProgressData & progress_r )
+ { return true; }
+
+ /**
+ * \param progress_r Progress counter for packages to check.
+ * \param noFilelist_r Queue of so far skipped solvables (no filelist/not yet downloaded).
+ * \return \c true to continue, \c false upon user abort request.
+ */
+ virtual bool progress( const ProgressData & progress_r, const sat::Queue & noFilelist_r )
+ { return true; }
+
+ /**
+ * \param progress_r Progress counter for packages to check.
+ * \param noFilelist_r Queue of skipped solvables (no filelist/not yet downloaded).
+ * \param conflicts_r File conflits queue.
+ * \return \c true to continue, \c false upon user abort request.
+ */
+ virtual bool result( const ProgressData & progress_r, const sat::Queue & noFilelist_r, const sat::FileConflicts & conflicts_r )
+ { return true; }
+ };
+
+
+ ///////////////////////////////////////////////////////////////////
namespace rpm
{
) {}
};
+ ///////////////////////////////////////////////////////////////////
+ /// \class JobReport
+ /// \brief Generic report for sending messages.
+ ///////////////////////////////////////////////////////////////////
+ struct JobReport : public callback::ReportBase
+ {
+ public:
+ /** message type (use like 'enum class \ref MsgType') */
+ struct EMsgTypeDef {
+ enum Enum { debug, info, warning, error, important, data };
+ };
+ typedef base::EnumClass<EMsgTypeDef> MsgType; ///< 'enum class MsgType'
+
+ /** typsafe map of userdata */
+ typedef callback::UserData UserData;
+
+ public:
+ /** Send a ready to show message text. */
+ virtual bool message( MsgType type_r, const std::string & msg_r, const UserData & userData_r ) const
+ { return true; }
+
+
+ /** \name Static sender instance */
+ //@{
+ /** Singleton sender instance */
+ static callback::SendReport<JobReport> & instance(); // impl in ZYppImpl.cc
+
+ /** send debug message text */
+ static bool debug( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::debug, msg_r, userData_r ); }
+
+ /** send message text */
+ static bool info( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::info, msg_r, userData_r ); }
+
+ /** send warning text */
+ static bool warning( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::warning, msg_r, userData_r ); }
+
+ /** send error text */
+ static bool error( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::error, msg_r, userData_r ); }
+
+ /** send important message text */
+ static bool important( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::important, msg_r, userData_r ); }
+
+ /** send data message */
+ static bool data( const std::string & msg_r, const UserData & userData_r = UserData() )
+ { return instance()->message( MsgType::data, msg_r, userData_r ); }
+ //@}
+ };
+
/////////////////////////////////////////////////////////////////
} // namespace zypp