- Added ZYppCommitPolicy for passing policy options to commit. Old style
authorMichael Andres <ma@suse.de>
Tue, 11 Apr 2006 23:39:19 +0000 (23:39 +0000)
committerMichael Andres <ma@suse.de>
Tue, 11 Apr 2006 23:39:19 +0000 (23:39 +0000)
  interfaces are tagged deprecated. Installed direct communication between
  ZYppImpl and TargetImpl, to get rid of Target::commit. Interface to commit
  is:
  ZYppCommitResult ZYpp::commit( const ZYppCommitPolicy & policy_r )

13 files changed:
zypp/Makefile.am
zypp/Target.h
zypp/ZYpp.cc
zypp/ZYpp.h
zypp/ZYppCommit.h [new file with mode: 0644]
zypp/ZYppCommitPolicy.cc [new file with mode: 0644]
zypp/ZYppCommitPolicy.h [new file with mode: 0644]
zypp/ZYppCommitResult.cc [new file with mode: 0644]
zypp/ZYppCommitResult.h
zypp/target/TargetImpl.cc
zypp/target/TargetImpl.h
zypp/zypp_detail/ZYppImpl.cc
zypp/zypp_detail/ZYppImpl.h

index 72c882b..0a7dcf5 100644 (file)
@@ -84,6 +84,8 @@ pkginclude_HEADERS = NeedAType.h \
        UpgradeStatistics.h     \
        TranslatedText.h \
        ZYpp.h          \
+       ZYppCommit.h            \
+       ZYppCommitPolicy.h      \
        ZYppCommitResult.h      \
        ZYppFactory.h   \
        ZYppCallbacks.h \
@@ -156,6 +158,8 @@ lib@PACKAGE@_la_SOURCES = \
        VendorAttr.cc   \
        UpgradeStatistics.cc    \
        ZYpp.cc         \
+       ZYppCommitPolicy.cc     \
+       ZYppCommitResult.cc     \
        TranslatedText.cc \
        ZYppFactory.cc \
        KeyRing.cc
index 6b7f4b8..e112e0d 100644 (file)
@@ -14,6 +14,8 @@
 
 #include <iosfwd>
 
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
 #include "zypp/base/Deprecated.h"
 
@@ -31,6 +33,10 @@ namespace zypp
       class RpmDb;
     }
   }
+  namespace zypp_detail
+  {
+    class ZYppImpl;
+  }
 
   DEFINE_PTR_TYPE(Target);
 
@@ -51,10 +57,13 @@ namespace zypp
 
     /** All resolvables provided by the target. */
     const ResStore & resolvables();
+
     /** Null implementation */
     static Target_Ptr nullimpl();
+
     /** Refference to the RPM database */
     target::rpm::RpmDb & rpmDb();
+
     /** Commit changes in the pool
      *  \param medianr 0 = all/any media
      *                 > 0 means only the given media number
@@ -62,23 +71,28 @@ namespace zypp
      *
      * \todo Interface to commit should be ZYpp::commit( medianr ). This call
      * should be removed from the targets public interface, as soon as ZYpp::Impl
-     * is able to call Target::I,pl.
+     * is able to call Target::Impl.
     */
-    int commit( ResPool pool_r, int medianr, PoolItemList & errors_r
-        , PoolItemList & remaining_r, PoolItemList & srcremaining_r, bool dry_run = false ) ZYPP_DEPRECATED;
+    int commit( ResPool pool_r, int medianr,
+                PoolItemList & errors_r,
+                PoolItemList & remaining_r,
+                PoolItemList & srcremaining_r,
+                bool dry_run = false ) ZYPP_DEPRECATED;
 
-      /** If the package is installed and provides the file
-         Needed to evaluate split provides during Resolver::Upgrade() */
-      bool providesFile (const std::string & name_str, const std::string & path_str) const;
+    /** If the package is installed and provides the file
+     Needed to evaluate split provides during Resolver::Upgrade() */
+    bool providesFile (const std::string & name_str, const std::string & path_str) const;
 
