From 52dab93809c55be8709d5fde7bf818d13131ec2c Mon Sep 17 00:00:00 2001 From: Stanislav Visnovsky Date: Tue, 14 Mar 2006 09:46:04 +0000 Subject: [PATCH] function to disable all sources in the persistent store --- zypp/SourceManager.cc | 18 ++++++++++++++++++ zypp/SourceManager.h | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/zypp/SourceManager.cc b/zypp/SourceManager.cc index 10671a5..13a6f42 100644 --- a/zypp/SourceManager.cc +++ b/zypp/SourceManager.cc @@ -381,6 +381,24 @@ namespace zypp dumpSourceTableOn( DBG ); return true; } + + void SourceManager::disableSourcesAt( const Pathname & root_r ) + { + storage::PersistentStorage store; + store.init( root_r ); + + std::list new_sources = store.storedSources(); + + MIL << "Disabling all sources in store at " << root_r << endl; + + for( std::list::iterator it = new_sources.begin(); + it != new_sources.end(); ++it) + { + MIL << "Disabling source " << it->alias << endl; + it->enabled = false; + store.storeSource( *it ); + } + } /****************************************************************** ** diff --git a/zypp/SourceManager.h b/zypp/SourceManager.h index 8c50999..6605967 100644 --- a/zypp/SourceManager.h +++ b/zypp/SourceManager.h @@ -169,6 +169,15 @@ namespace zypp * Disable all registered sources */ void disableAllSources(); + + /** + * Helper function to disable all sources in the persistent + * store on the given location. Does not manipulate with + * the current status of the source manager. + * + * \throws Exception ... + */ + static void disableSourcesAt( const Pathname & root ); private: /** Singleton ctor */ -- 2.7.4