From bb7e7573d985f09f820eada69ec60242c2c34f50 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 24 Feb 2006 16:30:17 +0000 Subject: [PATCH] locks enabled --- zypp/ui/SelectableImpl.cc | 60 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/zypp/ui/SelectableImpl.cc b/zypp/ui/SelectableImpl.cc index c7da826..226166f 100644 --- a/zypp/ui/SelectableImpl.cc +++ b/zypp/ui/SelectableImpl.cc @@ -64,9 +64,12 @@ namespace zypp { if ( cand ) { - if ( inst ) - inst.status().setTransact( false, by_r ); - return cand.status().setTransact( true, by_r ); + if ( inst ) { + inst.status().setTransact( false, by_r ); + inst.status().setLock( false, by_r ); + } + cand.status().setLock( false, by_r ); + return cand.status().setTransact( true, by_r ); } return false; } @@ -77,6 +80,7 @@ namespace zypp { if ( cand ) cand.status().setTransact( false, by_r ); + inst.status().setLock( false, by_r ); return inst.status().setTransact( true, by_r ); } return false; @@ -84,12 +88,35 @@ namespace zypp bool unset( ResStatus::TransactByValue by_r ) const { - if ( inst ) - inst.status().setTransact( false, by_r ); - if ( cand ) - cand.status().setTransact( false, by_r ); - return true; + if ( inst ) { + inst.status().setTransact( false, by_r ); + inst.status().setLock( false, by_r ); + } + if ( cand ) { + cand.status().setTransact( false, by_r ); + cand.status().setLock( false, by_r ); + } + return true; + } + + bool setProtected( ResStatus::TransactByValue by_r ) const + { + if ( inst ) { + inst.status().setTransact( false, by_r ); + return inst.status().setLock( true, by_r ); + } else + return false; + } + + bool setTaboo( ResStatus::TransactByValue by_r ) const + { + if ( cand ) { + cand.status().setTransact( false, by_r ); + return cand.status().setLock( true, by_r ); + } else + return false; } + public: const Selectable::Impl & _impl; @@ -104,10 +131,6 @@ namespace zypp // /////////////////////////////////////////////////////////////////// - /** - * \todo Still open questions in state calculation; - * neglecting TABOO/PROTECTED - */ Status Selectable::Impl::status() const { PoolItem cand( candidateObj() ); @@ -125,12 +148,15 @@ namespace zypp return( installedObj().status().isByUser() ? S_Del : S_AutoDel ); } + if ( installedObj() && installedObj().status().isLocked() ) + return S_Protected; + + if ( !installedObj() && cand && cand.status().isLocked() ) + return S_Taboo; + return( installedObj() ? S_KeepInstalled : S_NoInst ); } - /** - * \todo Neglecting TABOO/PROTECTED - */ bool Selectable::Impl::set_status( const Status state_r ) { StatusHelper self( *this ); @@ -138,9 +164,9 @@ namespace zypp switch ( state_r ) { case S_Protected: + return self.setProtected( ResStatus::USER ); case S_Taboo: - return false; - + return self.setTaboo( ResStatus::USER ); case S_AutoDel: case S_AutoInstall: case S_AutoUpdate: -- 2.7.4