-      ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
+    ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
 
-      /** JUST FOR TESTSUITE */
-      /** Sort according to prereqs and media numbers */
-      void getResolvablesToInsDel ( const ResPool pool_r,
-                                   PoolItemList & dellist_r,
-                                   PoolItemList & instlist_r,
-                                   PoolItemList & srclist_r ) const;
+    /** JUST FOR TESTSUITE */
+    /** Sort according to prereqs and media numbers
+     * \todo provide it as standalone algorithm
+    */
+    void getResolvablesToInsDel ( const ResPool pool_r,
+                                  PoolItemList & dellist_r,
+                                  PoolItemList & instlist_r,
+                                  PoolItemList & srclist_r ) const;
 
 #ifndef STORAGE_DISABLED
     /** enables the storage target */
@@ -106,12 +120,13 @@ namespace zypp
     std::ostream & dumpOn( std::ostream & str ) const;
 
   private:
+    /** Direct access to Impl. */
+    friend class zypp_detail::ZYppImpl;
+
     /** Pointer to implementation */
     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
 
     static Target_Ptr _nullimpl;
-
-  public:
   };
   ///////////////////////////////////////////////////////////////////
 
index 735f14c..d14b22b 100644 (file)
@@ -102,8 +102,8 @@ namespace zypp
   void ZYpp::finishTarget()
   { _pimpl->finishTarget(); }
 
-  ZYpp::CommitResult ZYpp::commit( int medianr_r, bool dry_run )
-  { return _pimpl->commit( medianr_r, dry_run ); }
+  ZYppCommitResult ZYpp::commit( const ZYppCommitPolicy & policy_r )
+  { return _pimpl->commit( policy_r ); }
 
   ///////////////////////////////////////////////////////////////////
 
@@ -127,11 +127,13 @@ namespace zypp
 
   Arch ZYpp::architecture() const
   { return _pimpl->architecture(); }
+
   void ZYpp::setArchitecture( const Arch & arch )
   { _pimpl->setArchitecture( arch ); }
 
   Pathname ZYpp::homePath() const
   { return _pimpl->homePath(); }
+
   void ZYpp::setHomePath( const Pathname & path )
   { _pimpl->setHomePath(path); }
 
index d7a303f..3a9dbd6 100644 (file)
 #include "zypp/base/ReferenceCounted.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
+
+#include "zypp/base/Deprecated.h"
+#include "zypp/ZYppCommit.h"
+
 #include "zypp/Target.h"
 #include "zypp/Resolver.h"
 #include "zypp/KeyRing.h"
@@ -96,16 +100,22 @@ namespace zypp
 
 
   public:
-    /** Result returned from ZYpp::commit. */
-    struct CommitResult;
+    typedef ZYppCommitResult CommitResult;
 
     /** Commit changes and transactions.
-     * \param medianr 0 = all/any media
-     *                 > 0 means only the given media number
+     * \param \ref CommitPolicy
      * \return \ref CommitResult
      * \throws Exception
     */
-    CommitResult commit( int medianr_r, bool dry_run = false );
+    ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
+
+    ZYPP_DEPRECATED ZYppCommitResult commit( int medianr_r, bool dry_run = false )
+    {
+      ZYppCommitPolicy policy;
+      policy.restrictToMedia( medianr_r ).dryRun( dry_run );
+      return commit( policy );
+    }
+
 
   public:
     /** */
