From 2845f2971851ed558b36260731d28d699a98c1a5 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 10 May 2013 12:43:16 +0200 Subject: Add legacy GetResolvablesToInsDel class (removed from libzypp in favor of transaction) --- swig/ResPool.i | 2 +- swig/legacy/GetResolvablesToInsDel.h | 105 +++++++++++++++++++++++++++++++++++ swig/zypp.i | 2 +- 3 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 swig/legacy/GetResolvablesToInsDel.h 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 %ignore zypp::pool::operator<<; -%include +%include "legacy/GetResolvablesToInsDel.h" namespace zypp { typedef ::std::list 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 +#include + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////// +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 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() ) + _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" -- cgit v1.2.3