summaryrefslogtreecommitdiff
path: root/swig
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2013-06-25 22:57:26 -0400
committerChanho Park <chanho61.park@samsung.com>2014-08-11 20:47:09 +0900
commit70d6563eab9abb0fc3d7c5a616fbbabc031fd912 (patch)
tree30fc36e60dab190cbfb81e22c7d157281cecf299 /swig
parent2b3d2e2c00d3a20d38daf13cf736bb4262116c64 (diff)
downloadlibzypp-bindings-70d6563eab9abb0fc3d7c5a616fbbabc031fd912.tar.gz
libzypp-bindings-70d6563eab9abb0fc3d7c5a616fbbabc031fd912.tar.bz2
libzypp-bindings-70d6563eab9abb0fc3d7c5a616fbbabc031fd912.zip
add PoolQuery interface and loadSolvFile
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>
Diffstat (limited to 'swig')
-rw-r--r--swig/PoolQuery.i39
-rw-r--r--swig/RepoManager.i18
-rw-r--r--swig/RepoType.i3
-rw-r--r--swig/zypp.i5
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 53b781d..1ed3a7c 100644
--- a/swig/zypp.i
+++ b/swig/zypp.i
@@ -139,6 +139,8 @@ SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value);
#include "zypp/Resolver.h"
#include "legacy/GetResolvablesToInsDel.h"
+#include "zypp/sat/SolvAttr.h"
+#include "zypp/PoolQuery.h"
#include "zypp/Product.h"
using namespace boost;
@@ -233,6 +235,7 @@ namespace zypp {
%include "OnMediaLocation.i"
%include "Resolvable.i"
%include "RepoType.i"
+%include "TmpPath.i"
%include "RepoInfo.i"
%include "Repository.i"
%include "ServiceInfo.i"
@@ -256,9 +259,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>