Author: lslezak Date: Thu Oct 2 12:54:18 2008 New Revision: 51780 URL: http://svn.opensuse.org/viewcvs/yast?rev=51780&view=rev Log: - removed Pkg::ServicesSave(), Pkg::ServicesLoad() and Pkg::ServicesReset() - the functionality has been moved to Pkg::SourceSaveAll(), Pkg::SourceRestore() and Pkg::SourceFinishAll(). The reason is to descrease the amount exported functions and lower the required changes in YCP code. Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/PkgFunctions.h trunk/pkg-bindings/src/Service.cc trunk/pkg-bindings/src/ServiceManager.cc trunk/pkg-bindings/src/ServiceManager.h trunk/pkg-bindings/src/Source_Load.cc trunk/pkg-bindings/src/Source_Save.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Oct 2 12:54:18 2008 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Thu Oct 2 12:50:39 CEST 2008 - lslezak@suse.cz + +- removed Pkg::ServicesSave(), Pkg::ServicesLoad() and + Pkg::ServicesReset() - the functionality has been moved to + Pkg::SourceSaveAll(), Pkg::SourceRestore() and + Pkg::SourceFinishAll(). The reason is to descrease the amount + exported functions and lower the required changes in YCP code. + +------------------------------------------------------------------- Wed Oct 1 13:02:00 CEST 2008 - lslezak@suse.cz - fixed Pkg::ServiceRefresh() - search for the service URL and pass Modified: trunk/pkg-bindings/src/PkgFunctions.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/PkgFunctions.h (original) +++ trunk/pkg-bindings/src/PkgFunctions.h Thu Oct 2 12:54:18 2008 @@ -787,14 +787,8 @@ YCPValue ServiceGet(const YCPString&); /* TYPEINFO: boolean(string,map<string,any>)*/ YCPValue ServiceSet(const YCPString&, const YCPMap&); - /* TYPEINFO: boolean()*/ - YCPValue ServicesSave(); - /* TYPEINFO: boolean()*/ - YCPValue ServicesLoad(); /* TYPEINFO: boolean(string)*/ YCPValue ServiceRefresh(const YCPString&); - /* TYPEINFO: void()*/ - YCPValue ServicesReset(); /* TYPEINFO: string(string)*/ YCPValue ServiceURL(const YCPString &alias); /* TYPEINFO: string(string)*/ Modified: trunk/pkg-bindings/src/Service.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Service.cc?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/Service.cc (original) +++ trunk/pkg-bindings/src/Service.cc Thu Oct 2 12:54:18 2008 @@ -220,48 +220,6 @@ } /** - @builtin ServicesSave - @short Save the current service configuration to disk. - @return boolean false if failed -*/ -YCPValue PkgFunctions::ServicesSave() -{ - try - { - zypp::RepoManager repomanager = CreateRepoManager(); - service_manager.SaveServices(repomanager); - return YCPBoolean(true); - } - catch (const zypp::Exception& excpt) - { - _last_error.setLastError(ExceptionAsString(excpt)); - } - - return YCPBoolean(false); -} - -/** - @builtin ServicesLoad - @short Load service configurations from disk. If the services have alrady been loaded it does nothing. - @return boolean false if failed -*/ -YCPValue PkgFunctions::ServicesLoad() -{ - try - { - zypp::RepoManager repomanager = CreateRepoManager(); - service_manager.LoadServices(repomanager); - return YCPBoolean(true); - } - catch (const zypp::Exception& excpt) - { - _last_error.setLastError(ExceptionAsString(excpt)); - } - - return YCPBoolean(false); -} - -/** @builtin ServiceRefresh @short Refresh the service, the service must already be saved on the system! @param alias alias of the service to refresh @@ -289,16 +247,6 @@ } /** - @builtin ServicesReset - @short Reset the list of known services. All changes are lost. -*/ -YCPValue PkgFunctions::ServicesReset() -{ - service_manager.Reset(); - return YCPVoid(); -} - -/** @builtin ServiceProbe @short Probe service type at a URL @param url URL of the service Modified: trunk/pkg-bindings/src/ServiceManager.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/ServiceManager.cc?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/ServiceManager.cc (original) +++ trunk/pkg-bindings/src/ServiceManager.cc Thu Oct 2 12:54:18 2008 @@ -260,3 +260,14 @@ return ret; } +bool ServiceManager::empty() const +{ + return _known_services.empty(); +} + + +ServiceManager::Services::size_type ServiceManager::size() const +{ + return _known_services.size(); +} + Modified: trunk/pkg-bindings/src/ServiceManager.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/ServiceManager.h?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/ServiceManager.h (original) +++ trunk/pkg-bindings/src/ServiceManager.h Thu Oct 2 12:54:18 2008 @@ -58,6 +58,12 @@ void Reset(); + // is there any service? (incl. deleted!) + bool empty() const; + + // number of services (incl. deleted!) + Services::size_type size() const; + private: Modified: trunk/pkg-bindings/src/Source_Load.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Source_Load.cc?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/Source_Load.cc (original) +++ trunk/pkg-bindings/src/Source_Load.cc Thu Oct 2 12:54:18 2008 @@ -52,21 +52,38 @@ YCPValue PkgFunctions::SourceRestore() { + // return value + bool success = true; if (repos.size() > 0) { y2warning("Number of registered repositories: %zd, skipping repository load!", repos.size()); - return YCPBoolean(true); + return YCPBoolean(success); } - bool success = true; - try { zypp::RepoManager repomanager = CreateRepoManager(); + + if (!service_manager.empty()) + { + y2warning("Number of known services: %zd, skipping service load!", service_manager.size()); + } + else + { + try + { + service_manager.LoadServices(repomanager); + } + catch (const zypp::Exception& excpt) + { + _last_error.setLastError(ExceptionAsString(excpt)); + success = false; + } + } + std::list<zypp::RepoInfo> reps = repomanager.knownRepositories(); - repos.clear(); for (std::list<zypp::RepoInfo>::iterator it = reps.begin(); it != reps.end(); ++it) { Modified: trunk/pkg-bindings/src/Source_Save.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Source_Save.cc?rev=51780&r1=51779&r2=51780&view=diff ============================================================================== --- trunk/pkg-bindings/src/Source_Save.cc (original) +++ trunk/pkg-bindings/src/Source_Save.cc Thu Oct 2 12:54:18 2008 @@ -77,12 +77,27 @@ PkgFunctions::SourceSaveAll () { y2milestone("Saving the source setup..."); + bool ret = true; // nothing to save, return success - if (repos.size() == 0) + if (repos.empty() && service_manager.empty()) { - y2debug("No repository defined, saving skipped"); - return YCPBoolean(true); + y2debug("No repository or service defined, saving skipped"); + return YCPBoolean(ret); + } + + zypp::RepoManager repomanager = CreateRepoManager(); + + // save the services + try + { + service_manager.SaveServices(repomanager); + y2milestone("All services have been saved"); + } + catch (const zypp::Exception& excpt) + { + _last_error.setLastError(ExceptionAsString(excpt)); + ret = false; } // count removed repos @@ -125,8 +140,6 @@ // start the process pkgprogress.Start(_("Saving Repositories..."), stages, HelpTexts::save_help); - zypp::RepoManager repomanager = CreateRepoManager(); - // remove deleted repos (the old configurations) at first for (RepoCont::iterator it = repos.begin(); it != repos.end(); ++it) @@ -217,7 +230,7 @@ y2milestone("All sources have been saved"); - return YCPBoolean(true); + return YCPBoolean(ret); } /**************************************************************************************** @@ -246,6 +259,9 @@ // release all repositories repos.clear(); + + // release all services + service_manager.Reset(); } catch (zypp::Exception & excpt) { @@ -254,7 +270,7 @@ return YCPBoolean(false); } - y2milestone("All sources have been unregistered"); + y2milestone("All sources and services have been unregistered"); return YCPBoolean(true); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org