add to ZYppCommitPolicy: syncPoolAfterCommit
authorMichael Andres <ma@suse.de>
Wed, 22 Nov 2006 22:30:16 +0000 (22:30 +0000)
committerMichael Andres <ma@suse.de>
Wed, 22 Nov 2006 22:30:16 +0000 (22:30 +0000)
zypp/ZYppCommitPolicy.h
zypp/zypp_detail/ZYppImpl.cc

index b448bf9..329c7d8 100644 (file)
@@ -27,9 +27,10 @@ namespace zypp
   {
   public:
     ZYppCommitPolicy()
-    : _restrictToMedia( 0 )
-    , _dryRun( false )
-    , _rpmNoSignature( false )
+    : _restrictToMedia    ( 0 )
+    , _dryRun             ( false )
+    , _rpmNoSignature     ( false )
+    , _syncPoolAfterCommit( true )
     {}
 
   public:
@@ -42,6 +43,9 @@ namespace zypp
     bool rpmNoSignature() const
     { return _rpmNoSignature; }
 
+    bool syncPoolAfterCommit() const
+    { return _syncPoolAfterCommit; }
+
   public:
     /** Restrict commit to a certain media number
      * \deprecated
@@ -61,10 +65,15 @@ namespace zypp
     ZYppCommitPolicy & rpmNoSignature( bool yesNo_r = true )
     { _rpmNoSignature = yesNo_r; return *this; }
 
+    /** Kepp pool in sync with the Target databases after commit (default: true) */
+    ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r = true )
+    { _syncPoolAfterCommit = yesNo_r; return *this; }
+
   private:
     unsigned _restrictToMedia;
     bool     _dryRun;
     bool     _rpmNoSignature;
+    bool     _syncPoolAfterCommit;
   };
   ///////////////////////////////////////////////////////////////////
 
index f651bd8..f293141 100644 (file)
@@ -252,10 +252,16 @@ namespace zypp
       ZYppCommitResult res = _target->_pimpl->commit( pool(), policy_r );
 
       if (! policy_r.dryRun() ) {
-       // reload new status from target
-       removeInstalledResolvables();
+        // 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();
-       addResolvables( _target->resolvables(), true );
+       removeInstalledResolvables();
+        if ( policy_r.syncPoolAfterCommit() )
+          {
+            // reload new status from target
+            addResolvables( _target->resolvables(), true );
+          }
       }
 
       MIL << "Commit (" << policy_r << ") returned: "