diff options
author | Gui Chen <gui.chen@intel.com> | 2013-06-25 22:57:26 -0400 |
---|---|---|
committer | Zhang Qiang <qiang.z.zhang@intel.com> | 2013-06-26 13:51:37 +0800 |
commit | 18a5e0792f1733b1b5eb7c728e355c5f32f1ad2d (patch) | |
tree | 83c8aba4f6666de73a8660a6d65e32704f18bcd8 | |
parent | 97484cf6c3d88148bdeb22e271766e3c479e4126 (diff) | |
download | libzypp-bindings-18a5e0792f1733b1b5eb7c728e355c5f32f1ad2d.tar.gz libzypp-bindings-18a5e0792f1733b1b5eb7c728e355c5f32f1ad2d.tar.bz2 libzypp-bindings-18a5e0792f1733b1b5eb7c728e355c5f32f1ad2d.zip |
add PoolQuery interface and loadSolvFilesubmit/tizen/20130626.233037
PoolQuery exists in zypp but libzypp-bindings, import it
loadSolvFile is a help function to extend solv file
Signed-off-by: Gui Chen <gui.chen@intel.com>
-rw-r--r-- | swig/PoolQuery.i | 39 | ||||
-rw-r--r-- | swig/RepoManager.i | 18 | ||||
-rw-r--r-- | swig/RepoType.i | 3 | ||||
-rw-r--r-- | swig/zypp.i | 5 |
4 files changed, 63 insertions, 2 deletions
diff --git a/swig/PoolQuery.i b/swig/PoolQuery.i new file mode 100644 index 0000000..05ff584 --- /dev/null +++ b/swig/PoolQuery.i @@ -0,0 +1,39 @@ +%ignore zypp::PoolQuery::operator<<; +%ignore zypp::detail::operator<<; +%ignore zypp::dumpOn; +%ignore zypp::detail::dumpOn; +%ignore operator<<; +%include <zypp/PoolQuery.h> +%include "std_vector.i" +namespace std { + %template(PoolItemVector) vector<zypp::PoolItem>; +} +namespace zypp +{ + namespace detail + { + %ignore operator<<; + } +} +%{ +#include <vector> +using std::vector; +%} + +#ifdef SWIGPYTHON +%extend zypp::PoolQuery { +std::vector<zypp::PoolItem> queryResults (zypp::ResPool pool) +{ +#define for_(IT,BEG,END) for ( decltype(BEG) IT = BEG; IT != END; ++IT ) + std::vector<zypp::PoolItem> items; + for_(it, self->begin(), self->end()) + { + PoolItem pi(*it); + items.push_back(pi); + } + + return items; +} +} +#endif + diff --git a/swig/RepoManager.i b/swig/RepoManager.i index 8f7870d..a150d32 100644 --- a/swig/RepoManager.i +++ b/swig/RepoManager.i @@ -1 +1,19 @@ %include <zypp/RepoManager.h> + +#ifdef SWIGPYTHON +%extend zypp::RepoManager{ + std::string loadSolvFile(std::string _solv, std::string _alias) + { + RepoInfo tmpRepo; + tmpRepo.setAlias(_alias); + try { + sat::Pool::instance().addRepoSolv(_solv, tmpRepo); + } catch ( const Exception & e ){ + return e.msg(); + } + + return std::string(); + } +} +#endif + diff --git a/swig/RepoType.i b/swig/RepoType.i index d9f1164..3907371 100644 --- a/swig/RepoType.i +++ b/swig/RepoType.i @@ -1 +1,2 @@ -%include <zypp/repo/RepoType.h>
\ No newline at end of file +%ignore zypp::operator<<; +%include <zypp/repo/RepoType.h> diff --git a/swig/zypp.i b/swig/zypp.i index 96b0ac7..4944cfe 100644 --- a/swig/zypp.i +++ b/swig/zypp.i @@ -138,6 +138,8 @@ SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value); #include "zypp/Resolver.h" #include "zypp/pool/GetResolvablesToInsDel.h" +#include "zypp/sat/SolvAttr.h" +#include "zypp/PoolQuery.h" #include "zypp/Product.h" using namespace boost; @@ -231,6 +233,7 @@ namespace zypp { %include "OnMediaLocation.i" %include "Resolvable.i" %include "RepoType.i" +%include "TmpPath.i" %include "RepoInfo.i" %include "ServiceInfo.i" %include "ResTraits.i" @@ -253,9 +256,9 @@ namespace zypp { %include "ResPool.i" %include "ZYppCommitPolicy.i" %include "ZYppCommitResult.i" -%include "TmpPath.i" %include "Resolver.i" %include "ZConfig.i" +%include "PoolQuery.i" //just simple files, where we need default ctor %include <zypp/repo/RepoProvideFile.h> |