summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Andres <ma@suse.de>2013-05-10 12:43:16 +0200
committerMichael Andres <ma@suse.de>2013-05-10 12:43:16 +0200
commit2845f2971851ed558b36260731d28d699a98c1a5 (patch)
tree44eaa0fb5b09541702fbda317ece63ddd57979d2
parentd41e68a22df424c3531fe03bbb4edb3265e9a90b (diff)
downloadlibzypp-bindings-2845f2971851ed558b36260731d28d699a98c1a5.tar.gz
libzypp-bindings-2845f2971851ed558b36260731d28d699a98c1a5.tar.bz2
libzypp-bindings-2845f2971851ed558b36260731d28d699a98c1a5.zip
Add legacy GetResolvablesToInsDel class (removed from libzypp in favor of transaction)
-rw-r--r--swig/ResPool.i2
-rw-r--r--swig/legacy/GetResolvablesToInsDel.h105
-rw-r--r--swig/zypp.i2
3 files changed, 107 insertions, 2 deletions
diff --git a/swig/ResPool.i b/swig/ResPool.i
index 34f3eb5..08154f8 100644
--- a/swig/ResPool.i
+++ b/swig/ResPool.i
@@ -7,7 +7,7 @@
%include <zypp/ResPool.h>
%ignore zypp::pool::operator<<;
-%include <zypp/pool/GetResolvablesToInsDel.h>
+%include "legacy/GetResolvablesToInsDel.h"
namespace zypp
{
typedef ::std::list<zyppPoolItem> PoolItemList;
diff --git a/swig/legacy/GetResolvablesToInsDel.h b/swig/legacy/GetResolvablesToInsDel.h
new file mode 100644
index 0000000..f083e0d
--- /dev/null
+++ b/swig/legacy/GetResolvablesToInsDel.h
@@ -0,0 +1,105 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/pool/GetResolvablesToInsDel.h
+ *
+*/
+#ifndef ZYPP_POOL_GETRESOLVABLESTOINSDEL_H
+#define ZYPP_POOL_GETRESOLVABLESTOINSDEL_H
+
+#include <iosfwd>
+#include <list>
+
+#include <zypp/ResPool.h>
+#include <zypp/APIConfig.h>
+#include <zypp/sat/Solvable.h>
+#include <zypp/sat/Transaction.h>
+#include <zypp/pool/PoolStats.h>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace pool
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : GetResolvablesToInsDel
+ //
+ /** Collect transacting items and sort according to prereqs and
+ * media access.
+ *
+ * \deprecated Use class \ref sat::Transaction which does a better job
+ * esp. when packages are to be deleted.
+ */
+ struct ZYPP_DEPRECATED GetResolvablesToInsDel
+ {
+ typedef std::list<PoolItem> PoolItemList;
+
+ /** Influences the sequence of sources and media proscessed.
+ * If true prefer a better source, otherwise a better media.
+ * \code
+ * ORDER_BY_SOURCE: [S1:1], [S1:2], ... , [S2:1], [S2:2], ...
+ * ORDER_BY_MEDIANR: [S1:1], [S2:1], ... , [S1:2], [S2:2], ...
+ * \endcode
+ * \deprecated Legacy, no longer supported.
+ */
+ enum Order { ORDER_BY_SOURCE, ORDER_BY_MEDIANR };
+
+ /** */
+ GetResolvablesToInsDel( ResPool pool_r, Order order_r = ORDER_BY_SOURCE )
+ {
+ sat::Transaction trans( sat::Transaction::loadFromPool );
+ trans.order();
+ for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() )
+ {
+ switch ( it->stepType() )
+ {
+ case sat::Transaction::TRANSACTION_INSTALL:
+ case sat::Transaction::TRANSACTION_MULTIINSTALL:
+ if ( it->satSolvable().isKind<SrcPackage>() )
+ _toSrcinstall.push_back( PoolItem(*it) );
+ else
+ _toInstall.push_back( PoolItem(*it) );
+ break;
+ case sat::Transaction::TRANSACTION_ERASE:
+ _toDelete.push_back( PoolItem(*it) );
+ break;
+ case sat::Transaction::TRANSACTION_IGNORE:
+ // NOP
+ break;
+ }
+ }
+ }
+
+ PoolItemList _toDelete;
+ PoolItemList _toInstall;
+ PoolItemList _toSrcinstall;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates GetResolvablesToInsDel Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const GetResolvablesToInsDel & obj )
+ {
+ using std::endl;
+ dumpPoolStats( str << "toInstall: " << endl,
+ obj._toInstall.begin(), obj._toInstall.end() ) << endl;
+ dumpPoolStats( str << "toDelete: " << endl,
+ obj._toDelete.begin(), obj._toDelete.end() ) << endl;
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace pool
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_POOL_GETRESOLVABLESTOINSDEL_H
+
diff --git a/swig/zypp.i b/swig/zypp.i
index 96b0ac7..aff93a5 100644
--- a/swig/zypp.i
+++ b/swig/zypp.i
@@ -136,7 +136,7 @@ SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value);
#include "zypp/repo/PackageProvider.h"
#include "zypp/TmpPath.h"
#include "zypp/Resolver.h"
-#include "zypp/pool/GetResolvablesToInsDel.h"
+#include "legacy/GetResolvablesToInsDel.h"
#include "zypp/Product.h"