[yast-commit] r50527 - in /trunk/pkg-bindings/src: Makefile.am ServiceManager.cc
Author: lslezak Date: Mon Sep 1 15:24:42 2008 New Revision: 50527 URL: http://svn.opensuse.org/viewcvs/yast?rev=50527&view=rev Log: - fixed ServiceManager reset and alias change - build the new files Modified: trunk/pkg-bindings/src/Makefile.am trunk/pkg-bindings/src/ServiceManager.cc Modified: trunk/pkg-bindings/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Makefile.am?rev=50527&r1=50526&r2=50527&view=diff ============================================================================== --- trunk/pkg-bindings/src/Makefile.am (original) +++ trunk/pkg-bindings/src/Makefile.am Mon Sep 1 15:24:42 2008 @@ -51,6 +51,8 @@ Callbacks.cc Callbacks_Register.cc \ Y2PkgFunction.cc Y2PkgFunction.h \ YRepo.h YRepo.cc \ + PkgService.cc PkgService.h \ + ServiceManager.cc ServiceManager.h \ HelpTexts.h i18n.h log.h Modified: trunk/pkg-bindings/src/ServiceManager.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/ServiceManager.cc?rev=50527&r1=50526&r2=50527&view=diff ============================================================================== --- trunk/pkg-bindings/src/ServiceManager.cc (original) +++ trunk/pkg-bindings/src/ServiceManager.cc Mon Sep 1 15:24:42 2008 @@ -228,7 +228,9 @@ void ServiceManager::Reset() { y2milestone("Resetting known services..."); + // reset the internal structures _known_services.clear(); + _services_loaded = false; } @@ -263,32 +265,40 @@ return zypp::ServiceInfo::noService; } -// FIXME allow to change the alias bool ServiceManager::SetService(const std::string old_alias, const zypp::ServiceInfo &srv) { try { - std::string alias(srv.alias()); - - PkgServices::const_iterator serv_it = _known_services.find(alias); + PkgServices::const_iterator serv_it = _known_services.find(old_alias); if (serv_it != _known_services.end()) { if (serv_it->second.isDeleted()) { - y2warning("Service %s has been removed", alias.c_str()); + y2warning("Service %s has been removed", old_alias.c_str()); return false; } else { - PkgService s(srv, old_alias); - _known_services[alias] = s; + // if the alias has been already changed then keep the original alias + if (old_alias == serv_it->second.alias() ) + { + PkgService s(srv, old_alias); + _known_services[srv.alias()] = s; + } + else + { + // keep the old alias + PkgService s(srv, serv_it->second.origAlias()); + _known_services[srv.alias()] = s; + } + return true; } } else { - y2error("Service %s does not exist", alias.c_str()); + y2error("Service %s does not exist", old_alias.c_str()); return false; } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org