reload target, backup
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 4 Apr 2008 16:50:42 +0000 (16:50 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 4 Apr 2008 16:50:42 +0000 (16:50 +0000)
zypp/Target.cc
zypp/Target.h
zypp/target/TargetImpl.cc
zypp/target/TargetImpl.h
zypp/zypp_detail/ZYppImpl.cc

index cb98e17896de5989f8b8d201eb544e6cfd27666c..e317a664af98fd34d0a8810f5dbd9fa3732bf84a 100644 (file)
@@ -70,6 +70,9 @@ namespace zypp
   void Target::load()
   { _pimpl->load(); }
 
+  void Target::unload()
+  { _pimpl->unload(); }
+
   target::rpm::RpmDb & Target::rpmDb()
   { return _pimpl->rpm(); }
 
index 20c08ea2d192735089865d41608e6b2436f707ef..de05694304a63ea2456010b526885b82384ae251 100644 (file)
@@ -64,6 +64,12 @@ namespace zypp
      */
     void load();
 
+    /**
+     * unload target resolvables from the
+     * pool
+     */
+    void unload();
+
     /** \deprecated NOOP
     */
     ZYPP_DEPRECATED void reset() {}
index f38230181b5aeaa1213b161070072abcee867791..043f8adbc7f4f32cc3c9e308c44a8b3c13ccd2ff 100644 (file)
@@ -320,6 +320,14 @@ namespace zypp
       }
     }
 
+    void TargetImpl::unload()
+    {
+      sat::Pool satpool( sat::Pool::instance() );
+      Repository system( satpool.systemRepo() );
+      system.eraseFromPool();
+    }
+      
+
     void TargetImpl::load()
     {
       buildCache();
index 7eeeb25a0a74dbb44a2390e14e2598aea6114102..929cf8d93f14a35899a14e0d90195dc75c027475 100644 (file)
@@ -70,6 +70,8 @@ namespace zypp
 
       void load();
 
+      void unload();
+
       void clearCache();
 
       void buildCache();
index c59dd88bfa806b004fc7545b7df2d94d7f84a0cd..f204e17ebeb464fb30060f755c8a769a2003a624 100644 (file)
@@ -31,7 +31,7 @@ namespace zypp
 { /////////////////////////////////////////////////////////////////
   ///////////////////////////////////////////////////////////////////
   namespace zypp_detail
-  { /////////////////////////////////////////////////////////////////
+  { /////////////////////////////////////////////////////////////////      
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -95,14 +95,13 @@ namespace zypp
     {
       MIL << "initTarget( " << root << endl;
       if (_target) {
-       if (_target->root() == root) {
-           MIL << "Repeated call to initializeTarget()" << endl;
-           return;
-       }
-#warning NEED SOME NEW WAY TO INDICATE NEDD OF TARGET RELOAD
-#if 0
-       removeInstalledResolvables( );
-#endif
+          if (_target->root() == root) {
+              MIL << "Repeated call to initializeTarget()" << endl;
+              return;
+          }
+
+          _target->unload();
+  
       }
       _target = new Target( root );
       _target->buildCache();
@@ -110,11 +109,9 @@ namespace zypp
 
     void ZYppImpl::finishTarget()
     {
-#warning NEED SOME NEW WAY TO UNLOAD THE POOL
-#if 0
       if (_target)
-       removeInstalledResolvables();
-#endif
+          _target->unload();
+      
       _target = 0;
     }
 
@@ -137,19 +134,17 @@ namespace zypp
       ZYppCommitResult res = _target->_pimpl->commit( pool(), policy_r );
 
       if (! policy_r.dryRun() ) {
-        // Tag target data invalid, so they are reloaded on the next call to
-        // target->resolvables(). Actually the target should do this without
-        // foreign help.
-        _target->reset();
-#warning NEED SOME NEW WAY TO INDICATE NEDD OF TARGET RELOAD
-#if 0
-       removeInstalledResolvables();
+
+          DBG << "unloading " << sat::Pool::instance().systemRepoName() << " repo from pool" << endl;
+          
+        _target->unload();
+        
         if ( policy_r.syncPoolAfterCommit() )
           {
             // reload new status from target
-            addResolvables( _target->resolvables(), true );
+            DBG << "reloading " << sat::Pool::instance().systemRepoName() << " repo to pool" << endl;
+            _target->load();
           }
-#endif
       }
 
       MIL << "Commit (" << policy_r << ") returned: "