- Change Selectable API to support doing staus manipulation on
authorMichael Andres <ma@suse.de>
Wed, 13 Aug 2008 19:05:23 +0000 (19:05 +0000)
committerMichael Andres <ma@suse.de>
Wed, 13 Aug 2008 19:05:23 +0000 (19:05 +0000)
  non-USER level.

VERSION.cmake
devel/devel.ma/NewPool.cc
package/libzypp.changes
zypp/Product.h
zypp/ui/Selectable.cc
zypp/ui/Selectable.h
zypp/ui/SelectableImpl.cc
zypp/ui/SelectableImpl.h
zypp/ui/SelectableTraits.h

index 968fb91..7ab884d 100644 (file)
 #   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)
 #=======
index f3f5bf3..015a8ac 100644 (file)
@@ -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();
index bf3db63..603ffbb 100644 (file)
@@ -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
index cadbf7f..f2c479b 100644 (file)
@@ -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 <tt>SUSE Linux Enterprise Server 10</tt>*/
-    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<Self>( const sat::Solvable & solvable_r );
index 5bf712b..a244ad6 100644 (file)
@@ -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 ) );
     }
 
     /******************************************************************
index 93b5f37..a729d30 100644 (file)
@@ -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;
index 649eb63..c24be18 100644 (file)
@@ -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 );
 
index 18e7f0f..507c242 100644 (file)
@@ -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
index a6375b9..ee62874 100644 (file)
@@ -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<PoolItem,PoolItem,bool>
       {