From 233b8b4767c4b5a737ced9bffc560139448b8402 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 13 Aug 2008 19:05:23 +0000 Subject: [PATCH] - Change Selectable API to support doing staus manipulation on non-USER level. --- VERSION.cmake | 4 ++-- devel/devel.ma/NewPool.cc | 31 ------------------------------- package/libzypp.changes | 9 ++++++++- zypp/Product.h | 8 ++++---- zypp/ui/Selectable.cc | 26 +++++++++++++------------- zypp/ui/Selectable.h | 36 +++++++++++++++++++----------------- zypp/ui/SelectableImpl.cc | 2 +- zypp/ui/SelectableImpl.h | 2 +- zypp/ui/SelectableTraits.h | 5 +---- 9 files changed, 49 insertions(+), 74 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 968fb91..7ab884d 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -59,10 +59,10 @@ # changes file. See './mkChangelog -h' for help. # SET(LIBZYPP_MAJOR "5") -SET(LIBZYPP_COMPATMINOR "4") +SET(LIBZYPP_COMPATMINOR "5") SET(LIBZYPP_MINOR "5") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 5.4.0 (4) +# LAST RELEASED: 5.5.0 (5) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/devel/devel.ma/NewPool.cc b/devel/devel.ma/NewPool.cc index f3f5bf3..015a8ac 100644 --- a/devel/devel.ma/NewPool.cc +++ b/devel/devel.ma/NewPool.cc @@ -523,37 +523,6 @@ try { /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// - // ResPool pool( ResPool::instance() ); - - // Iterate all repositories loaded to the pool - for_( it, pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd() ) - { - MIL << *it << endl; - } - - // some specific repo - Repository myRepo( *pool.knownRepositoriesBegin() ); - - // Iterate all packages named "amarok" (from all repos) - for_( it, pool.byIdentBegin( ResKind::package, "amarok" ), pool.byIdentEnd( ResKind::package, "amarok" ) ) - { - MIL << "Check: " << *it << endl; - if ( (*it)->repository() == myRepo ) - { - MIL << " Found: " << (*it)->name() << endl; - MIL << " Version: " << (*it)->edition() << endl; - MIL << " Repository: " << (*it)->repository() << endl; - } - - } - - - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; - ui::Selectable::Ptr item( ui::Selectable::get( "amarok" ) ); item->setUpToDate(); diff --git a/package/libzypp.changes b/package/libzypp.changes index bf3db63..603ffbb 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,8 +1,15 @@ ------------------------------------------------------------------- +Wed Aug 13 21:01:25 CEST 2008 - ma@suse.de + +- Change Selectable API to support doing staus manipulation on + non-USER level. +- revision 10847 +- version 5.5.0 (5) + +------------------------------------------------------------------- Wed Aug 13 16:48:49 CEST 2008 - dmacvicar@suse.de - support sat solver API for searching files -- 5.5.0 (4) ------------------------------------------------------------------- Wed Aug 13 15:12:45 CEST 2008 - ma@suse.de diff --git a/zypp/Product.h b/zypp/Product.h index cadbf7f..f2c479b 100644 --- a/zypp/Product.h +++ b/zypp/Product.h @@ -48,7 +48,7 @@ namespace zypp std::string flavor() const; /** Get the product type (base, add-on) */ - std::string type() const; + std::string type() const ZYPP_DEPRECATED; /** The URL to download the release notes for this product */ Url releaseNotesUrl() const; @@ -79,13 +79,13 @@ namespace zypp std::string shortName() const; /** Translated long name like SUSE Linux Enterprise Server 10*/ - std::string longName( const Locale & lang_r = Locale() ) const; + std::string longName( const Locale & lang_r = Locale() ) const ZYPP_DEPRECATED; /** Vendor specific distribution id. */ - std::string distributionName() const; + std::string distributionName() const ZYPP_DEPRECATED; /** Vendor specific distribution version. */ - Edition distributionEdition() const; + Edition distributionEdition() const ZYPP_DEPRECATED; protected: friend Ptr make( const sat::Solvable & solvable_r ); diff --git a/zypp/ui/Selectable.cc b/zypp/ui/Selectable.cc index 5bf712b..a244ad6 100644 --- a/zypp/ui/Selectable.cc +++ b/zypp/ui/Selectable.cc @@ -64,8 +64,8 @@ namespace zypp Status Selectable::status() const { return _pimpl->status(); } - bool Selectable::setStatus( const Status state_r ) - { return _pimpl->setStatus( state_r ); } + bool Selectable::setStatus( const Status state_r, ResStatus::TransactByValue causer_r ) + { return _pimpl->setStatus( state_r, causer_r ); } PoolItem Selectable::installedObj() const { return _pimpl->installedObj(); } @@ -164,46 +164,46 @@ namespace zypp return UNMODIFIED; }; - bool Selectable::setFate( Fate fate_r ) + bool Selectable::setFate( Fate fate_r, ResStatus::TransactByValue causer_r ) { switch ( fate_r ) { case TO_INSTALL: - return setStatus( hasInstalledObj() ? S_Update : S_Install ); + return setStatus( hasInstalledObj() ? S_Update : S_Install, causer_r ); break; case TO_DELETE: - return setStatus( S_Del ); + return setStatus( S_Del, causer_r ); break; case UNMODIFIED: - return setStatus( hasInstalledObj() ? S_KeepInstalled : S_NoInst ); + return setStatus( hasInstalledObj() ? S_KeepInstalled : S_NoInst, causer_r ); break; } return false; } - bool Selectable::setInstalled() + bool Selectable::setInstalled( ResStatus::TransactByValue causer_r ) { - return( hasInstalledObj() || setStatus( S_Install ) ); + return( hasInstalledObj() || setStatus( S_Install, causer_r ) ); } - bool Selectable::setUpToDate() + bool Selectable::setUpToDate( ResStatus::TransactByValue causer_r ) { if ( ! hasInstalledObj() ) - return setStatus( S_Install ); + return setStatus( S_Install, causer_r ); PoolItem cand( candidateObj() ); if ( ! cand ) return true; return( installedObj()->edition() >= cand->edition() - || setStatus( S_Update ) ); + || setStatus( S_Update, causer_r ) ); } - bool Selectable::setDeleted() + bool Selectable::setDeleted( ResStatus::TransactByValue causer_r ) { - return( ! hasInstalledObj() || setStatus( S_Del ) ); + return( ! hasInstalledObj() || setStatus( S_Del, causer_r ) ); } /****************************************************************** diff --git a/zypp/ui/Selectable.h b/zypp/ui/Selectable.h index 93b5f37..a729d30 100644 --- a/zypp/ui/Selectable.h +++ b/zypp/ui/Selectable.h @@ -38,13 +38,15 @@ namespace zypp // /** Collects PoolItems of same kind and name. * - * Selectable is a status wrapper. That's why it offers the - * PoolItems ResObjects but hides their individual ResStatus. - * The ui::Status is calculated from (and transated to) - * PoolItems individual ResStatus values. + * Selectable is a status wrapper. The ui::Status is calculated + * from (and transated to) \ref PoolItems individual \ref ResStatus + * values. * - * \note There's one Selectable per installed item, in case more - * than one item is intalled. + * Available objects are sorted according the solver policies, 'best' + * packages first (e.g. by repository priority, then Arch, then Edition). + * + * Installed objects are sorted according the installation date, newer install + * time first. */ class Selectable : public base::ReferenceCounted, private base::NonCopyable { @@ -252,28 +254,28 @@ namespace zypp { return fate() == TO_INSTALL; } /** */ - bool setFate( Fate fate_r ); + bool setFate( Fate fate_r, ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ); /** Set the item to be installed (new- or re-install). */ - bool setToInstall() - { return setFate( TO_INSTALL ); } + bool setToInstall( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ) + { return setFate( TO_INSTALL, causer_r ); } /** Take care the item gets installed if it is not. */ - bool setInstalled(); + bool setInstalled( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ); /** Take care the item gets installed if it is not, or is older. */ - bool setUpToDate(); + bool setUpToDate( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ); /** Set the item to be deleted (must be installed). */ - bool setToDelete() - { return setFate( TO_DELETE ); } + bool setToDelete( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ) + { return setFate( TO_DELETE, causer_r ); } /** Take care the item gets deleted if it is installed. */ - bool setDeleted(); + bool setDeleted( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ); /** Set the item to stay unmodified. */ - bool unset() - { return setFate( UNMODIFIED ); } + bool unset( ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ) + { return setFate( UNMODIFIED, causer_r ); } //@} public: @@ -291,7 +293,7 @@ namespace zypp * Try to set a new Status. * Returns \c false if the transitions is not allowed. */ - bool setStatus( const Status state_r ); + bool setStatus( const Status state_r, ResStatus::TransactByValue causer_r /*= ResStatus::USER*/ ); /** Return who caused the modification. */ ResStatus::TransactByValue modifiedBy() const; diff --git a/zypp/ui/SelectableImpl.cc b/zypp/ui/SelectableImpl.cc index 649eb63..c24be18 100644 --- a/zypp/ui/SelectableImpl.cc +++ b/zypp/ui/SelectableImpl.cc @@ -196,7 +196,7 @@ namespace zypp return S_NoInst; } - bool Selectable::Impl::setStatus( const Status state_r ) + bool Selectable::Impl::setStatus( const Status state_r, ResStatus::TransactByValue causer_r ) { StatusHelper self( *this ); diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index 18e7f0f..507c242 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -88,7 +88,7 @@ namespace zypp Status status() const; /** */ - bool setStatus( const Status state_r ); + bool setStatus( const Status state_r, ResStatus::TransactByValue causer_r ); /** Installed object. */ PoolItem installedObj() const diff --git a/zypp/ui/SelectableTraits.h b/zypp/ui/SelectableTraits.h index a6375b9..ee62874 100644 --- a/zypp/ui/SelectableTraits.h +++ b/zypp/ui/SelectableTraits.h @@ -67,10 +67,7 @@ namespace zypp }; /** Oder on InstalledItemSet. - * \li repository priority - * \li best Arch - * \li best Edition - * \li ResObject::constPtr as fallback. + * Newer install time at the beginning of the set. */ struct IOrder : public std::binary_function { -- 2.7.4