diff --git a/zypp/ZYppCommit.h b/zypp/ZYppCommit.h
new file mode 100644 (file)
index 0000000..959ad73
--- /dev/null
@@ -0,0 +1,26 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ZYppCommit.h
+ *
+*/
+#ifndef ZYPP_ZYPPCOMMIT_H
+#define ZYPP_ZYPPCOMMIT_H
+
+#include <iosfwd>
+
+#include "zypp/ZYppCommitPolicy.h"
+#include "zypp/ZYppCommitResult.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_ZYPPCOMMIT_H
diff --git a/zypp/ZYppCommitPolicy.cc b/zypp/ZYppCommitPolicy.cc
new file mode 100644 (file)
index 0000000..62161d1
--- /dev/null
@@ -0,0 +1,33 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ZYppCommitPolicy.cc
+ *
+*/
+
+#include <iostream>
+
+#include "zypp/ZYppCommitPolicy.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj )
+  {
+    str << "CommitPolicy(";
+    if ( obj.restrictToMedia() )
+      str << " restrictToMedia:" << obj.restrictToMedia();
+    if ( obj.dryRun() )
+      str << " dryRun" << obj.restrictToMedia();
+    return str << " )";
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/ZYppCommitPolicy.h b/zypp/ZYppCommitPolicy.h
new file mode 100644 (file)
index 0000000..e3def5c
--- /dev/null
@@ -0,0 +1,69 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ZYppCommitPolicy.h
+ *
+*/
+#ifndef ZYPP_ZYPPCOMMITPOLICY_H
+#define ZYPP_ZYPPCOMMITPOLICY_H
+
+#include <iosfwd>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : ZYppCommitPolicy
+  //
+  /** */
+  class ZYppCommitPolicy
+  {
+  public:
+    ZYppCommitPolicy()
+    : _restrictToMedia( 0 )
+    , _dryRun( false )
+    {}
+
+  public:
+    unsigned restrictToMedia() const
+    { return _restrictToMedia; }
+
+    bool dryRun() const
+    { return _dryRun; }
+
+  public:
+    /** Restrict commit to a certain media number
+     * \deprecated
+     */
+    ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r )
+    { _restrictToMedia = mediaNr_r; return *this; }
+
+    /** Process all media (default) */
+    ZYppCommitPolicy & allMedia()
+    { return restrictToMedia( 0 ); }
+
+    /** Set dry run (default: false) */
+    ZYppCommitPolicy & dryRun( bool yesNo_r = true )
+    { _dryRun = yesNo_r; return *this; }
+
+  private:
+    unsigned _restrictToMedia;
+    bool     _dryRun;
+
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates ZYppCommitPolicy Stream output. */
+  std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_ZYPPCOMMITPOLICY_H
diff --git a/zypp/ZYppCommitResult.cc b/zypp/ZYppCommitResult.cc
new file mode 100644 (file)
index 0000000..eaf186c
--- /dev/null
@@ -0,0 +1,33 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ZYppCommitResult.cc
+ *
+*/
+
+#include <iostream>
+
+#include "zypp/ZYppCommitResult.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
+  {
+    str << "CommitResult " << obj._result
+        << " (errors " << obj._errors.size()
+        << ", remaining " << obj._remaining.size()
+        << ", srcremaining " << obj._srcremaining.size()
+        << ")";
+    return str;
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
index c143747..59d6eae 100644 (file)
@@ -15,7 +15,6 @@
 #include <iosfwd>
 #include <list>
 
-#include "zypp/ZYpp.h"
 #include "zypp/PoolItem.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -24,17 +23,17 @@ namespace zypp
 
   ///////////////////////////////////////////////////////////////////
   //
-  //   CLASS NAME : ZYpp::CommitResult
+  //   CLASS NAME : ZYppCommitResult
   //
   /** Result returned from ZYpp::commit.
    * \see \ref ZYpp::commit
    * \todo document fields.
   */
-  struct ZYpp::CommitResult
+  struct ZYppCommitResult
   {
-    CommitResult()
-       : _result(0)
-    { }
+    ZYppCommitResult()
+    : _result(0)
+    {}
 
     typedef std::list<PoolItem_Ref> PoolItemList;
 
@@ -45,6 +44,9 @@ namespace zypp
   };
   ///////////////////////////////////////////////////////////////////
 
+  /** \relates ZYppCommitResult Stream output. */
+  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj );
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index 2816fb6..e7af832 100644 (file)
@@ -139,30 +139,27 @@ namespace zypp
     }
 
 
