function to disable all sources in the persistent store
authorStanislav Visnovsky <visnov@suse.cz>
Tue, 14 Mar 2006 09:46:04 +0000 (09:46 +0000)
committerStanislav Visnovsky <visnov@suse.cz>
Tue, 14 Mar 2006 09:46:04 +0000 (09:46 +0000)
zypp/SourceManager.cc
zypp/SourceManager.h

index 10671a5..13a6f42 100644 (file)
@@ -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<storage::PersistentStorage::SourceData> new_sources = store.storedSources();
+
+    MIL << "Disabling all sources in store at " << root_r << endl;
+    
+    for( std::list<storage::PersistentStorage::SourceData>::iterator it = new_sources.begin();
+       it != new_sources.end(); ++it)
+    {
+       MIL << "Disabling source " << it->alias << endl;
+       it->enabled = false;
+       store.storeSource( *it );
+    }
+  }
 
   /******************************************************************
   **
index 8c50999..6605967 100644 (file)
@@ -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 */