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 cb98e17..e317a66 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 20c08ea..de05694 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 f382301..043f8ad 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 7eeeb25..929cf8d 100644 (file)
@@ -70,6 +70,8 @@ namespace zypp
 
       void load();
 
+      void unload();
+
       void clearCache();
 
       void buildCache();
index c59dd88..f204e17 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: "