From: Michael Andres Date: Tue, 27 May 2014 14:27:33 +0000 (+0200) Subject: Restore repos on service enable X-Git-Tag: upstream/14.27.0~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a0e41a67199ee1dc3f038460c8b9f297dbfa6ff;p=platform%2Fupstream%2Flibzypp.git Restore repos on service enable --- diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index 894902d..523fe90 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -1717,7 +1717,7 @@ namespace zypp void RepoManager::Impl::removeService( const std::string & alias ) { - MIL << "Going to delete repo " << alias << endl; + MIL << "Going to delete service " << alias << endl; const ServiceInfo & service = getService( alias ); @@ -2067,7 +2067,7 @@ namespace zypp if ( service.type() == ServiceType::PLUGIN ) { - MIL << "Not modifying plugin service '" << oldAlias << "'" << endl; + WAR << "Not modifying plugin service '" << oldAlias << "'" << endl; return; } @@ -2098,23 +2098,29 @@ namespace zypp _services.insert(service); // changed properties affecting also repositories - if( oldAlias != service.alias() // changed alias - || oldService.enabled() != service.enabled() // changed enabled status - ) + if ( oldAlias != service.alias() // changed alias + || oldService.enabled() != service.enabled() ) // changed enabled status { std::vector toModify; getRepositoriesInService(oldAlias, std::back_inserter(toModify)); for_( it, toModify.begin(), toModify.end() ) { - if (oldService.enabled() && !service.enabled()) - it->setEnabled(false); - else if (!oldService.enabled() && service.enabled()) - { - //! \todo do nothing? the repos will be enabled on service refresh - //! \todo how to know the service needs a (auto) refresh???? - } - else + if ( oldService.enabled() != service.enabled() ) + { + if ( service.enabled() ) + { + // reset to last refreshs state + const auto & last = service.repoStates().find( it->alias() ); + if ( last != service.repoStates().end() ) + it->setEnabled( last->second.enabled ); + } + else + it->setEnabled( false ); + } + + if ( oldAlias != service.alias() ) it->setService(service.alias()); + modifyRepository(it->alias(), *it); } }