From e3bcf6a732565af6e3f76b77bba1cb0e196dac1a Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 22 Nov 2006 22:30:16 +0000 Subject: [PATCH] add to ZYppCommitPolicy: syncPoolAfterCommit --- zypp/ZYppCommitPolicy.h | 15 ++++++++++++--- zypp/zypp_detail/ZYppImpl.cc | 12 +++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/zypp/ZYppCommitPolicy.h b/zypp/ZYppCommitPolicy.h index b448bf9..329c7d8 100644 --- a/zypp/ZYppCommitPolicy.h +++ b/zypp/ZYppCommitPolicy.h @@ -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; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/zypp_detail/ZYppImpl.cc b/zypp/zypp_detail/ZYppImpl.cc index f651bd8..f293141 100644 --- a/zypp/zypp_detail/ZYppImpl.cc +++ b/zypp/zypp_detail/ZYppImpl.cc @@ -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: " -- 2.7.4