-    int TargetImpl::commit( ResPool pool_r, unsigned int medianr,
-                           TargetImpl::PoolItemList & errors_r, TargetImpl::PoolItemList & remaining_r,
-                           TargetImpl::PoolItemList & srcremaining_r, bool dry_run )
-    {
-      MIL << "TargetImpl::commit(<pool>, " << medianr << ")" << endl;
 
-      errors_r.clear();
-      remaining_r.clear();
-      srcremaining_r.clear();
+    ZYppCommitResult TargetImpl::commit( ResPool pool_r, const ZYppCommitPolicy & policy_r )
+    {
+      MIL << "TargetImpl::commit(<pool>, " << policy_r << ")" << endl;
+      ZYppCommitResult result;
+#warning Commit does not provide ZYppCommitResult::_errors
 
       TargetImpl::PoolItemList to_uninstall;
       TargetImpl::PoolItemList to_install;
       TargetImpl::PoolItemList to_srcinstall;
       getResolvablesToInsDel( pool_r, to_uninstall, to_install, to_srcinstall );
 
-      if ( medianr ) {
-        MIL << "Restrict to media number " << medianr << endl;
+      if ( policy_r.restrictToMedia() ) {
+        MIL << "Restrict to media number " << policy_r.restrictToMedia() << endl;
       }
 
-      commit (to_uninstall, dry_run);
+      commit (to_uninstall, policy_r );
 
-      if (medianr == 0) {                      // commit all
-        remaining_r = commit( to_install, dry_run );
-        srcremaining_r = commit( to_srcinstall, dry_run );
+      if (policy_r.restrictToMedia() == 0) {                   // commit all
+        result._remaining = commit( to_install, policy_r );
+        result._srcremaining = commit( to_srcinstall, policy_r );
       }
       else
       {
@@ -173,45 +170,49 @@ namespace zypp
         {
           Resolvable::constPtr res( it->resolvable() );
           Package::constPtr pkg( asKind<Package>(res) );
-          if (pkg && medianr != pkg->mediaId())                                                                // check medianr for packages only
+          if (pkg && policy_r.restrictToMedia() != pkg->mediaId())                                                             // check medianr for packages only
           {
             XXX << "Package " << *pkg << ", wrong media " << pkg->mediaId() << endl;
-            remaining_r.push_back( *it );
+            result._remaining.push_back( *it );
           }
           else
           {
             current_install.push_back( *it );
           }
         }
-        TargetImpl::PoolItemList bad = commit( current_install, dry_run );
-        remaining_r.insert(remaining_r.end(), bad.begin(), bad.end());
+        TargetImpl::PoolItemList bad = commit( current_install, policy_r );
+        result._remaining.insert(result._remaining.end(), bad.begin(), bad.end());
 
         for (TargetImpl::PoolItemList::iterator it = to_srcinstall.begin(); it != to_srcinstall.end(); ++it)
         {
           Resolvable::constPtr res( it->resolvable() );
           Package::constPtr pkg( asKind<Package>(res) );
-          if (pkg && medianr != pkg->mediaId()) // check medianr for packages only
+          if (pkg && policy_r.restrictToMedia() != pkg->mediaId()) // check medianr for packages only
           {
             XXX << "Package " << *pkg << ", wrong media " << pkg->mediaId() << endl;
-            srcremaining_r.push_back( *it );
+            result._srcremaining.push_back( *it );
           }
           else {
             current_srcinstall.push_back( *it );
           }
         }
-        bad = commit( current_srcinstall, dry_run );
-        srcremaining_r.insert(srcremaining_r.end(), bad.begin(), bad.end());
+        bad = commit( current_srcinstall, policy_r );
+        result._srcremaining.insert(result._srcremaining.end(), bad.begin(), bad.end());
       }
-      return to_install.size() - remaining_r.size();
+
+
+      result._result = (to_install.size() - result._remaining.size());
+      return result;
     }
 
 
     TargetImpl::PoolItemList
-    TargetImpl::commit( const TargetImpl::PoolItemList & items_r, bool dry_run )
+    TargetImpl::commit( const TargetImpl::PoolItemList & items_r,
+                        const ZYppCommitPolicy & policy_r )
     {
       TargetImpl::PoolItemList remaining;
 
-      MIL << "TargetImpl::commit(<list>" << (dry_run?", dry_run" : "") << ")" << endl;
+      MIL << "TargetImpl::commit(<list>" << policy_r << ")" << endl;
 
       bool abort = false;
 
@@ -248,7 +249,7 @@ namespace zypp
             try {
               progress.tryLevel( target::rpm::InstallResolvableReport::RPM );
              if (p->installOnly()) flags |= rpm::RpmDb::RPMINST_NOUPGRADE;
-             if (dry_run) flags |= rpm::RpmDb::RPMINST_TEST;
+             if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST;
               rpm().installPackage( localfile, flags );
 
              if( progress.aborted() )
@@ -263,7 +264,7 @@ namespace zypp
             catch (Exception & excpt_r) {
               ZYPP_CAUGHT(excpt_r);
               WAR << "Install failed, retrying with --nodeps" << endl;
-             if (dry_run) {
+             if (policy_r.dryRun()) {
                  WAR << "dry run failed" << endl;
                  abort = true;
                  progress.disconnect();
@@ -309,7 +310,7 @@ namespace zypp
               }
             }
             if (success
-               && !dry_run)
+               && !policy_r.dryRun())
            {
              it->status().setTransact( false, ResStatus::USER );
             }
@@ -323,7 +324,7 @@ namespace zypp
             RpmRemovePackageReceiver progress( it->resolvable() );
             progress.connect();
            unsigned flags = rpm::RpmDb::RPMINST_NODEPS;
-           if (dry_run) flags |= rpm::RpmDb::RPMINST_TEST;
+           if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST;
             try {
               rpm().removePackage( p, flags );
             }
@@ -333,14 +334,14 @@ namespace zypp
               ZYPP_CAUGHT( excpt_r );
             }
            if (success
-               && !dry_run)
+               && !policy_r.dryRun())
            {
              it->status().setTransact( false, ResStatus::USER );
            }
             progress.disconnect();
           }
         }
-        else if (!dry_run) // other resolvables
+        else if (!policy_r.dryRun()) // other resolvables
         {
           if ( isStorageEnabled() )
           {
index 2b1a24b..518c262 100644 (file)
@@ -21,6 +21,7 @@
 #include "zypp/base/PtrTypes.h"
 #include "zypp/ResStore.h"
 #include "zypp/PoolItem.h"
+#include "zypp/ZYppCommit.h"
 
 #include "zypp/Pathname.h"
 #include "zypp/media/MediaAccess.h"
@@ -84,10 +85,23 @@ namespace zypp
       /** The root set for this target */
       Pathname root() const;
 
-      /** Commit changes in the pool
-         media = 0 means any/all medias
-         media > 0 means limit commits to this media */
-      int commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r, bool dry_run = false );
+      /** Commit changes in the pool */
+      ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r );
+
+      ZYPP_DEPRECATED int commit( ResPool pool_r, unsigned int medianr,
+                                  PoolItemList & errors_r,
+                                  PoolItemList & remaining_r,
+                                  PoolItemList & srcremaining_r,
+                                  bool dry_run = false )
+      {
+        ZYppCommitPolicy policy;
+        policy.restrictToMedia( medianr ).dryRun( dry_run );
+        ZYppCommitResult res = commit( pool_r, policy );
+        errors_r.swap( res._errors );
+        remaining_r.swap( res._remaining );
+        srcremaining_r.swap( res._srcremaining );
+        return res._result;
+      }
 
       /** enables the storage target */
       bool isStorageEnabled() const;
@@ -95,7 +109,7 @@ namespace zypp
 
       /** Commit ordered changes
          return uncommitted ones (due to error) */
-      PoolItemList commit( const PoolItemList & items_r, bool dry_run = false );
+      PoolItemList commit( const PoolItemList & items_r, const ZYppCommitPolicy & policy_r );
 
       /** Overload to realize stream output. */
       virtual std::ostream & dumpOn( std::ostream & str ) const
index ba540e9..206e0d4 100644 (file)
@@ -18,6 +18,8 @@
 #include "zypp/zypp_detail/ZYppImpl.h"
 #include "zypp/detail/ResImplTraits.h"
 #include "zypp/solver/detail/Helper.h"
+#include "zypp/target/TargetImpl.h"
+#include "zypp/ZYpp.h"
 #include "zypp/NVRAD.h"
 #include "zypp/Language.h"
 #include "zypp/DiskUsageCounter.h"
@@ -74,7 +76,7 @@ namespace zypp
       MIL << "initializing keyring..." << std::endl;
       //_keyring = new KeyRing(homePath() + Pathname("/keyring/all"), homePath() + Pathname("/keyring/trusted"));
       _keyring = new KeyRing();
-      
+
       struct utsname buf;
       if (uname (&buf) < 0) {
        ERR << "Can't determine system architecture" << endl;
@@ -204,35 +206,23 @@ namespace zypp
     // commit
 
     /** \todo Remove workflow from target, lot's of it could be done here,
-    * and target used for transact. */
-    ZYpp::CommitResult ZYppImpl::commit( int medianr_r, bool dry_run )
+     * and target used for transact. */
+    ZYppCommitResult ZYppImpl::commit( const ZYppCommitPolicy & policy_r )
     {
-      MIL << "Attempt to commit (medianr " << medianr_r << ")" << endl;
+      MIL << "Attempt to commit (" << policy_r << ")" << endl;
       if (! _target)
        ZYPP_THROW( Exception("Target not initialized.") );
 
-      ZYpp::CommitResult res;
-
-      // must redirect to Target::Impl. This kind of commit should not be
-      // in the Target interface.
-
-      res._result = _target->commit( pool(), medianr_r,
-                                     res._errors, res._remaining, res._srcremaining, dry_run );
+      ZYppCommitResult res = _target->_pimpl->commit( pool(), policy_r );
 
-      if (!dry_run) {
+      if (! policy_r.dryRun() ) {
        // reload new status from target
-
        removeInstalledResolvables();
        addResolvables( _target->resolvables(), true );
       }
 
-      MIL << "Commit (medianr " << medianr_r << ") returned: "
-          << res._result
-          << " (errors " << res._errors.size()
-          << ", remaining " << res._remaining.size()
-          << ", srcremaining " << res._srcremaining.size()
-          << ")" << endl;
-
+      MIL << "Commit (" << policy_r << ") returned: "
+          << res << endl;
       return res;
     }
 
index 8d4f89d..e2c2e03 100644 (file)
@@ -20,7 +20,8 @@
 #include "zypp/Resolver.h"
 #include "zypp/Locale.h"
 #include "zypp/KeyRing.h"
-#include "zypp/ZYppCommitResult.h"
+#include "zypp/ZYppCommit.h"
+#include "zypp/DiskUsageCounter.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -90,7 +91,7 @@ namespace zypp
       void finishTarget();
 
       /** Commit changes and transactions. */
-      ZYpp::CommitResult commit( int medianr_r, bool dry_run = false );
+      ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
 
     public:
       /** \todo Signal locale change. */