diff --git a/package/yast2-pkg-bindings.changes b/package/yast2-pkg-bindings.changes index 282f879..b61b066 100644 --- a/package/yast2-pkg-bindings.changes +++ b/package/yast2-pkg-bindings.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jan 31 20:19:20 UTC 2025 - Josef Reidinger + +- Deprecated callbacks that is deprecated and no longer used + in libzypp (gh#yast/yast-pkg-bindings#191) +- 5.0.5 + ------------------------------------------------------------------- Thu Jan 18 14:18:02 UTC 2024 - Ladislav Slezák diff --git a/package/yast2-pkg-bindings.spec b/package/yast2-pkg-bindings.spec index 4ab68ba..074e4bd 100644 --- a/package/yast2-pkg-bindings.spec +++ b/package/yast2-pkg-bindings.spec @@ -17,7 +17,7 @@ Name: yast2-pkg-bindings -Version: 5.0.4 +Version: 5.0.5 Release: 0 Summary: YaST2 - Package Manager Access License: GPL-2.0-only diff --git a/src/Callbacks.cc b/src/Callbacks.cc index a71c7b1..b8f67d3 100644 --- a/src/Callbacks.cc +++ b/src/Callbacks.cc @@ -1135,380 +1135,6 @@ namespace ZyppRecipients { } }; - struct SourceCreateReceive : public Recipient, public zypp::callback::ReceiveReport - { - SourceCreateReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {} - - virtual void reportbegin() - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateInit ) ); - y2debug("Repo Create begin"); - - if (callback._set) - { - callback.evaluate(); - } - } - - virtual void reportend() - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateDestroy ) ); - y2debug("Repo Create destroy"); - - if (callback._set) - { - callback.evaluate(); - } - } - - virtual void start( const zypp::Url &url ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateStart ) ); - - if (callback._set) - { - callback.addStr(url); - - callback.evaluate(); - } - } - - virtual bool progress( int value ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateProgress ) ); - - if (callback._set) - { - callback.addInt(value); - - return callback.evaluateBool(); - } - - return zypp::repo::RepoCreateReport::progress(value); - } - - std::string CreateSrcErrorAsString(zypp::repo::RepoCreateReport::Error error) - { - // convert enum to string - std::string error_str; - - switch(error) - { - // no error - case zypp::repo::RepoCreateReport::NO_ERROR : error_str = "NO_ERROR"; break; - // the requested Url was not found - case zypp::repo::RepoCreateReport::NOT_FOUND : error_str = "NOT_FOUND"; break; - // IO error - case zypp::repo::RepoCreateReport::IO : error_str = "IO"; break; - // the source is invalid - case zypp::repo::RepoCreateReport::INVALID : error_str = "INVALID"; break; - // rejected - case zypp::repo::RepoCreateReport::REJECTED : error_str = "REJECTED"; break; - // unknown error - case zypp::repo::RepoCreateReport::UNKNOWN : error_str = "UNKNOWN"; break; - } - - return error_str; - } - - virtual Action problem( const zypp::Url &url, zypp::repo::RepoCreateReport::Error error, const std::string &description ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateError ) ); - - if ( callback._set ) - { - callback.addStr(url); - callback.addSymbol(CreateSrcErrorAsString(error)); - callback.addStr(description); - - std::string result = callback.evaluateSymbol(); - - // check the returned symbol - if ( result == "ABORT" ) return zypp::repo::RepoCreateReport::ABORT; - if ( result == "RETRY" ) return zypp::repo::RepoCreateReport::RETRY; - - // still here? - y2error("Unexpected symbol '%s' returned from callback.", result.c_str()); - // return default - } - - // return the default implementation - return zypp::repo::RepoCreateReport::problem(url, error, description); - } - - virtual void finish( const zypp::Url &url, zypp::repo::RepoCreateReport::Error error, const std::string &reason ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceCreateEnd ) ); - - if (callback._set) - { - callback.addStr(url); - callback.addSymbol(CreateSrcErrorAsString(error)); - callback.addStr(reason); - - callback.evaluate(); - } - } - }; - - /////////////////////////////////////////////////////////////////// - // ProbeSourceReceive - /////////////////////////////////////////////////////////////////// - struct ProbeSourceReceive : public Recipient, public zypp::callback::ReceiveReport - { - ProbeSourceReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {} - - virtual void start(const zypp::Url &url) - { - _silent_probing = MEDIA_CHANGE_DISABLE; - - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeStart ) ); - - if (callback._set) - { - callback.addStr(url); - - callback.evaluate(); - } - } - - virtual void failedProbe( const zypp::Url &url, const std::string &type ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeFailed ) ); - - if (callback._set) - { - callback.addStr(url); - callback.addStr(type); - - callback.evaluate(); - } - } - - virtual void successProbe( const zypp::Url &url, const std::string &type ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeSucceeded ) ); - - if (callback._set) - { - callback.addStr(url); - callback.addStr(type); - - callback.evaluate(); - } - } - - std::string ProbeSrcErrorAsString(zypp::repo::ProbeRepoReport::Error error) - { - // convert enum to string - std::string error_str; - - switch(error) - { - // no error - case zypp::repo::ProbeRepoReport::NO_ERROR : error_str = "NO_ERROR"; break; - // the requested Url was not found - case zypp::repo::ProbeRepoReport::NOT_FOUND : error_str = "NOT_FOUND"; break; - // IO error - case zypp::repo::ProbeRepoReport::IO : error_str = "IO"; break; - // the source is invalid - case zypp::repo::ProbeRepoReport::INVALID : error_str = "INVALID"; break; - // unknow error - case zypp::repo::ProbeRepoReport::UNKNOWN : error_str = "UNKNOWN"; break; - } - - return error_str; - } - - virtual void finish(const zypp::Url &url, zypp::repo::ProbeRepoReport::Error error, const std::string &reason ) - { - _silent_probing = MEDIA_CHANGE_FULL; - - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeEnd ) ); - - if (callback._set) - { - callback.addStr(url); - callback.addSymbol(ProbeSrcErrorAsString(error)); - callback.addStr(reason); - - callback.evaluate(); - } - } - - virtual bool progress(const zypp::Url &url, int value) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeProgress ) ); - - if (callback._set) - { - callback.addStr(url); - callback.addInt(value); - - return callback.evaluateBool(); - } - - return zypp::repo::ProbeRepoReport::progress(url, value); - return true; - } - - virtual zypp::repo::ProbeRepoReport::Action problem( const zypp::Url &url, zypp::repo::ProbeRepoReport::Error error, const std::string &description ) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceProbeError ) ); - - if ( callback._set ) - { - callback.addStr(url); - callback.addSymbol(ProbeSrcErrorAsString(error)); - callback.addStr(description); - - std::string result = callback.evaluateSymbol(); - - // check the returned symbol - if ( result == "ABORT" ) return zypp::repo::ProbeRepoReport::ABORT; - if ( result == "RETRY" ) return zypp::repo::ProbeRepoReport::RETRY; - - // still here? - y2error("Unexpected symbol '%s' returned from callback.", result.c_str()); - // return default - } - - // return the default value - return zypp::repo::ProbeRepoReport::problem(url, error, description); - } - }; - - - struct RepoReport : public Recipient, public zypp::callback::ReceiveReport - { - const PkgFunctions &_pkg_ref; - virtual void reportbegin() - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportInit ) ); - y2debug("Source Report begin"); - - if (callback._set) - { - callback.evaluate(); - } - } - - virtual void reportend() - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportDestroy ) ); - y2debug("Source Report end"); - - if (callback._set) - { - callback.evaluate(); - } - } - - RepoReport( RecipientCtl & construct_r, const PkgFunctions &pk ) : Recipient( construct_r ), _pkg_ref(pk) {} - - virtual void start(const zypp::ProgressData &task, const zypp::RepoInfo repo) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportStart ) ); - - if (callback._set) - { - callback.addInt(_pkg_ref.logFindAlias(repo.alias())); - callback.addStr(repo.url().asString()); - callback.addStr(task.name()); - - callback.evaluate(); - } - } - - virtual bool progress(const zypp::ProgressData &task) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportProgress ) ); - - if (callback._set) - { - callback.addInt(task.reportValue()); - - return callback.evaluateBool(); - } - - return zypp::repo::RepoReport::progress(task); - } - - std::string SrcReportErrorAsString(zypp::repo::RepoReport::Error error) - { - // convert enum to string - std::string error_str; - - switch(error) - { - // no error - case zypp::repo::RepoReport::NO_ERROR : error_str = "NO_ERROR"; break; - // the requested Url was not found - case zypp::repo::RepoReport::NOT_FOUND : error_str = "NOT_FOUND"; break; - // IO error - case zypp::repo::RepoReport::IO : error_str = "IO"; break; - // the source is invalid - case zypp::repo::RepoReport::INVALID : error_str = "INVALID"; break; - } - - return error_str; - } - - virtual zypp::repo::RepoReport::Action problem(zypp::Repository source, - zypp::repo::RepoReport::Error error, const std::string &description) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportError ) ); - - // the file is optional, ignore the error - if (_silent_probing == ZyppRecipients::MEDIA_CHANGE_OPTIONALFILE) - { - y2milestone("The file is optional, ignoring the error"); - return zypp::repo::RepoReport::IGNORE; - } - - if ( callback._set ) - { - // search Yast source ID - callback.addInt(_pkg_ref.logFindAlias(source.info().alias())); - callback.addStr(source.info().url().asString()); - callback.addSymbol(SrcReportErrorAsString(error)); - callback.addStr(description); - - std::string result = callback.evaluateSymbol(); - - // check the returned symbol - if ( result == "ABORT" ) return zypp::repo::RepoReport::ABORT; - if ( result == "RETRY" ) return zypp::repo::RepoReport::RETRY; - if ( result == "IGNORE" ) return zypp::repo::RepoReport::IGNORE; - - // still here? - y2error("Unexpected symbol '%s' returned from callback.", result.c_str()); - // return default - } - - // return the default value - return zypp::repo::RepoReport::problem(source, error, description); - } - - virtual void finish(zypp::Repository source, const std::string &task, - zypp::repo::RepoReport::Error error, const std::string &reason) - { - CB callback( ycpcb( YCPCallbacks::CB_SourceReportEnd ) ); - - if (callback._set) - { - // search Yast source ID - callback.addInt(_pkg_ref.logFindAlias(source.info().alias())); - callback.addStr(source.info().url().asString()); - callback.addStr(task); - callback.addSymbol(SrcReportErrorAsString(error)); - callback.addStr(reason); - - callback.evaluate(); - } - } - }; - /////////////////////////////////////////////////////////////////// // DigestReport handler /////////////////////////////////////////////////////////////////// @@ -1810,11 +1436,6 @@ class PkgFunctions::CallbackHandler::ZyppReceive : public ZyppRecipients::Recipi ZyppRecipients::ScriptExecReceive _scriptExecReceive; ZyppRecipients::MessageReceive _messageReceive; - // source manager callback - ZyppRecipients::SourceCreateReceive _sourceCreateReceive; - ZyppRecipients::RepoReport _sourceReport; - ZyppRecipients::ProbeSourceReceive _probeSourceReceive; - ZyppRecipients::ProgressReceive _progressReceive; // digest callback @@ -1842,9 +1463,6 @@ class PkgFunctions::CallbackHandler::ZyppReceive : public ZyppRecipients::Recipi , _downloadProgressReceive( *this ) , _scriptExecReceive( *this ) , _messageReceive( *this ) - , _sourceCreateReceive( *this ) - , _sourceReport( *this, pkg) - , _probeSourceReceive( *this ) , _progressReceive( *this ) , _digestReceive( *this ) , _keyRingReceive( *this, pkg ) @@ -1861,9 +1479,6 @@ class PkgFunctions::CallbackHandler::ZyppReceive : public ZyppRecipients::Recipi _downloadProgressReceive.connect(); _scriptExecReceive.connect(); _messageReceive.connect(); - _sourceCreateReceive.connect(); - _sourceReport.connect(); - _probeSourceReceive.connect(); _progressReceive.connect(); _digestReceive.connect(); _keyRingReceive.connect(); @@ -1883,9 +1498,6 @@ class PkgFunctions::CallbackHandler::ZyppReceive : public ZyppRecipients::Recipi _downloadProgressReceive.disconnect(); _scriptExecReceive.disconnect(); _messageReceive.disconnect(); - _sourceCreateReceive.disconnect(); - _sourceReport.disconnect(); - _probeSourceReceive.disconnect(); _progressReceive.disconnect(); _digestReceive.disconnect(); _keyRingReceive.disconnect(); diff --git a/src/Callbacks_Register.cc b/src/Callbacks_Register.cc index ae3d86d..172c3d2 100644 --- a/src/Callbacks_Register.cc +++ b/src/Callbacks_Register.cc @@ -29,6 +29,7 @@ #include "Callbacks.h" #include "Callbacks.YCP.h" // PkgFunctions::CallbackHandler::YCPCallbacks #include "log.h" +#include /////////////////////////////////////////////////////////////////// @@ -340,183 +341,210 @@ YCPValue PkgFunctions::CallbackPkgGpgCheck( const YCPValue& args) /** * @builtin CallbackSourceCreateStart * @short Register callback function + * @deprecated libzypp never emit it * @param string args Name of the callback handler function. Required callback prototype is void(string url). The callback is evaluated when a source creation has been started. * @return void */ YCPValue PkgFunctions::CallbackSourceCreateStart( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateStart, args); + ycpmilestone("Pkg::CallbackSourceCreateStart is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProgressData + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is boolean(integer value). The callback function is evaluated when more than 5% of the data has been processed since the last evaluation. If the handler returns false the download is aborted. * @return void */ YCPValue PkgFunctions::CallbackSourceCreateProgress( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateProgress, args); + ycpmilestone("Pkg::CallbackSourceCreateProgress is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceCreateError + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is string(string url, string err_code, string description). err_code is "NO_ERROR", "NOT_FOUND" (the URL was not found), "IO" (I/O error) or "INVALID" (the source is not valid). The callback function must return "ABORT" or "RETRY". The callback function is evaluated when an error occurrs during creation of the source. * @return void */ YCPValue PkgFunctions::CallbackSourceCreateError( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateError, args); + ycpmilestone("Pkg::CallbackSourceCreateError is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceCreateEnd + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(string url, string err_code, string description). err_code is "NO_ERROR", "NOT_FOUND" (the URL was not found), "IO" (I/O error) or "INVALID" (the source is not valid). The callback function is evaluated when creation of the source has been finished. * @return void */ YCPValue PkgFunctions::CallbackSourceCreateEnd( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateEnd, args); + ycpmilestone("Pkg::CallbackSourceCreateEnd is obsolete and does nothing, remove it"); + return YCPVoid(); } - - - /** * @builtin CallbackSourceProbeStart + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(string url). The callback function is evaluated when source probing has been started. * @return void */ YCPValue PkgFunctions::CallbackSourceProbeStart( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeStart, args); + ycpmilestone("Pkg::CallbackSourceProbeStart is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProbeFailed + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(string url, string type). The callback function is evaluated when the probed source has different type. * @return void */ YCPValue PkgFunctions::CallbackSourceProbeFailed( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeFailed, args); + ycpmilestone("Pkg::CallbackSourceProbeFailed is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProbeSucceeded + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(string url, string type). The callback function is evaluated when the probed source has type type. * @return void */ YCPValue PkgFunctions::CallbackSourceProbeSucceeded( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeSucceeded, args); + ycpmilestone("Pkg::CallbackSourceProbeSucceeded is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProbeEnd + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(string url, string error, string reason). The callback function is evaluated when source probing has been finished. * @return void */ YCPValue PkgFunctions::CallbackSourceProbeEnd( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeEnd, args); + ycpmilestone("Pkg::CallbackSourceProbeEnd is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProbeProgress + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is boolean(integer value). If the handler returns false the refresh is aborted. * @return void */ YCPValue PkgFunctions::CallbackSourceProbeProgress( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeProgress, args); + ycpmilestone("Pkg::CallbackSourceProbeProgress is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceProbeError + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is string(string url, string error, string reason). The callback function is evaluated when an error occurrs. The callback function must return string "ABORT" or "RETRY". * @return void */ YCPValue PkgFunctions::CallbackSourceProbeError( const YCPValue& args) { - return SET_YCP_CB( CB_SourceProbeError, args); + ycpmilestone("Pkg::CallbackSourceProbeError is obsolete and does nothing, remove it"); + return YCPVoid(); } - YCPValue PkgFunctions::CallbackSourceReportInit( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportInit, args); + ycpmilestone("Pkg::CallbackSourceReportInit is obsolete and does nothing, remove it"); + return YCPVoid(); } YCPValue PkgFunctions::CallbackSourceReportDestroy( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportDestroy, args); + ycpmilestone("Pkg::CallbackSourceReportDestroy is obsolete and does nothing, remove it"); + return YCPVoid(); } YCPValue PkgFunctions::CallbackSourceCreateInit( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateInit, args); + ycpmilestone("Pkg::CallbackSourceCreateInit is obsolete and does nothing, remove it"); + return YCPVoid(); } YCPValue PkgFunctions::CallbackSourceCreateDestroy( const YCPValue& args) { - return SET_YCP_CB( CB_SourceCreateDestroy, args); + ycpmilestone("Pkg::CallbackSourceCreateDestroy is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceReportStart + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(integer source_id, string url, string task). * @return void */ YCPValue PkgFunctions::CallbackSourceReportStart( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportStart, args); + ycpmilestone("Pkg::CallbackSourceReportStart is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceReportProgress + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is boolean(integer value). If the handler returns false the task is aborted. * @return void */ YCPValue PkgFunctions::CallbackSourceReportProgress( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportProgress, args); + ycpmilestone("Pkg::CallbackSourceReportProgress is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceReportError + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is string(integer numeric_id, string url, string error, string reason). Parameter error is "NO_ERROR", "NOT_FOUND", "IO" or "INVALID". The callback function is evaluated when an error occurrs. The callback function must return string "ABORT", "IGNORE" or "RETRY". * @return void */ YCPValue PkgFunctions::CallbackSourceReportError( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportError, args); + ycpmilestone("Pkg::CallbackSourceReportError is obsolete and does nothing, remove it"); + return YCPVoid(); } /** * @builtin CallbackSourceReportEnd + * @deprecated libzypp never emit it * @short Register callback function * @param string args Name of the callback handler function. Required callback prototype is void(integer numeric_id, string url, string task, string error, string reason). Parameter error is "NO_ERROR", "NOT_FOUND", "IO" or "INVALID". The callback function is evaluated when an error occurrs. The callback function must return string "ABORT", "IGNORE" or "RETRY". * @return void */ YCPValue PkgFunctions::CallbackSourceReportEnd( const YCPValue& args) { - return SET_YCP_CB( CB_SourceReportEnd, args); + ycpmilestone("Pkg::CallbackSourceReportEnd is obsolete and does nothing, remove it"); + return YCPVoid(); } - YCPValue PkgFunctions::CallbackStartDownload( const YCPValue& args ) { return SET_YCP_CB( CB_StartDownload, args ); }