Author: lslezak Date: Wed Apr 22 16:25:13 2009 New Revision: 56917 URL: http://svn.opensuse.org/viewcvs/yast?rev=56917&view=rev Log: - new callbacks Pkg::CallbackSourceCreateInit/Destroy() and Pkg::CallbackSourceReportInit() - handle the ctor/dtor of libzypp callbacks (#251726) - 2.13.125 Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/ (props changed) branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/VERSION branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/package/yast2-pkg-bindings.changes branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.YCP.h branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.cc branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/PkgModuleFunctions.h branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Source.cc Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/VERSION?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/VERSION (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/VERSION Wed Apr 22 16:25:13 2009 @@ -1 +1 @@ -2.13.124 +2.13.125 Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/package/yast2-pkg-bindings.changes?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/package/yast2-pkg-bindings.changes Wed Apr 22 16:25:13 2009 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Wed Apr 22 13:30:43 CEST 2009 - lslezak@suse.cz + +- new callbacks Pkg::CallbackSourceCreateInit/Destroy() and + Pkg::CallbackSourceReportInit() - handle the ctor/dtor of libzypp + callbacks (#251726) +- 2.13.125 + +------------------------------------------------------------------- Fri Mar 27 13:57:53 CET 2009 - lslezak@suse.cz - Fixed Pkg::SourceCreate() - make the new alias unique - timestamp Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.YCP.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.YCP.h?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.YCP.h (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.YCP.h Wed Apr 22 16:25:13 2009 @@ -72,6 +72,7 @@ CB_StartPackage, CB_ProgressPackage, CB_DonePackage, CB_SourceCreateStart, CB_SourceCreateProgress, CB_SourceCreateError, CB_SourceCreateEnd, + CB_SourceCreateInit, CB_SourceCreateDestroy, CB_StartSourceRefresh, CB_ErrorSourceRefresh, CB_DoneSourceRefresh, CB_ProgressSourceRefresh, CB_StartDeltaDownload, CB_ProgressDeltaDownload, CB_ProblemDeltaDownload, @@ -81,7 +82,7 @@ CB_StartDownload, CB_ProgressDownload, CB_DoneDownload, CB_SourceProbeStart, CB_SourceProbeFailed, CB_SourceProbeSucceeded, CB_SourceProbeEnd, CB_SourceProbeProgress, CB_SourceProbeError, - CB_SourceReportStart, CB_SourceReportProgress, CB_SourceReportError, CB_SourceReportEnd, + CB_SourceReportStart, CB_SourceReportProgress, CB_SourceReportError, CB_SourceReportEnd, CB_SourceReportInit, CB_SourceReportDestroy, CB_ScriptStart, CB_ScriptProgress, CB_ScriptProblem, CB_ScriptFinish, CB_Message, @@ -136,6 +137,8 @@ ENUM_OUT( SourceCreateProgress ); ENUM_OUT( SourceCreateError ); ENUM_OUT( SourceCreateEnd ); + ENUM_OUT( SourceCreateInit ); + ENUM_OUT( SourceCreateDestroy ); ENUM_OUT( SourceProbeStart ); ENUM_OUT( SourceProbeFailed ); @@ -148,6 +151,8 @@ ENUM_OUT( SourceReportProgress ); ENUM_OUT( SourceReportError ); ENUM_OUT( SourceReportEnd ); + ENUM_OUT( SourceReportInit ); + ENUM_OUT( SourceReportDestroy ); ENUM_OUT( StartSourceRefresh ); ENUM_OUT( ErrorSourceRefresh ); Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.cc?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.cc (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Callbacks.cc Wed Apr 22 16:25:13 2009 @@ -87,10 +87,12 @@ virtual void reportbegin() { + y2milestone("Convert DB Init Callback"); } virtual void reportend() { + y2milestone("Convert DB Destroy Callback"); } virtual void start(zypp::Pathname pname) { @@ -911,6 +913,28 @@ { SourceCreateReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {} + virtual void reportbegin() + { + CB callback( ycpcb( YCPCallbacks::CB_SourceCreateInit ) ); + y2debug("Source Create begin"); + + if (callback._set) + { + callback.evaluate(); + } + } + + virtual void reportend() + { + CB callback( ycpcb( YCPCallbacks::CB_SourceCreateDestroy ) ); + y2debug("Source Create destroy"); + + if (callback._set) + { + callback.evaluate(); + } + } + virtual void start( const zypp::Url &url ) { CB callback( ycpcb( YCPCallbacks::CB_SourceCreateStart ) ); @@ -1130,6 +1154,28 @@ struct SourceReport : public Recipient, public zypp::callback::ReceiveReportzypp::source::SourceReport { + 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(); + } + } + SourceReport( RecipientCtl & construct_r ) : Recipient( construct_r ) {} virtual void start( zypp::Source_Ref source, const std::string &task ) @@ -2040,6 +2086,25 @@ } +YCPValue PkgModuleFunctions::CallbackSourceReportInit( const YCPString& func) +{ + return SET_YCP_CB( CB_SourceReportInit, func ); +} + +YCPValue PkgModuleFunctions::CallbackSourceReportDestroy( const YCPString& func) +{ + return SET_YCP_CB( CB_SourceReportDestroy, func ); +} + +YCPValue PkgModuleFunctions::CallbackSourceCreateInit( const YCPString& func) +{ + return SET_YCP_CB( CB_SourceCreateInit, func ); +} + +YCPValue PkgModuleFunctions::CallbackSourceCreateDestroy( const YCPString& func) +{ + return SET_YCP_CB( CB_SourceCreateDestroy, func ); +} /** * @builtin CallbackSourceProbeStart Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/PkgModuleFunctions.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/PkgModuleFunctions.h?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/PkgModuleFunctions.h (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/PkgModuleFunctions.h Wed Apr 22 16:25:13 2009 @@ -113,6 +113,8 @@ // callback related funcions void CallSourceReportStart(const std::string &text); void CallSourceReportEnd(const std::string &text); + void CallSourceReportInit(); + void CallSourceReportDestroy(); // After all, APPL_HIGH might be more appropriate, because we suggest // the user what he should do and if it does not work, it's his job to @@ -222,6 +224,10 @@ YCPValue CallbackSourceCreateError( const YCPString& func); /* TYPEINFO: void(string) */ YCPValue CallbackSourceCreateEnd( const YCPString& func); + /* TYPEINFO: void(string) */ + YCPValue CallbackSourceCreateInit( const YCPString& func); + /* TYPEINFO: void(string) */ + YCPValue CallbackSourceCreateDestroy( const YCPString& func); /* TYPEINFO: void(string) */ YCPValue CallbackSourceProbeStart( const YCPString& func); @@ -237,6 +243,10 @@ YCPValue CallbackSourceProbeError( const YCPString& func); /* TYPEINFO: void(string) */ + YCPValue CallbackSourceReportInit( const YCPString& func); + /* TYPEINFO: void(string) */ + YCPValue CallbackSourceReportDestroy( const YCPString& func); + /* TYPEINFO: void(string) */ YCPValue CallbackSourceReportStart( const YCPString& func); /* TYPEINFO: void(string) */ YCPValue CallbackSourceReportProgress( const YCPString& func); Modified: branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Source.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Source.cc?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Source.cc (original) +++ branches/SuSE-SLE-10-SP3-Branch/pkg-bindings/src/Source.cc Wed Apr 22 16:25:13 2009 @@ -88,6 +88,31 @@ } } +void PkgModuleFunctions::CallSourceReportInit() +{ + // get the YCP callback handler for init event + Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_SourceReportInit); + + // is the callback registered? + if (ycp_handler != NULL) + { + // evaluate the callback function + ycp_handler->evaluateCall(); + } +} + +void PkgModuleFunctions::CallSourceReportDestroy() +{ + // get the YCP callback handler for destroy event + Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_SourceReportDestroy); + + // is the callback registered? + if (ycp_handler != NULL) + { + // evaluate the callback function + ycp_handler->evaluateCall(); + } +} /** * Logging helper: * call zypp::SourceManager::sourceManager()->findSource @@ -138,6 +163,7 @@ YCPValue PkgModuleFunctions::SourceRestore() { + CallSourceReportInit(); CallSourceReportStart(_("Downloading files...")); bool success = true; @@ -173,6 +199,7 @@ } CallSourceReportEnd(_("Downloading files...")); + CallSourceReportDestroy(); return YCPBoolean(success); } @@ -211,6 +238,7 @@ { bool success = true; + CallSourceReportInit(); CallSourceReportStart(_("Parsing files...")); std::listzypp::SourceManager::SourceId ids; @@ -271,6 +299,7 @@ } CallSourceReportEnd(_("Parsing files...")); + CallSourceReportDestroy(); return YCPBoolean(success); } @@ -712,6 +741,7 @@ YCPValue PkgModuleFunctions::SourceProvideFile (const YCPInteger& id, const YCPInteger& mid, const YCPString& f) { + CallSourceReportInit(); CallSourceReportStart(_("Downloading file...")); zypp::Source_Ref src; @@ -741,6 +771,7 @@ } CallSourceReportEnd(_("Downloading file...")); + CallSourceReportDestroy(); if (found) { @@ -770,6 +801,7 @@ YCPValue PkgModuleFunctions::SourceProvideOptionalFile (const YCPInteger& id, const YCPInteger& mid, const YCPString& f) { + CallSourceReportInit(); CallSourceReportStart(_("Downloading files...")); YCPValue ret; @@ -813,6 +845,7 @@ CallSourceReportEnd(_("Downloading files...")); + CallSourceReportDestroy(); if (found) { @@ -1349,9 +1382,11 @@ src.enable(); + CallSourceReportInit(); CallSourceReportStart(_("Parsing files...")); zypp_ptr()->addResolvables (src.resolvables()); CallSourceReportEnd(_("Parsing files...")); + CallSourceReportDestroy(); // return the id of the first product if ( ret == -1 ) @@ -1376,9 +1411,11 @@ src.enable(); + CallSourceReportInit(); CallSourceReportStart(_("Parsing files...")); zypp_ptr()->addResolvables (src.resolvables()); CallSourceReportEnd(_("Parsing files...")); + CallSourceReportDestroy(); } catch ( const zypp::Exception& excpt) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org