summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-08-16 21:20:18 +0800
committerGui Chen <gui.chen@intel.com>2012-08-16 21:20:18 +0800
commit3fbed28be806ffd390adaffe6a049f3dbd55b5aa (patch)
treed40b3cacac28f8814142edf60f062cf72a3401ea
parent857e712e5928c179e9da121e903b7df68029225e (diff)
downloadlibzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.tar.gz
libzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.tar.bz2
libzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.zip
Signed-off-by: Gui Chen <gui.chen@intel.com>
-rw-r--r--CMakeLists.txt75
-rw-r--r--README20
-rw-r--r--VERSION.cmake3
-rw-r--r--examples/perl/list_target_resolvables.pl34
-rw-r--r--examples/perl/test.pl64
-rwxr-xr-xexamples/python/bytecount.py10
-rwxr-xr-xexamples/python/date.py10
-rwxr-xr-xexamples/python/exception.py25
-rwxr-xr-xexamples/python/install_updates_dryrun.py68
-rwxr-xr-xexamples/python/keyring.py35
-rwxr-xr-xexamples/python/list_resolvables.py33
-rw-r--r--examples/python/loading.py7
-rwxr-xr-xexamples/python/url.py21
-rwxr-xr-xexamples/ruby/bytecount.rb11
-rwxr-xr-xexamples/ruby/exception.rb35
-rwxr-xr-xexamples/ruby/keyring.rb32
-rwxr-xr-xexamples/ruby/list_target_resolvables.rb34
-rwxr-xr-xexamples/ruby/mediasetaccess_example.rb14
-rwxr-xr-xexamples/ruby/parse1.rb64
-rwxr-xr-xexamples/ruby/parse2.rb64
-rwxr-xr-xexamples/ruby/play_with_pool_and_target.rb21
-rwxr-xr-xexamples/ruby/play_with_repos.rb19
-rwxr-xr-xexamples/ruby/test.rb25
-rwxr-xr-xexamples/ruby/test2.rb18
-rwxr-xr-xexamples/ruby/url.rb22
-rwxr-xr-xexamples/testImports.sh21
-rw-r--r--libzypp-bindings.spec.cmake108
-rw-r--r--packaging/libzypp-bindings.changes142
-rw-r--r--packaging/libzypp-bindings.spec75
-rw-r--r--packaging/meego-add-more-class.patch111
-rw-r--r--packaging/remove-perl-binding.patch1885
-rw-r--r--packaging/support-armv7-architectures.patch26
-rw-r--r--swig/Arch.i238
-rw-r--r--swig/ByteCount.i49
-rw-r--r--swig/CMakeLists.txt29
-rw-r--r--swig/Callbacks.i613
-rw-r--r--swig/CapMatch.i1
-rw-r--r--swig/Capabilities.i10
-rw-r--r--swig/Capability.i22
-rw-r--r--swig/CheckSum.i2
-rw-r--r--swig/CommitCallbacks.h193
-rw-r--r--swig/Date.i3
-rw-r--r--swig/Dep.i3
-rw-r--r--swig/Edition.i18
-rw-r--r--swig/IdStringType.i2
-rw-r--r--swig/KeyRing.i27
-rw-r--r--swig/Kind.i5
-rw-r--r--swig/MediaSetAccess.i3
-rw-r--r--swig/NeedAType.i7
-rw-r--r--swig/OnMediaLocation.i2
-rw-r--r--swig/Package.i4
-rw-r--r--swig/Patch.i5
-rw-r--r--swig/Pathname.i12
-rw-r--r--swig/Pattern.i1
-rw-r--r--swig/PoolItem.i23
-rw-r--r--swig/Product.i2
-rw-r--r--swig/PublicKey.i1
-rw-r--r--swig/RepoInfo.i56
-rw-r--r--swig/RepoManager.i1
-rw-r--r--swig/RepoStatus.i1
-rw-r--r--swig/RepoType.i1
-rw-r--r--swig/Repository.i3
-rw-r--r--swig/ResObject.i13
-rw-r--r--swig/ResPool.i92
-rw-r--r--swig/ResStatus.i28
-rw-r--r--swig/ResTraits.i77
-rw-r--r--swig/Resolvable.i4
-rw-r--r--swig/Resolver.i27
-rw-r--r--swig/ServiceInfo.i1
-rw-r--r--swig/SrcPackage.i1
-rw-r--r--swig/Target.i23
-rw-r--r--swig/TmpPath.i4
-rw-r--r--swig/Url.i1
-rw-r--r--swig/ZConfig.i2
-rw-r--r--swig/ZYppCommitPolicy.i10
-rw-r--r--swig/ZYppCommitResult.i11
-rw-r--r--swig/ZYppFactory.i9
-rw-r--r--swig/perl5/CMakeLists.txt57
-rw-r--r--swig/perl5/perl.i91
-rw-r--r--swig/perl5/tests/CMakeLists.txt8
-rw-r--r--swig/perl5/tests/loading.pl7
-rw-r--r--swig/perl5/tests/starting.pl9
-rw-r--r--swig/python/CMakeLists.txt48
-rw-r--r--swig/python/python.i55
-rw-r--r--swig/python/tests/CMakeLists.txt11
-rw-r--r--swig/python/tests/arch.py46
-rw-r--r--swig/python/tests/commit_callbacks.py273
-rw-r--r--swig/python/tests/installed_path.py27
-rw-r--r--swig/python/tests/loading.py16
-rw-r--r--swig/python/tests/problems.py21
-rw-r--r--swig/python/tests/repoinfo.py70
-rw-r--r--swig/python/tests/starting.py19
-rw-r--r--swig/ruby/CMakeLists.txt62
-rw-r--r--swig/ruby/ruby.i125
-rw-r--r--swig/ruby/std_list.i533
-rw-r--r--swig/ruby/std_set.i527
-rw-r--r--swig/ruby/tests/CMakeLists.txt11
-rw-r--r--swig/ruby/tests/arch.rb55
-rw-r--r--swig/ruby/tests/bytecount.rb25
-rw-r--r--swig/ruby/tests/commit_callbacks.rb46
-rw-r--r--swig/ruby/tests/loading.rb16
-rw-r--r--swig/ruby/tests/starting.rb22
-rw-r--r--swig/ruby/tests/target.rb44
-rw-r--r--swig/zypp.i283
104 files changed, 7279 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..622e8cc
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,75 @@
+#
+# CMakeLists.txt for libzypp-bindings
+#
+#
+
+cmake_minimum_required(VERSION 2.8)
+
+ENABLE_TESTING()
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fno-strict-aliasing")
+
+#
+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
+#
+
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
+SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH})
+
+INCLUDE(ZyppCommon)
+
+#
+# versioning, packaging
+#
+
+INCLUDE(${CMAKE_SOURCE_DIR}/VERSION.cmake)
+
+SET( PACKAGE "libzypp-bindings" )
+SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
+
+
+GENERATE_PACKAGING(${PACKAGE} ${VERSION})
+INCLUDE(CPack)
+
+
+MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}")
+
+#
+# Finding Swig
+#
+
+FIND_PACKAGE(SWIG REQUIRED)
+
+#
+# Finding Zypp
+#
+
+FIND_PACKAGE(Zypp REQUIRED)
+
+# determine zypp version
+FIND_PROGRAM(READ_LINK readlink)
+EXECUTE_PROCESS(COMMAND "${READ_LINK}" "-f" ${ZYPP_LIBRARY} OUTPUT_VARIABLE ZYPP_SOFILE)
+
+# match number at end, strip trailing \n by using a sub-match
+STRING(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+\n$" ZYPP_VERSION "${ZYPP_SOFILE}")
+SET( ZYPP_VERSION "${CMAKE_MATCH_1}" )
+MESSAGE(STATUS "Zypp so library version ${ZYPP_VERSION}")
+
+SET( SWIG_DEFINITIONS -DZYPP_DEPRECATED -DZYPP_VERSION=${ZYPP_VERSION} )
+
+#
+# Finding Boost
+#
+
+FIND_PATH( BOOST_SMARTPTR_INCLUDE_DIR boost/smart_ptr/shared_ptr.hpp
+ /usr/include
+ /usr/local/include
+)
+IF( BOOST_SMARTPTR_INCLUDE_DIR )
+ SET( SWIG_DEFINITIONS ${SWIG_DEFINITIONS} -DBOOST_SMARTPTR_INCLUDE_DIR )
+ENDIF( BOOST_SMARTPTR_INCLUDE_DIR )
+
+# Now into SWIG
+
+ADD_SUBDIRECTORY(swig)
+
diff --git a/README b/README
new file mode 100644
index 0000000..bfe1fde
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+
+Attempt to create generated bindings for
+libzypp. Not restricted to one language.
+
+Authors: kkaempf@suse.de
+ dmacvicar@suse.de
+ aschnell@suse.de
+
+Ruby Notes
+==========
+
+* API tries to follow ruby standards:
+* Containers do not implement iterators but:
+ * each
+ * to_a
+ * etc
+* lower case methods, ie: ZYppFactory::instance.get_zypp
+ instead of ZYppFactory::instance()->getZYpp()
+ z.initialize_target("/") for z.initializeTarget("/")
+
diff --git a/VERSION.cmake b/VERSION.cmake
new file mode 100644
index 0000000..98f5dd9
--- /dev/null
+++ b/VERSION.cmake
@@ -0,0 +1,3 @@
+SET(VERSION_MAJOR "0")
+SET(VERSION_MINOR "5")
+SET(VERSION_PATCH "10")
diff --git a/examples/perl/list_target_resolvables.pl b/examples/perl/list_target_resolvables.pl
new file mode 100644
index 0000000..61cd765
--- /dev/null
+++ b/examples/perl/list_target_resolvables.pl
@@ -0,0 +1,34 @@
+use zypp;
+
+$z = zyppc::ZYppFactory_instance();
+$zypp = $z->getZYpp;
+
+$t = $zypp->initializeTarget(zypp::Pathname->new("/"));
+
+$repo = $zypp->target;
+$store = $repo->resolvables;
+
+$it_b = $store->cBegin;
+
+while ($store->iterator_equal($it_b, $store->cEnd) ne 1){
+ $pkg = $store->iterator_value($it_b);
+ print $pkg->kindToS, " ", $pkg->name, " ", $pkg->edition->asString;
+ print $pkg->arch->asString, "\n";
+ print " Summary: ", $pkg->summary, "\n";
+ print " Size: ", $pkg->size, "\n";
+ print " Vendor: ", $pkg->vendor, "\n";
+ print " BuildTime: ", $pkg->buildtime->asString, "\n";
+ $it_b = $store->iterator_incr($it_b);
+
+ $deps = $pkg->dep($zyppc::Dep_PROVIDES);
+
+ $it_b2 = $deps->cBegin;
+
+ while($deps->iterator_equal($it_b2, $deps->cEnd) ne 1){
+ $dep = $deps->iterator_value($it_b2);
+ print "Provides: ", $dep->asString, "\n";
+ $it_b2 = $deps->iterator_incr($it_b2);
+ }
+ print "\n";
+
+}
diff --git a/examples/perl/test.pl b/examples/perl/test.pl
new file mode 100644
index 0000000..dfab9d0
--- /dev/null
+++ b/examples/perl/test.pl
@@ -0,0 +1,64 @@
+use zypp;
+use rpdbtozypp;
+
+$z = zyppc::ZYppFactory_instance();
+$zypp = $z->getZYpp;
+$pdb = rpdbtozypp::PdbToZypp->new;
+print "Package to install: ";
+$ipkg = <STDIN>;
+chomp($ipkg);
+print "Importing packages from pdb!\n\n";
+print "This may take a while, please be patient!\n";
+if($pdb->readOut ne 1){
+ exit;
+}
+$store = $pdb->getStore;
+$zypp->addResolvables($store);
+
+$pool = $zypp->pool;
+$it_b = $pool->cBegin;
+$it_e = $pool->cEnd;
+
+$checker = 0;
+
+print "Looking for package...!\n";
+while ($pool->iterator_equal($it_b, $pool->cEnd) ne 1){
+ $pkg = $pool->iterator_value($it_b);
+ $test = $pkg->resolvable;
+ $it_b = $pool->iterator_incr($it_b);
+ if($test->name eq $ipkg){
+ print "Package found!\n";
+ $tmp = $pkg->status;
+ $tmp->setToBeInstalledUser;
+ $checker = 1;
+ $it_b = $it_e;
+ }
+}
+if($checker eq 0){
+ print "Package not in pdb!\n";
+ print "Check spelling!\n";
+ exit;
+}
+
+$resolver = zypp::Resolver->new($pool);
+
+$it_b = $pool->cBegin;
+if($resolver->resolvePool ne 1){
+ print "Unable to solve the pool!!!\n";
+ print "Problem Description: ";
+ $problems = $resolver->problemDescription;
+ foreach $problem (@$problems){
+ print $problem, "\n";
+ }
+}else{
+ print "These packages has to be installed: \n";
+# while ($it_b ne $pool->end){
+ while ($pool->iterator_equal($it_b, $pool->cEnd) ne 1){
+ $pkg = $pool->iterator_value($it_b);
+ $it_b = $pool->iterator_incr($it_b);
+ $test = $pkg->resolvable;
+ if($pkg->status->isToBeInstalled eq 1){
+ print $test->name, "\n";
+ }
+ }
+}
diff --git a/examples/python/bytecount.py b/examples/python/bytecount.py
new file mode 100755
index 0000000..912fa05
--- /dev/null
+++ b/examples/python/bytecount.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+from zypp import ByteCount
+
+print ByteCount(ByteCount.G)
+print ByteCount(ByteCount.GB)
+
+x = ByteCount(ByteCount.K)
+print int(x)
+
diff --git a/examples/python/date.py b/examples/python/date.py
new file mode 100755
index 0000000..965d2f3
--- /dev/null
+++ b/examples/python/date.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+from zypp import Date
+
+print Date()
+
+d = Date.now()
+print d
+print d.form("%F %T")
+
diff --git a/examples/python/exception.py b/examples/python/exception.py
new file mode 100755
index 0000000..9b7e6ec
--- /dev/null
+++ b/examples/python/exception.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+from zypp import TmpDir, RepoManagerOptions, RepoManager, RepoInfo, Url
+
+tmp_root=TmpDir()
+repo_manager = RepoManager(RepoManagerOptions(tmp_root.path()))
+
+repo_info = RepoInfo()
+
+repo_info.setAlias("factorytest")
+repo_info.setName("Test Repo for Factory.")
+repo_info.setEnabled(True)
+repo_info.setAutorefresh(False)
+repo_info.addBaseUrl(Url("file:///tmp/does-not-exist"))
+
+try:
+ repo_manager.addRepository(repo_info)
+ repo_manager.refreshMetadata(repo_info)
+ repo_manager.buildCache(repo_info)
+except RuntimeError, strerror:
+ print "RuntimeError"
+ print strerror
+else:
+ print "Oh, no exception"
+
diff --git a/examples/python/install_updates_dryrun.py b/examples/python/install_updates_dryrun.py
new file mode 100755
index 0000000..ba1a134
--- /dev/null
+++ b/examples/python/install_updates_dryrun.py
@@ -0,0 +1,68 @@
+#! /usr/bin/python
+
+import os, sys, types, string, re
+
+try:
+ import zypp
+except ImportError:
+ print 'Dummy Import Error: Unable to import zypp bindings'
+
+print 'Reading repositories...'
+Z = zypp.ZYppFactory_instance().getZYpp()
+Z.initializeTarget( zypp.Pathname("/") )
+Z.target().load();
+
+repoManager = zypp.RepoManager()
+repos = repoManager.knownRepositories()
+
+for repo in repos:
+ if not repo.enabled():
+ continue
+ if not repoManager.isCached( repo ):
+ repoManager.buildCache( repo )
+ repoManager.loadFromCache( repo );
+print "Items: %d" % ( Z.pool().size() )
+
+#
+# Does not to check and apply updates for the update stack first.
+#
+Z.resolver().resolvePool()
+
+for item in Z.pool():
+ if not zypp.isKindPatch( item ):
+ continue
+ if item.isBroken():
+ if not item.status().setTransact( True, zypp.ResStatus.USER ):
+ raise "Error set transact: %s" % item
+ resolvable = zypp.asKindPatch( item )
+ print '%s | %s-%s | %s | %s' % (resolvable.repoInfo().alias(), resolvable.name(), resolvable.edition(), resolvable.category(), item.status() )
+
+if not Z.resolver().resolvePool():
+ raise "Solver Error"
+
+for item in Z.pool():
+ if item.status().transacts():
+ print '%s | %s-%s | %s' % (item.repoInfo().alias(), item.name(), item.edition(), item.status() )
+
+
+#
+#
+#
+print '===================================================='
+todo = zypp.GetResolvablesToInsDel( Z.pool() )
+for item in todo._toDelete:
+ print '-- %s | %s-%s | %s' % (item.repoInfo().alias(), item.name(), item.edition(), item.status() )
+
+for item in todo._toInstall:
+ print '++ %s | %s-%s | %s' % (item.repoInfo().alias(), item.name(), item.edition(), item.status() )
+
+#
+# dryRun!
+#
+
+policy = zypp.ZYppCommitPolicy()
+policy.dryRun( True )
+policy.syncPoolAfterCommit( False )
+
+result = Z.commit( policy )
+print result
diff --git a/examples/python/keyring.py b/examples/python/keyring.py
new file mode 100755
index 0000000..83cf5ff
--- /dev/null
+++ b/examples/python/keyring.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+# test loading of pywsman
+import sys
+
+# cmake build dir
+sys.path.insert(0, '../../build/swig/python')
+
+from zypp import ZYppFactory, Pathname, KeyRing, PublicKey
+
+
+keyring = ZYppFactory.instance().getZYpp().keyRing()
+
+path = Pathname("/suse/aschnell/tmp/repodata/repomd.xml.key")
+print path
+
+publickey = PublicKey(path)
+print publickey
+
+id = publickey.id()
+
+print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id))
+
+keyring.importKey(publickey, True)
+
+print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id))
+
+print "list of known keys:"
+for key in keyring.publicKeys():
+ print key
+
+print "list of trusted keys:"
+for key in keyring.trustedPublicKeys():
+ print key
+
diff --git a/examples/python/list_resolvables.py b/examples/python/list_resolvables.py
new file mode 100755
index 0000000..8138390
--- /dev/null
+++ b/examples/python/list_resolvables.py
@@ -0,0 +1,33 @@
+#! /usr/bin/python
+import zypp
+
+Z = zypp.ZYppFactory_instance().getZYpp()
+Z.initializeTarget( zypp.Pathname("/") )
+Z.target().load();
+
+repoManager = zypp.RepoManager()
+repos = repoManager.knownRepositories()
+
+for repo in repos:
+ if not repo.enabled():
+ continue
+ if not repoManager.isCached( repo ):
+ repoManager.buildCache( repo )
+ repoManager.loadFromCache( repo );
+
+print "Items: %d" % ( Z.pool().size() )
+
+for item in Z.pool():
+ if item.status().isInstalled():
+ t = "i"
+ else:
+ t = "*"
+
+ print "%s %s:%s-%s.%s\t(%s)" % ( t,
+ item.kind(),
+ item.name(),
+ item.edition(),
+ item.arch(),
+ item.repoInfo().alias() )
+ if zypp.isKindPackage( item ):
+ print " Group: %s" %(zypp.asKindPackage( item ).group( ) )
diff --git a/examples/python/loading.py b/examples/python/loading.py
new file mode 100644
index 0000000..b688d84
--- /dev/null
+++ b/examples/python/loading.py
@@ -0,0 +1,7 @@
+# test loading of pywsman
+import sys
+
+# cmake build dir
+sys.path.insert(0, '../../build/swig/python')
+
+import zypp
diff --git a/examples/python/url.py b/examples/python/url.py
new file mode 100755
index 0000000..07c772c
--- /dev/null
+++ b/examples/python/url.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+from zypp import Url
+
+a = Url("http://www.suse.de/download")
+print "a = %s" % a
+print " %s %s %s" % (a.getScheme(), a.getHost(), a.getPathData())
+
+b = Url(a)
+b.setHost("download.novell.com")
+print "b = %s" % b
+
+c = a # oops
+c.setPathData("/repository")
+print "c = %s" % c
+
+print
+print "a = %s" % a # oops
+print "b = %s" % b
+print "c = %s" % c
+
diff --git a/examples/ruby/bytecount.rb b/examples/ruby/bytecount.rb
new file mode 100755
index 0000000..56393a8
--- /dev/null
+++ b/examples/ruby/bytecount.rb
@@ -0,0 +1,11 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+puts ByteCount.new(ByteCount.G)
+puts ByteCount.new(ByteCount.GB)
+
+x = ByteCount.new(ByteCount.K)
+puts x.to_i
+
diff --git a/examples/ruby/exception.rb b/examples/ruby/exception.rb
new file mode 100755
index 0000000..346d2d3
--- /dev/null
+++ b/examples/ruby/exception.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+tmp_cache_path = TmpDir.new()
+tmp_raw_cache_path = TmpDir.new()
+tmp_known_repos_path = TmpDir.new()
+
+opts = RepoManagerOptions.new()
+opts.repoCachePath = tmp_cache_path.path()
+opts.repoRawCachePath = tmp_raw_cache_path.path()
+opts.knownReposPath = tmp_known_repos_path.path()
+
+repo_manager = RepoManager.new(opts)
+
+repo_info = RepoInfo.new()
+
+repo_info.set_alias("factorytest")
+repo_info.set_name("Test Repo for Factory.")
+repo_info.set_enabled(true)
+repo_info.set_autorefresh(false)
+repo_info.add_base_url(Url.new("file:///tmp/does-not-exist"))
+
+begin
+ repo_manager.add_repository(repo_info)
+ repo_manager.refresh_metadata(repo_info)
+ repo_manager.build_cache(repo_info)
+rescue ZYppException => e
+ puts "ZYppException caught"
+ puts e
+else
+ puts "Oh, no exception"
+end
+
diff --git a/examples/ruby/keyring.rb b/examples/ruby/keyring.rb
new file mode 100755
index 0000000..6aee8e0
--- /dev/null
+++ b/examples/ruby/keyring.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+
+keyring = ZYppFactory::instance.get_zypp.key_ring
+
+path = Pathname.new("/suse/aschnell/tmp/repodata/repomd.xml.key")
+puts path
+
+publickey = PublicKey.new(path)
+puts publickey
+
+id = publickey.id()
+
+puts "is key known/trusted #{keyring.is_key_known(id)} #{keyring.is_key_trusted(id)}"
+
+keyring.import_key(publickey, true)
+
+puts "is key known/trusted #{keyring.is_key_known(id)} #{keyring.is_key_trusted(id)}"
+
+puts "list of known keys:"
+keyring.public_keys.each do |key|
+ puts key
+end
+
+puts "list of trusted keys:"
+keyring.trusted_public_keys.each do |key|
+ puts key
+end
+
diff --git a/examples/ruby/list_target_resolvables.rb b/examples/ruby/list_target_resolvables.rb
new file mode 100755
index 0000000..c9bbe29
--- /dev/null
+++ b/examples/ruby/list_target_resolvables.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+z = ZYppFactory::instance.get_zypp
+# puts z.class
+
+t = z.initialize_target(Pathname.new("/"))
+# puts t.class
+
+r = z.target.resolvables
+# puts r.class
+
+r.each do | p |
+
+ # puts p.class
+ puts "#{p.kind} #{p.name} #{p.edition.to_s} #{p.arch.to_s}"
+ puts " Summary: #{p.summary}"
+ puts " Size: #{p.size}"
+ puts " Vendor: #{p.vendor}"
+ puts " Buildtime: #{p.buildtime}"
+
+ d = p.dep(Dep.PROVIDES)
+ # puts d.class
+ d.each do | x |
+ # puts x.class
+ puts " Provides: #{x.to_s}"
+ end
+
+ puts
+
+end
+
diff --git a/examples/ruby/mediasetaccess_example.rb b/examples/ruby/mediasetaccess_example.rb
new file mode 100755
index 0000000..4a8cb91
--- /dev/null
+++ b/examples/ruby/mediasetaccess_example.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+a = MediaSetAccess.new("http://dist.suse.de/install/stable-x86", "/")
+p = a.provide_file("/content", 1)
+puts p.class
+File.open(p, 'r') do | f |
+ f.each_line do |l|
+ puts l
+ end
+end
+
diff --git a/examples/ruby/parse1.rb b/examples/ruby/parse1.rb
new file mode 100755
index 0000000..90500c9
--- /dev/null
+++ b/examples/ruby/parse1.rb
@@ -0,0 +1,64 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+tmp_cache_path = TmpDir.new()
+tmp_raw_cache_path = TmpDir.new()
+tmp_known_repos_path = TmpDir.new()
+
+opts = RepoManagerOptions.new()
+opts.repoCachePath = tmp_cache_path.path()
+opts.repoRawCachePath = tmp_raw_cache_path.path()
+opts.knownReposPath = tmp_known_repos_path.path()
+
+repo_manager = RepoManager.new(opts)
+
+repo_info = RepoInfo.new()
+
+repo_info.set_alias("factorytest")
+repo_info.set_name("Test Repo for Factory.")
+repo_info.set_enabled(true)
+repo_info.set_autorefresh(false)
+# repo_info.add_base_url("ftp://dist.suse.de/install/stable-x86/")
+# repo_info.add_base_url("http://software.opensuse.org/download/home:/Arvin42/openSUSE_Factory/")
+repo_info.add_base_url("file:///suse/aschnell/tmp")
+
+repo_manager.add_repository(repo_info)
+
+z = ZYppFactory::instance.get_zypp
+pool = z.pool()
+
+repos = repo_manager.known_repositories()
+repos.each do | repo |
+ repo_manager.refresh_metadata(repo)
+ repo_manager.build_cache(repo)
+ rep = repo_manager.create_from_cache(repo)
+ store = rep.resolvables()
+ z.add_resolvables(store)
+end
+
+# puts pool.class
+
+pool.each do | p |
+
+ # puts p.class
+ r = p.resolvable
+ # puts r.class
+ puts "#{r.kind} #{r.name} #{r.edition.to_s} #{r.arch.to_s}"
+ puts " Summary: #{r.summary}"
+ puts " Size: #{r.size}"
+ puts " Vendor: #{r.vendor}"
+ puts " Buildtime: #{r.buildtime}"
+
+ d = r.dep(Dep.PROVIDES)
+ # puts d.class
+ d.each do | x |
+ # puts y.class
+ puts " Provides: #{x.to_s}"
+ end
+
+ puts
+
+end
+
diff --git a/examples/ruby/parse2.rb b/examples/ruby/parse2.rb
new file mode 100755
index 0000000..373077c
--- /dev/null
+++ b/examples/ruby/parse2.rb
@@ -0,0 +1,64 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+tmp_cache_path = TmpDir.new()
+tmp_raw_cache_path = TmpDir.new()
+tmp_known_repos_path = TmpDir.new()
+
+opts = RepoManagerOptions.new()
+opts.repoCachePath = tmp_cache_path.path()
+opts.repoRawCachePath = tmp_raw_cache_path.path()
+opts.knownReposPath = tmp_known_repos_path.path()
+
+repo_manager = RepoManager.new(opts)
+
+repo_info = RepoInfo.new()
+
+repo_info.set_alias("factorytest")
+repo_info.set_name("Test Repo for Factory.")
+repo_info.set_enabled(true)
+repo_info.set_autorefresh(false)
+# repo_info.add_base_url("ftp://dist.suse.de/install/stable-x86/")
+# repo_info.add_base_url("http://software.opensuse.org/download/home:/Arvin42/openSUSE_Factory/")
+repo_info.add_base_url("file:///suse/aschnell/tmp")
+
+repo_manager.add_repository(repo_info)
+
+res_pool_manager = ResPoolManager.new()
+
+repos = repo_manager.known_repositories()
+repos.each do | repo |
+ repo_manager.refresh_metadata(repo)
+ repo_manager.build_cache(repo)
+ rep = repo_manager.create_from_cache(repo)
+ store = rep.resolvables()
+ res_pool_manager.insert(store)
+end
+
+pool = res_pool_manager.accessor()
+# puts pool.class
+
+pool.each do | p |
+
+ # puts p.class
+ r = p.resolvable
+ # puts r.class
+ puts "#{r.kind} #{r.name} #{r.edition.to_s} #{r.arch.to_s}"
+ puts " Summary: #{r.summary}"
+ puts " Size: #{r.size}"
+ puts " Vendor: #{r.vendor}"
+ puts " Buildtime: #{r.buildtime}"
+
+ d = r.dep(Dep.PROVIDES)
+ # puts d.class
+ d.each do | x |
+ # puts y.class
+ puts " Provides: #{x.to_s}"
+ end
+
+ puts
+
+end
+
diff --git a/examples/ruby/play_with_pool_and_target.rb b/examples/ruby/play_with_pool_and_target.rb
new file mode 100755
index 0000000..2642e82
--- /dev/null
+++ b/examples/ruby/play_with_pool_and_target.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+z = ZYppFactory::instance.get_zypp
+
+t = z.initialize_target("/")
+r = z.target.resolvables
+puts r.class
+
+p = z.pool
+puts p.class
+
+z.add_resolvables r
+p.each do | pi |
+ puts "a poolitem: #{pi} status: #{pi.status} res: #{pi.resolvable}"
+ puts pi.methods
+ exit
+end
+
diff --git a/examples/ruby/play_with_repos.rb b/examples/ruby/play_with_repos.rb
new file mode 100755
index 0000000..d134176
--- /dev/null
+++ b/examples/ruby/play_with_repos.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+a = Arch.new("i386")
+puts a.to_s
+#exit
+
+z = ZYppFactory::instance.get_zypp
+
+manager = RepoManager.new
+
+manager.known_repositories.each do | repo |
+ repo.base_urls.each do | url |
+ puts url.to_s
+ end
+end
+
diff --git a/examples/ruby/test.rb b/examples/ruby/test.rb
new file mode 100755
index 0000000..7b63c45
--- /dev/null
+++ b/examples/ruby/test.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+a = Arch.new("i386")
+puts a.inspect
+#exit
+
+z = ZYppFactory::instance.get_zypp
+
+puts z.inspect
+puts z.architecture.to_s
+
+puts z.home_path
+puts z.home_path.class
+
+t = z.initialize_target("/")
+r = z.target.resolvables
+puts r.class
+r.each do | p |
+ puts "#{p.name} #{p.edition}"
+end
+
+#puts z.methods
diff --git a/examples/ruby/test2.rb b/examples/ruby/test2.rb
new file mode 100755
index 0000000..2bafee5
--- /dev/null
+++ b/examples/ruby/test2.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+require 'pathname'
+include Zypp
+
+z = ZYppFactory::instance.get_zypp
+
+#puts z.homePath.class
+#z.setHomePath("/home")
+
+z.initialize_target("/")
+t = z.target
+puts z.target.class
+#r = z.target.resolvables
+puts t.class
+#puts t.methods
+
diff --git a/examples/ruby/url.rb b/examples/ruby/url.rb
new file mode 100755
index 0000000..81f3848
--- /dev/null
+++ b/examples/ruby/url.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/ruby
+
+require 'zypp'
+include Zypp
+
+a = Url.new("http://www.suse.de/download")
+puts "a = #{a}"
+puts " #{a.get_scheme} #{a.get_host} #{a.get_path_data}"
+
+b = Url.new(a)
+b.set_host("download.novell.com")
+puts "b = #{b}"
+
+c = a # oops
+c.set_path_data("/repository")
+puts "c = #{c}"
+
+puts
+puts "a = #{a}" # oops
+puts "b = #{b}"
+puts "c = #{c}"
+
diff --git a/examples/testImports.sh b/examples/testImports.sh
new file mode 100755
index 0000000..79cb92a
--- /dev/null
+++ b/examples/testImports.sh
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+echo "====Ruby========="
+ruby <<EOF
+ require 'zypp'
+ include Zypp
+ zypp = ZYppFactory::instance.get_zypp
+EOF
+
+echo "====Python======="
+python <<EOF
+import zypp
+zypp = zypp.ZYppFactory.instance().getZYpp()
+EOF
+
+echo "====Perl========="
+perl - <<"EOF"
+ use zypp;
+ $zfactory = zyppc::ZYppFactory_instance();
+ $zypp = $zfactory->getZYpp;
+EOF \ No newline at end of file
diff --git a/libzypp-bindings.spec.cmake b/libzypp-bindings.spec.cmake
new file mode 100644
index 0000000..4c7d92f
--- /dev/null
+++ b/libzypp-bindings.spec.cmake
@@ -0,0 +1,108 @@
+#
+# spec file for package libzypp-bindings
+#
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ #
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+# nodebuginfo
+
+Name: @PACKAGE@
+Version: @VERSION@
+Release: 0
+License: GPLv2+
+Summary: Bindings for libzypp
+Group: Development/Sources
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: cmake python-devel ruby-devel
+BuildRequires: gcc-c++ >= 4.5
+BuildRequires: swig >= 1.3.40
+BuildRequires: libzypp-devel >= 10.2.0
+Source: %{name}-%{version}.tar.bz2
+
+%description
+This package provides bindings for libzypp, the library for package management.
+
+%prep
+%setup -q
+
+%build
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
+ -DPYTHON_SITEDIR=%{py_sitedir} \
+ -DLIB=%{_lib} \
+ -DCMAKE_VERBOSE_MAKEFILE=TRUE \
+ -DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags}" \
+ -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=1 \
+ ..
+# the swig compile jobs take a lot of memory, so don't use jobs here
+make -j1
+
+%check
+cd build
+make test
+
+%install
+cd build
+make install DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%package -n ruby-zypp
+License: GPLv2+
+Summary: Ruby bindings for libzypp
+Group: Development/Languages/Ruby
+
+%description -n ruby-zypp
+-
+
+%files -n ruby-zypp
+%defattr(-,root,root,-)
+%if 0%{?suse_version}
+%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/zypp.so
+%endif
+%if 0%{?mandriva_version}
+%{ruby_sitearchdir}/zypp.so
+%endif
+
+%package -n python-zypp
+License: GPLv2+
+Summary: Python bindings for libzypp
+Group: Development/Languages/Python
+%description -n python-zypp
+-
+
+%files -n python-zypp
+%defattr(-,root,root,-)
+%{py_sitedir}/_zypp.so
+%{py_sitedir}/zypp.py
+
+%package -n perl-zypp
+License: GPLv2+
+Requires: perl = %{perl_version}
+Summary: Perl bindings for libzypp
+Group: Development/Languages/Perl
+
+%description -n perl-zypp
+-
+
+%files -n perl-zypp
+%defattr(-,root,root,-)
+%{perl_vendorlib}/zypp.pm
+%{perl_vendorarch}/zypp.so
+
+%changelog
diff --git a/packaging/libzypp-bindings.changes b/packaging/libzypp-bindings.changes
new file mode 100644
index 0000000..452aaa5
--- /dev/null
+++ b/packaging/libzypp-bindings.changes
@@ -0,0 +1,142 @@
+* Tue Dec 20 2011 Zhang Qiang <qiang.z.zhang@intel.com> - 0.5.9.1
+- depend special version of libzypp for opensuse 11.4 and 11.3
+
+* Mon Oct 24 2011 Zhang Qiang <qiang.z.zhang@intel.com> - 0.5.9
+- Add loadSolvFile API to load solv file
+
+* Sun Sep 18 2011 Zhang Qiang <qiang.z.zhang@intel.com> - 0.5.9
+- Add CapNames to return provides info
+- Add a patch to provide PoolQuery interface.
+
+* Fri Sep 02 2011 Gui Chen <gui.chen@intel.com> - 0.5.9
+- Update to 0.5.9
+
+* Mon Aug 01 2011 Gui Chen <gui.chen@intel.com> - 0.5.8
+- Added armv7tnhl and armv7thl support
+
+* Fri Jan 21 2011 Marko Saukko <marko.saukko@cybercom.com> - 0.5.8
+- Added armv7hl and armv7nhl architectures (BMC#12713)
+
+* Tue Jan 04 2011 Yi Yang <yi.y.yang@intel.com> - 0.5.8
+- Support builtin arm architectures
+
+* Fri Dec 17 2010 Yi Yang <yi.y.yang@intel.com> - 0.5.8
+- Update to 0.5.8
+
+* Thu Nov 25 2010 Yi Yang <yi.y.yang@intel.com> - 0.5.7
+- Update to 0.5.7
+
+* Thu Apr 8 2010 ma@suse.de
+- Adapt to swig 1.3.40
+- version 0.5.4
+* Wed Mar 24 2010 ma@suse.de
+- Work around swig not understanding nested class.
+* Mon Dec 7 2009 ma@suse.de
+- Pass python_sitelib macro from .spec file to cmake.
+- version 0.5.3
+* Tue Nov 24 2009 ma@suse.de
+- Fix to build on sle11-sp1
+* Tue Sep 22 2009 ma@suse.de
+- Remove reference to dead zypp::ScanDBReport.
+- version 0.5.2
+* Sun Aug 9 2009 coolo@novell.com
+- use new python macros
+* Mon Aug 3 2009 ma@suse.de
+- Adappt to boost-1.39
+- version 0.5.1
+* Tue Jul 14 2009 ma@suse.de
+- Fix specfile data.
+* Wed Jun 3 2009 ma@suse.de
+- Bump factory version
+- version 0.5.0
+* Wed Dec 17 2008 ma@suse.de
+- Compile with -fPIC
+- revision 11945
+* Tue Nov 11 2008 ma@suse.de
+- Ignore Pathname operator<.
+- revision 11649
+* Mon Oct 13 2008 ma@suse.de
+- Fix makefile to build.
+- revision 11318
+* Fri Sep 19 2008 ma@suse.de
+- Add KeyRing::DefautAccept
+* Tue Sep 16 2008 dmacvicar@suse.de
+- add ZConfig
+* Fri Sep 5 2008 ma@suse.de
+- Fix basic resolvabe attributes as needed by list_resolvables.py
+ example.
+- revision 10952
+* Thu Sep 4 2008 ma@suse.de
+- Added lost RepoInfo and ServiceInfo.
+- revision 10928
+* Fri Aug 8 2008 ma@suse.de
+- Remove ProductInfo. We don't replace Product.
+- revision 10799
+* Fri Aug 1 2008 ma@suse.de
+- Remove obsolete TranslatedText
+- Add ProductInfo which is going to replace Product
+- revision 10716
+* Thu Jul 31 2008 ma@suse.de
+- Work around undefined symbols in libzypp. (bnc #391831)
+- Adapt to zypp::Service being renamed to ServiceInfo
+- revision 10707
+- version 0.4.7
+* Fri Jul 25 2008 ma@suse.de
+- Removed almost all local copies of zypp header files. This also
+ removed some old classes no longer present in libzypp.
+- Re-enabled building of python and perl bindings. (bnc #391831)
+- revision 10666
+- version 0.4.6
+* Mon Jul 14 2008 ma@suse.de
+- Remove obsolete references to Script/Message/Atom.
+- Remove obsolete references to Dependencies.
+* Tue May 6 2008 coolo@suse.de
+- compile ruby
+* Fri Apr 25 2008 coolo@suse.de
+- remove obsolete ResPool methods
+* Fri Apr 11 2008 coolo@suse.de
+- adapt to libzypp 4.10
+* Thu Apr 3 2008 coolo@suse.de
+- adapt to libzypp 4.7
+* Wed Mar 19 2008 coolo@suse.de
+- adapt to libzypp 4.5
+* Mon Mar 3 2008 schubi@suse.de
+- sat/repo moved to repository
+- Revision 8981
+- version 0.4.5
+* Thu Feb 28 2008 coolo@suse.de
+- fix build
+* Thu Dec 6 2007 aschnell@suse.de
+- readded cmp for ResObject
+* Mon Dec 3 2007 ma@suse.de
+- Add Pool iterator for python.
+* Sat Oct 13 2007 aschnell@suse.de
+- fixed build in beta
+* Thu Oct 4 2007 aschnell@suse.de
+- don't generate a debuginfo package (bug #297711)
+* Mon Sep 17 2007 aschnell@suse.de
+- generate Perl bindings
+- use ZYpp Url class
+* Mon Sep 3 2007 schwab@suse.de
+- Fix broken compiler flags.
+* Thu Aug 30 2007 aschnell@suse.de
+- some work on python bindings
+* Tue Aug 28 2007 aschnell@suse.de
+- added KeyRing and PublicKey classes
+* Thu Aug 23 2007 aschnell@suse.de
+- added to_a functions
+* Thu Aug 23 2007 aschnell@suse.de
+- added some comparison functions
+* Wed Aug 22 2007 aschnell@suse.de
+- renamed ruby module to zypp
+* Fri Aug 17 2007 aschnell@suse.de
+- moved ruby files to vendor_ruby (bug #301127)
+* Mon Aug 13 2007 aschnell@suse.de
+- added exceptions
+* Tue Jul 31 2007 aschnell@suse.de
+- improved bindings for various classes
+- adoptions to libzypp changes
+* Tue Jul 24 2007 aschnell@suse.de
+- added Python bindings
+* Thu Jul 19 2007 aschnell@suse.de
+- New package with swig generated bindings for libzypp
diff --git a/packaging/libzypp-bindings.spec b/packaging/libzypp-bindings.spec
new file mode 100644
index 0000000..a7c4af2
--- /dev/null
+++ b/packaging/libzypp-bindings.spec
@@ -0,0 +1,75 @@
+#
+# spec file for package libzypp-bindings
+#
+# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# This file and all modifications and additions to the pristine
+# package are under the same license as the package itself.
+#
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+# nodebuginfo
+%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+
+Name: libzypp-bindings
+Version: 0.5.10
+Release: 1.3
+License: GPL v2 or later
+Summary: Bindings for libzypp
+Group: Development/Sources
+%if 0%{?suse_version}
+Vendor: openSUSE
+%endif
+Source: %{name}-%{version}.tar.gz
+Patch1: remove-perl-binding.patch
+Patch2: support-armv7-architectures.patch
+Patch3: meego-add-more-class.patch
+
+BuildRequires: cmake gcc-c++ python-devel
+BuildRequires: swig == 1.3.40
+
+BuildRequires: libzypp-devel
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+This package provides bindings for libzypp, the library for package management.
+
+%prep
+%setup -q
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+%build
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
+ -DPYTHON_SITEDIR=%{python_sitearch} \
+ -DLIB=%{_lib} \
+ -DCMAKE_VERBOSE_MAKEFILE=TRUE \
+ -DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags}" \
+ -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=1 \
+ ..
+make -j1
+
+%install
+cd build
+make install DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+
+%package -n python-zypp
+Summary: Python bindings for libzypp
+Group: Development/Languages/Python
+
+Requires: libzypp
+
+%description -n python-zypp
+Python bindings of libzypp
+
+%files -n python-zypp
+%defattr(-,root,root,-)
+%{python_sitearch}/_zypp.so
+%{python_sitearch}/zypp.py*
diff --git a/packaging/meego-add-more-class.patch b/packaging/meego-add-more-class.patch
new file mode 100644
index 0000000..dae84d7
--- /dev/null
+++ b/packaging/meego-add-more-class.patch
@@ -0,0 +1,111 @@
+diff -uNr libzypp-bindings-0.5.9/swig/PoolQuery.i libzypp-bindings-0.5.9.new/swig/PoolQuery.i
+--- libzypp-bindings-0.5.9/swig/PoolQuery.i 1970-01-01 08:00:00.000000000 +0800
++++ libzypp-bindings-0.5.9.new/swig/PoolQuery.i 2011-10-24 10:42:35.275366767 +0800
+@@ -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 ( typeof(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 -uNr libzypp-bindings-0.5.9/swig/RepoManager.i libzypp-bindings-0.5.9.new/swig/RepoManager.i
+--- libzypp-bindings-0.5.9/swig/RepoManager.i 2011-03-01 20:32:06.000000000 +0800
++++ libzypp-bindings-0.5.9.new/swig/RepoManager.i 2011-10-24 11:24:25.288491255 +0800
+@@ -1 +1,18 @@
+ %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 -uNr libzypp-bindings-0.5.9/swig/RepoType.i libzypp-bindings-0.5.9.new/swig/RepoType.i
+--- libzypp-bindings-0.5.9/swig/RepoType.i 2011-10-24 10:42:10.490366408 +0800
++++ libzypp-bindings-0.5.9.new/swig/RepoType.i 2011-10-24 10:42:35.277366168 +0800
+@@ -1 +1,2 @@
+-%include <zypp/repo/RepoType.h>
+\ No newline at end of file
++%ignore zypp::operator<<;
++%include <zypp/repo/RepoType.h>
+diff -uNr libzypp-bindings-0.5.9/swig/SolvAttr.i libzypp-bindings-0.5.9.new/swig/SolvAttr.i
+--- libzypp-bindings-0.5.9/swig/SolvAttr.i 1970-01-01 08:00:00.000000000 +0800
++++ libzypp-bindings-0.5.9.new/swig/SolvAttr.i 2011-10-24 10:42:35.277366168 +0800
+@@ -0,0 +1,2 @@
++%ignore zypp::sat::SolvAttr::repositoryRevision;
++%include <zypp/sat/SolvAttr.h>
+diff -uNr libzypp-bindings-0.5.9/swig/zypp.i libzypp-bindings-0.5.9.new/swig/zypp.i
+--- libzypp-bindings-0.5.9/swig/zypp.i 2011-10-24 10:42:10.490366408 +0800
++++ libzypp-bindings-0.5.9.new/swig/zypp.i 2011-10-24 10:42:35.277366168 +0800
+@@ -90,6 +90,8 @@
+ #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;
+@@ -175,6 +177,7 @@
+ %include "OnMediaLocation.i"
+ %include "Resolvable.i"
+ %include "RepoType.i"
++%include "TmpPath.i"
+ %include "RepoInfo.i"
+ %include "ServiceInfo.i"
+ %include "ResTraits.i"
+@@ -196,9 +199,10 @@
+ %include "ResPool.i"
+ %include "ZYppCommitPolicy.i"
+ %include "ZYppCommitResult.i"
+-%include "TmpPath.i"
+ %include "Resolver.i"
+ %include "ZConfig.i"
++%include "SolvAttr.i"
++%include "PoolQuery.i"
+
+ %ignore zypp::ZYpp::setTextLocale;
+ %ignore zypp::ZYpp::getTextLocale;
diff --git a/packaging/remove-perl-binding.patch b/packaging/remove-perl-binding.patch
new file mode 100644
index 0000000..b49b59b
--- /dev/null
+++ b/packaging/remove-perl-binding.patch
@@ -0,0 +1,1885 @@
+diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
+index efa48c4..8b3bc62 100644
+--- a/swig/CMakeLists.txt
++++ b/swig/CMakeLists.txt
+@@ -11,19 +11,8 @@ SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" )
+ # Let's see which target languages are available
+ #
+
+-FIND_PACKAGE(Ruby)
+ FIND_PACKAGE(PythonLibs)
+-FIND_PACKAGE(Perl)
+
+-
+-IF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+- ADD_SUBDIRECTORY(ruby)
+-ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+-
+ IF (PYTHON_LIBRARY)
+ ADD_SUBDIRECTORY(python)
+ ENDIF(PYTHON_LIBRARY)
+-
+-IF (PERL_EXECUTABLE)
+- ADD_SUBDIRECTORY(perl5)
+-ENDIF (PERL_EXECUTABLE)
+diff --git a/swig/perl5/CMakeLists.txt b/swig/perl5/CMakeLists.txt
+deleted file mode 100644
+index df226a4..0000000
+--- a/swig/perl5/CMakeLists.txt
++++ /dev/null
+@@ -1,57 +0,0 @@
+-#
+-# CMakeLists.txt for libzypp-bindings/swig/perl5
+-#
+-# !!Attn!!: This creates two files
+-# 1. zypp.so
+-# 2. zypp.pm
+-# and the .pm file gets loaded.
+-#
+-
+-ENABLE_TESTING()
+-ADD_SUBDIRECTORY(tests)
+-
+-# SWIG_OUPUT is per-target
+-SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libzypp_perl.cc" )
+-
+-EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{cppflags}" OUTPUT_VARIABLE PERL_CXXFLAGS)
+-EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{archlib}.\"/CORE\"" OUTPUT_VARIABLE PERL_CORE_DIR)
+-EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorarch}" OUTPUT_VARIABLE PERL_VENDOR_ARCH)
+-EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorlib}" OUTPUT_VARIABLE PERL_VENDOR_LIB)
+-EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{ccdlflags}" OUTPUT_VARIABLE PERL_LINK_FLAGS)
+-
+-MESSAGE(STATUS "Perl executable: ${PERL_EXECUTABLE}")
+-MESSAGE(STATUS "Perl core dir: ${PERL_CORE_DIR}")
+-MESSAGE(STATUS "Perl vendor arch dir: ${PERL_VENDORDIR}")
+-
+-ADD_DEFINITIONS( ${PERL_CXXFLAGS} -Wno-unused -Wno-error )
+-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PERL_CXXFLAGS}")
+-
+-LINK_DIRECTORIES( ${PERL_CORE_DIR} )
+-
+-if(COMMAND cmake_policy)
+- cmake_policy(SET CMP0003 NEW)
+-endif(COMMAND cmake_policy)
+-
+-ADD_CUSTOM_COMMAND (
+- OUTPUT ${SWIG_OUTPUT}
+- COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for perl..."
+- COMMAND ${SWIG_EXECUTABLE} ${SWIG_DEFINITIONS} -c++ -perl5 -o ${SWIG_OUTPUT} -I${ZYPP_INCLUDE_DIR} ${SWIG_INPUT}
+- COMMAND ${CMAKE_COMMAND} -E echo "Done."
+- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/../*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+-)
+-
+-ADD_LIBRARY( zypp_perl SHARED ${SWIG_OUTPUT} )
+-SET_TARGET_PROPERTIES( zypp_perl
+- PROPERTIES
+- PREFIX ""
+- OUTPUT_NAME zypp
+-)
+-
+-INCLUDE_DIRECTORIES( ${PERL_CORE_DIR} )
+-INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/swig )
+-INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+-TARGET_LINK_LIBRARIES( zypp_perl ${ZYPP_LIBRARY} )
+-
+-INSTALL(TARGETS zypp_perl LIBRARY DESTINATION ${PERL_VENDOR_ARCH})
+-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zypp.pm DESTINATION ${PERL_VENDOR_LIB})
+diff --git a/swig/perl5/perl.i b/swig/perl5/perl.i
+deleted file mode 100644
+index 8c60f30..0000000
+--- a/swig/perl5/perl.i
++++ /dev/null
+@@ -1,91 +0,0 @@
+-
+-%ignore zypp::Arch_empty;
+-
+-namespace zypp
+-{
+- // These operators must be ignored otherwise the wrapper does
+- // not compile (using swig 1.3.29).
+- %ignore operator<<;
+- %ignore operator==;
+- %ignore operator!=;
+-
+- namespace filesystem
+- {
+- // Same as above.
+- %ignore operator==;
+- %ignore operator!=;
+- %ignore operator<<;
+- }
+-}
+-
+-%define iter(cls, storetype)
+-%extend cls {
+- cls::const_iterator iterator_incr(cls::const_iterator *it){
+- (*it)++;
+- return *it;
+- }
+- cls::const_iterator iterator_decr(cls::const_iterator *it){
+- (*it)--;
+- return *it;
+- }
+- bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+- return (it1 == it2);
+- }
+- storetype iterator_value(cls::const_iterator it) {
+- return (&**it);
+- }
+- cls::const_iterator cBegin() {
+- return self->begin();
+- }
+- cls::const_iterator cEnd() {
+- return self->end();
+- }
+-};
+-%enddef
+-
+-%define iter2(cls, storetype)
+-%extend cls {
+- cls::const_iterator iterator_incr(cls::const_iterator *it){
+- ++(*it);
+- return *it;
+- }
+- cls::const_iterator iterator_decr(cls::const_iterator *it){
+- --(*it);
+- return *it;
+- }
+- bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+- return (it1 == it2);
+- }
+- storetype iterator_value(cls::const_iterator it) {
+- return (*it);
+- }
+- cls::const_iterator cBegin() {
+- return self->begin();
+- }
+- cls::const_iterator cEnd() {
+- return self->end();
+- }
+-};
+-%enddef
+-
+-// no operator--
+-%define forwarditer(cls, storetype)
+-%extend cls {
+- cls::const_iterator iterator_incr(cls::const_iterator *it){
+- ++(*it);
+- return *it;
+- }
+- bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+- return (it1 == it2);
+- }
+- storetype iterator_value(cls::const_iterator it) {
+- return (*it);
+- }
+- cls::const_iterator cBegin() {
+- return self->begin();
+- }
+- cls::const_iterator cEnd() {
+- return self->end();
+- }
+-};
+-%enddef
+diff --git a/swig/perl5/tests/CMakeLists.txt b/swig/perl5/tests/CMakeLists.txt
+deleted file mode 100644
+index af6e7a7..0000000
+--- a/swig/perl5/tests/CMakeLists.txt
++++ /dev/null
+@@ -1,8 +0,0 @@
+-#
+-# CMakeLists.txt for libzypp-bindings/swig/perl5/tests
+-#
+-
+-ENABLE_TESTING()
+-
+-ADD_TEST(bindings_perl_loading perl ${CMAKE_CURRENT_SOURCE_DIR}/loading.pl)
+-ADD_TEST(bindings_perl_starting perl ${CMAKE_CURRENT_SOURCE_DIR}/starting.pl)
+diff --git a/swig/perl5/tests/loading.pl b/swig/perl5/tests/loading.pl
+deleted file mode 100644
+index 0f45c2d..0000000
+--- a/swig/perl5/tests/loading.pl
++++ /dev/null
+@@ -1,7 +0,0 @@
+-#!/usr/bin/perl
+-
+-use FindBin qw($Bin);
+-use lib "$Bin/../../../build/swig/perl5";
+-
+-use zypp;
+-
+diff --git a/swig/perl5/tests/starting.pl b/swig/perl5/tests/starting.pl
+deleted file mode 100644
+index 09d3954..0000000
+--- a/swig/perl5/tests/starting.pl
++++ /dev/null
+@@ -1,9 +0,0 @@
+-#!/usr/bin/perl
+-
+-use FindBin qw($Bin);
+-use lib "$Bin/../../../build/swig/perl5";
+-
+-use zypp;
+-
+-$zfactory = zyppc::ZYppFactory_instance();
+-$zypp = $zfactory->getZYpp;
+diff --git a/swig/ruby/CMakeLists.txt b/swig/ruby/CMakeLists.txt
+deleted file mode 100644
+index 08d6329..0000000
+--- a/swig/ruby/CMakeLists.txt
++++ /dev/null
+@@ -1,62 +0,0 @@
+-#
+-# CMakeLists.txt for libzypp-bindings/swig/ruby
+-#
+-
+-ENABLE_TESTING()
+-ADD_SUBDIRECTORY(tests)
+-
+-# SWIG_OUPUT is per-target
+-
+-SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libzypp_ruby.cc" )
+-
+-MESSAGE(STATUS "Ruby executable: ${RUBY_EXECUTABLE}")
+-MESSAGE(STATUS "Ruby vendor arch dir: ${RUBY_VENDORARCH_DIR}")
+-MESSAGE(STATUS "Ruby include path: ${RUBY_INCLUDE_PATH}")
+-
+-ADD_CUSTOM_COMMAND (
+- OUTPUT "${SWIG_OUTPUT}"
+- COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Ruby..."
+- COMMAND ${SWIG_EXECUTABLE} ${SWIG_DEFINITIONS} -c++ -ruby -o ${SWIG_OUTPUT} -I${ZYPP_INCLUDE_DIR} ${SWIG_INPUT}
+- COMMAND ${CMAKE_COMMAND} -E echo "Done."
+- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/../*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+-)
+-
+-ADD_LIBRARY( zypp_ruby SHARED ${SWIG_OUTPUT} )
+-
+-# name it 'zypp.so'
+-# and don't prefix with 'lib'
+-SET_TARGET_PROPERTIES( zypp_ruby PROPERTIES OUTPUT_NAME "zypp" PREFIX "" )
+-
+-INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} )
+-INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/swig )
+-INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+-
+-TARGET_LINK_LIBRARIES( zypp_ruby ${RUBY_LIBRARY} )
+-TARGET_LINK_LIBRARIES( zypp_ruby ${ZYPP_LIBRARY} )
+-
+-INSTALL(TARGETS zypp_ruby LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR})
+-
+-#
+-# Generate HTML documentation with rdoc
+-#
+-# This requires rdoc-swig from https://github.com/kkaempf/rdoc-swig
+-#
+-
+-IF(EXISTS ${CMAKE_SOURCE_DIR}/swig/ruby/rdoc)
+-SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
+-ADD_CUSTOM_COMMAND (
+- OUTPUT ${rdoc_dir}
+- COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..."
+- COMMAND rm -rf ${rdoc_dir}
+- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rdoc -o ${rdoc_dir} zypp.i *.i ruby/*.i
+- COMMAND ${CMAKE_COMMAND} -E echo "Done."
+- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/swig
+- DEPENDS ${CMAKE_SOURCE_DIR}/swig/*.i ${CMAKE_SOURCE_DIR}/swig/ruby/*.rb ${CMAKE_SOURCE_DIR}/swig/ruby/*.i
+-)
+-ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}")
+-ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/swig/ruby/rdoc)
+-
+-#
+-# Leave this to %doc in the .spec file
+-#INSTALL(DIRECTORY "${rdoc_dir}" DESTINATION ${DOC_INSTALL_DIR})
+diff --git a/swig/ruby/ruby.i b/swig/ruby/ruby.i
+deleted file mode 100644
+index d2d3025..0000000
+--- a/swig/ruby/ruby.i
++++ /dev/null
+@@ -1,125 +0,0 @@
+-
+-%rename *::asString "to_s";
+-
+-namespace zypp
+-{
+- // Not ignoring gives a very strange error in the "pokus" testsuite: SWIG
+- // defines a Ruby module-function "==" which (when included into the main
+- // namespace) is apparently used where is should not.
+- %ignore operator==;
+-
+- // Just to avoid warnings.
+- %ignore operator!=;
+- %ignore operator<<;
+-
+- namespace filesystem
+- {
+- // Same as above.
+- %ignore operator==;
+- %ignore operator!=;
+- %ignore operator<<;
+- }
+-
+-}
+-
+-/*
+- * Extend cls with an ruby-like each iterator and a to_a method. Yields
+- * objects of type storetype. Parameter storetype must be a pointer type.
+- */
+-#define iter2(cls, storetype) \
+-%mixin cls "Enumerable"; \
+-%extend cls \
+-{ \
+- void each() { \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const storetype tmp = &**i; \
+- rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+- i++; \
+- } \
+- } \
+-\
+- VALUE to_a() { \
+- VALUE ary = rb_ary_new(); \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const storetype tmp = &**i; \
+- rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+- i++; \
+- } \
+- return ary; \
+- } \
+-}
+-
+-
+-/*
+- * Like iter2, but does only one dereferencing from the iterator.
+- */
+-#define iter3(cls, storetype) \
+-%mixin cls "Enumerable"; \
+-%extend cls \
+-{ \
+- void each() { \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const storetype tmp = &*i; \
+- rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+- i++; \
+- } \
+- } \
+-\
+- VALUE to_a() { \
+- VALUE ary = rb_ary_new(); \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const storetype tmp = &*i; \
+- rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+- i++; \
+- } \
+- return ary; \
+- } \
+-}
+-
+-/*
+- * This is for an iterator whichs operator* returns by value (i.e. a temporary).
+- * Like e.g. the Capabilities::const_iterator does. If the compiler warns you are
+- * taking the address of a temporary when using iter3, you most probaly need this one.
+- *
+- */
+-#define by_value_iterator(cls) \
+-%mixin cls "Enumerable"; \
+-%extend cls \
+-{ \
+- void each() { \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const cls::value_type* tmp = new cls::value_type( *i ); \
+- rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+- i++; \
+- } \
+- } \
+-\
+- VALUE to_a() { \
+- VALUE ary = rb_ary_new(); \
+- cls::const_iterator i = self->begin(); \
+- while (i != self->end()) { \
+- const cls::value_type* tmp = new cls::value_type( *i ); \
+- rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+- i++; \
+- } \
+- return ary; \
+- } \
+-}
+-
+-%exception
+-{
+- try {
+- $action
+- }
+- catch (const Exception& e) {
+- static VALUE zyppexception = rb_define_class("ZYppException", rb_eStandardError);
+- std::string tmp = e.historyAsString() + e.asUserString();
+- rb_raise(zyppexception, tmp.c_str());
+- }
+-}
+-
+diff --git a/swig/ruby/std_list.i b/swig/ruby/std_list.i
+deleted file mode 100644
+index f6d36e6..0000000
+--- a/swig/ruby/std_list.i
++++ /dev/null
+@@ -1,533 +0,0 @@
+-/* -----------------------------------------------------------------------------
+- * See the LICENSE file for information on copyright, usage and redistribution
+- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+- *
+- * std_list.i
+- *
+- * SWIG typemaps for std::list
+- * ----------------------------------------------------------------------------- */
+-
+-%include <std_common.i>
+-
+-// ------------------------------------------------------------------------
+-// std::list
+-//
+-// The aim of all that follows would be to integrate std::list with
+-// Ruby as much as possible, namely, to allow the user to pass and
+-// be returned Ruby arrays
+-// const declarations are used to guess the intent of the function being
+-// exported; therefore, the following rationale is applied:
+-//
+-// -- f(std::list<T>), f(const std::list<T>&), f(const std::list<T>*):
+-// the parameter being read-only, either a Ruby array or a
+-// previously wrapped std::list<T> can be passed.
+-// -- f(std::list<T>&), f(std::list<T>*):
+-// the parameter must be modified; therefore, only a wrapped std::list
+-// can be passed.
+-// -- std::list<T> f():
+-// the list is returned by copy; therefore, a Ruby array of T:s
+-// is returned which is most easily used in other Ruby functions
+-// -- std::list<T>& f(), std::list<T>* f(), const std::list<T>& f(),
+-// const std::list<T>* f():
+-// the list is returned by reference; therefore, a wrapped std::list
+-// is returned
+-// ------------------------------------------------------------------------
+-
+-%{
+-#include <list>
+-#include <algorithm>
+-#include <stdexcept>
+-%}
+-
+-// exported class
+-
+-namespace std {
+-
+- %mixin list "Enumerable";
+-
+- template<class T> class list {
+- %typemap(in) list<T> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- $1.push_back(*x);
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const list<T>& (std::list<T> temp),
+- const list<T>* (std::list<T> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- temp.push_back(*x);
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+-
+- void each() {
+- for ( std::list<T>::const_iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+-
+-
+- %typemap(out) list<T> {
+- $result = rb_ary_new2($1.size());
+- unsigned int i = 0;
+- for ( std::list<T>::iterator it = $1.begin();
+- it != $1.end();
+- ++it )
+- {
+- T* x = new T((*it));
+- rb_ary_store($result,i,
+- SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 1));
+- ++i;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) list<T> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const list<T>&,
+- const list<T>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- list();
+- list(unsigned int size);
+- list(unsigned int size, const T& value);
+- list(const list<T> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) push_back;
+- void push_back(const T& x);
+- %extend {
+- /*
+- T pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty list");
+- T x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T& __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- void __setitem__(int i, const T& x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- */
+- void each() {
+- for ( std::list<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+-
+- // Partial specialization for lists of pointers. [ beazley ]
+-
+- %mixin list<T*> "Enumerable";
+- template<class T> class list<T*> {
+- %typemap(in) list<T*> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = std::list<T* >(size);
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- (($1_type &)$1)[i] = x;
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const list<T*>& (std::list<T*> temp),
+- const list<T*>* (std::list<T*> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- temp = std::list<T* >(size);
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- temp[i] = x;
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+- %typemap(out) list<T*> {
+- $result = rb_ary_new2($1.size());
+- for (unsigned int i=0; i<$1.size(); i++) {
+- T* x = (($1_type &)$1)[i];
+- rb_ary_store($result,i,
+- SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) list<T*> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T* >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const list<T*>&,
+- const list<T*>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T* >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- list();
+- list(unsigned int size);
+- list(unsigned int size, T * &value);
+- list(const list<T*> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) push_back;
+- void push_back(T* x);
+- %extend {
+- /*
+- T* pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty list");
+- T* x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T* __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- void __setitem__(int i, T* x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- */
+- void each() {
+- for ( std::list<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+-
+-
+- // specializations for built-ins
+-
+- %define specialize_std_list(T,CHECK,CONVERT_FROM,CONVERT_TO)
+- %mixin list<T> "Enumerable";
+- template<> class list<T> {
+- %typemap(in) list<T> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = std::list<T >(size);
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- if (CHECK(o))
+- (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+- else
+- rb_raise(rb_eTypeError,
+- "wrong argument type"
+- " (expected list<" #T ">)");
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const list<T>& (std::list<T> temp),
+- const list<T>* (std::list<T> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- temp = std::list<T >(size);
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- if (CHECK(o))
+- temp[i] = (T)(CONVERT_FROM(o));
+- else
+- rb_raise(rb_eTypeError,
+- "wrong argument type"
+- " (expected list<" #T ">)");
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+- %typemap(out) list<T> {
+- $result = rb_ary_new2($1.size());
+- for (unsigned int i=0; i<$1.size(); i++)
+- rb_ary_store($result,i,CONVERT_TO((($1_type &)$1)[i]));
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) list<T> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- VALUE o = RARRAY($input)->ptr[0];
+- if (CHECK(o))
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const list<T>&,
+- const list<T>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- VALUE o = RARRAY($input)->ptr[0];
+- if (CHECK(o))
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped list? */
+- std::list<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- list();
+- list(unsigned int size);
+- list(unsigned int size, const T& value);
+- list(const list<T> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) push_back;
+- void push_back(T x);
+- %extend {
+- /*
+- T pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty list");
+- T x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- void __setitem__(int i, T x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("list index out of range");
+- }
+- */
+- void each() {
+- for ( std::list<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+- %enddef
+-
+- specialize_std_list(bool,SWIG_BOOL_P,SWIG_RB2BOOL,SWIG_BOOL2RB);
+- specialize_std_list(char,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(int,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(short,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(long,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(unsigned char,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(unsigned int,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(unsigned short,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(unsigned long,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_list(double,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+- specialize_std_list(float,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+- specialize_std_list(std::string,SWIG_STRING_P,SWIG_RB2STR,SWIG_STR2RB);
+-
+-}
+-
+diff --git a/swig/ruby/std_set.i b/swig/ruby/std_set.i
+deleted file mode 100644
+index af2a146..0000000
+--- a/swig/ruby/std_set.i
++++ /dev/null
+@@ -1,527 +0,0 @@
+-/* -----------------------------------------------------------------------------
+- * See the LICENSE file for information on copyright, usage and redistribution
+- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+- *
+- * std_set.i
+- *
+- * SWIG typemaps for std::set
+- * ----------------------------------------------------------------------------- */
+-
+-%include <std_common.i>
+-
+-// ------------------------------------------------------------------------
+-// std::set
+-//
+-// The aim of all that follows would be to integrate std::set with
+-// Ruby as much as possible, namely, to allow the user to pass and
+-// be returned Ruby arrays
+-// const declarations are used to guess the intent of the function being
+-// exported; therefore, the following rationale is applied:
+-//
+-// -- f(std::set<T>), f(const std::set<T>&), f(const std::set<T>*):
+-// the parameter being read-only, either a Ruby array or a
+-// previously wrapped std::set<T> can be passed.
+-// -- f(std::set<T>&), f(std::set<T>*):
+-// the parameter must be modified; therefore, only a wrapped std::set
+-// can be passed.
+-// -- std::set<T> f():
+-// the set is returned by copy; therefore, a Ruby array of T:s
+-// is returned which is most easily used in other Ruby functions
+-// -- std::set<T>& f(), std::set<T>* f(), const std::set<T>& f(),
+-// const std::set<T>* f():
+-// the set is returned by reference; therefore, a wrapped std::set
+-// is returned
+-// ------------------------------------------------------------------------
+-
+-%{
+-#include <set>
+-#include <algorithm>
+-#include <stdexcept>
+-%}
+-
+-// exported class
+-
+-namespace std {
+-
+- %mixin set "Enumerable";
+-
+- template<class T> class set {
+- %typemap(in) set<T> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- $1.insert(*x);
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const set<T>& (std::set<T> temp),
+- const set<T>* (std::set<T> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- temp.insert(*x);
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+-
+- void each() {
+- for ( std::set<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = (T *) &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+-
+-
+- %typemap(out) set<T> {
+- $result = rb_ary_new2($1.size());
+- unsigned int i = 0;
+- for ( std::set<T>::iterator it = $1.begin();
+- it != $1.end();
+- ++it )
+- {
+- T* x = new T((*it));
+- rb_ary_store($result,i,
+- SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 1));
+- ++i;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) set<T> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const set<T>&,
+- const set<T>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- set();
+- set(const set<T> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) insert;
+- void insert(const T& x);
+- %extend {
+- /*
+- T pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty set");
+- T x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T& __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- void __setitem__(int i, const T& x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- */
+- void each() {
+- for ( std::set<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = (T *)&(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+-
+- // Partial specialization for sets of pointers. [ beazley ]
+-
+- %mixin set<T*> "Enumerable";
+- template<class T> class set<T*> {
+- %typemap(in) set<T*> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = std::set<T* >(size);
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- (($1_type &)$1)[i] = x;
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const set<T*>& (std::set<T*> temp),
+- const set<T*>* (std::set<T*> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- temp = std::set<T* >(size);
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- T* x;
+- SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+- temp[i] = x;
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+- %typemap(out) set<T*> {
+- $result = rb_ary_new2($1.size());
+- for (unsigned int i=0; i<$1.size(); i++) {
+- T* x = (($1_type &)$1)[i];
+- rb_ary_store($result,i,
+- SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) set<T*> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T* >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const set<T*>&,
+- const set<T*>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- T* x;
+- VALUE o = RARRAY($input)->ptr[0];
+- if ((SWIG_ConvertPtr(o,(void **) &x,
+- $descriptor(T *),0)) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T* >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- set();
+- set(const set<T*> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) insert;
+- void insert(T* x);
+- %extend {
+- /*
+- T* pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty set");
+- T* x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T* __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- void __setitem__(int i, T* x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- */
+- void each() {
+- for ( std::set<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = (T*) &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+-
+-
+- // specializations for built-ins
+-
+- %define specialize_std_set(T,CHECK,CONVERT_FROM,CONVERT_TO)
+- %mixin set<T> "Enumerable";
+- template<> class set<T> {
+- %typemap(in) set<T> {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- $1 = std::set<T >(size);
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- if (CHECK(o))
+- (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+- else
+- rb_raise(rb_eTypeError,
+- "wrong argument type"
+- " (expected set<" #T ">)");
+- }
+- } else {
+- void *ptr;
+- SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+- $1 = *(($&1_type) ptr);
+- }
+- }
+- %typemap(in) const set<T>& (std::set<T> temp),
+- const set<T>* (std::set<T> temp) {
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- temp = std::set<T >(size);
+- $1 = &temp;
+- for (unsigned int i=0; i<size; i++) {
+- VALUE o = RARRAY($input)->ptr[i];
+- if (CHECK(o))
+- temp[i] = (T)(CONVERT_FROM(o));
+- else
+- rb_raise(rb_eTypeError,
+- "wrong argument type"
+- " (expected set<" #T ">)");
+- }
+- } else {
+- SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+- }
+- }
+- %typemap(out) set<T> {
+- $result = rb_ary_new2($1.size());
+- for (unsigned int i=0; i<$1.size(); i++)
+- rb_ary_store($result,i,CONVERT_TO((($1_type &)$1)[i]));
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) set<T> {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- VALUE o = RARRAY($input)->ptr[0];
+- if (CHECK(o))
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $&1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- %typecheck(SWIG_TYPECHECK_VECTOR) const set<T>&,
+- const set<T>* {
+- /* native sequence? */
+- if (rb_obj_is_kind_of($input,rb_cArray)) {
+- unsigned int size = RARRAY($input)->len;
+- if (size == 0) {
+- /* an empty sequence can be of any type */
+- $1 = 1;
+- } else {
+- /* check the first element only */
+- VALUE o = RARRAY($input)->ptr[0];
+- if (CHECK(o))
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- } else {
+- /* wrapped set? */
+- std::set<T >* v;
+- if (SWIG_ConvertPtr($input,(void **) &v,
+- $1_descriptor,0) != -1)
+- $1 = 1;
+- else
+- $1 = 0;
+- }
+- }
+- public:
+- set();
+- set(const set<T> &);
+-
+- %rename(__len__) size;
+- unsigned int size() const;
+- %rename("empty?") empty;
+- bool empty() const;
+- void clear();
+- %rename(push) insert;
+- void insert(T x);
+- %extend {
+- /*
+- T pop() throw (std::out_of_range) {
+- if (self->size() == 0)
+- throw std::out_of_range("pop from empty set");
+- T x = self->back();
+- self->pop_back();
+- return x;
+- }
+- T __getitem__(int i) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i += size;
+- if (i>=0 && i<size)
+- return (*self)[i];
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- void __setitem__(int i, T x) throw (std::out_of_range) {
+- int size = int(self->size());
+- if (i<0) i+= size;
+- if (i>=0 && i<size)
+- (*self)[i] = x;
+- else
+- throw std::out_of_range("set index out of range");
+- }
+- */
+- void each() {
+- for ( std::set<T>::iterator it = self->begin();
+- it != self->end();
+- ++it )
+- {
+- T* x = &(*it);
+- rb_yield(SWIG_NewPointerObj((void *) x,
+- $descriptor(T *), 0));
+- }
+- }
+- }
+- };
+- %enddef
+-
+- specialize_std_set(bool,SWIG_BOOL_P,SWIG_RB2BOOL,SWIG_BOOL2RB);
+- specialize_std_set(char,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(int,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(short,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(long,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(unsigned char,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(unsigned int,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(unsigned short,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(unsigned long,FIXNUM_P,FIX2INT,INT2NUM);
+- specialize_std_set(double,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+- specialize_std_set(float,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+- specialize_std_set(std::string,SWIG_STRING_P,SWIG_RB2STR,SWIG_STR2RB);
+-
+-}
+-
+diff --git a/swig/ruby/tests/CMakeLists.txt b/swig/ruby/tests/CMakeLists.txt
+deleted file mode 100644
+index 3b084df..0000000
+--- a/swig/ruby/tests/CMakeLists.txt
++++ /dev/null
+@@ -1,11 +0,0 @@
+-#
+-# CMakeLists.txt for libzypp-bindings/swig/ruby/tests
+-#
+-
+-ENABLE_TESTING()
+-
+-ADD_TEST(bindings_ruby_loading ruby -C ${CMAKE_CURRENT_SOURCE_DIR} loading.rb)
+-ADD_TEST(bindings_ruby_arch.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} arch.rb)
+-ADD_TEST(bindings_ruby_bytecount.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} bytecount.rb)
+-ADD_TEST(bindings_ruby_starting.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} starting.rb)
+-ADD_TEST(bindings_ruby_target.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} target.rb)
+diff --git a/swig/ruby/tests/arch.rb b/swig/ruby/tests/arch.rb
+deleted file mode 100644
+index 3e2f508..0000000
+--- a/swig/ruby/tests/arch.rb
++++ /dev/null
+@@ -1,55 +0,0 @@
+-#
+-# Arch
+-#
+-
+-$:.unshift File.expand_path(File.join(File.dirname(__FILE__),"..","..","..","build","swig","ruby"))
+-
+-require 'test/unit'
+-require 'zypp'
+-
+-class Zypp::Arch
+- include Comparable
+-end
+-
+-class ArchTest < Test::Unit::TestCase
+- include Zypp
+- def test_arch
+- # define i386, a builtin
+-
+- a = Arch.new("i386")
+- assert a
+- assert_equal "i386", a.to_s
+- assert_equal true, a.is_builtin
+-
+- # i486 is 'bigger' than i386
+-
+- b = Arch.new("i486")
+- assert b
+- assert_equal "i486", b.to_s
+- assert b.is_builtin
+- if VERSION > 800
+- assert_equal a, b.base_arch
+- end
+- assert a < b
+- assert a.compatible_with?(b)
+-
+- # A new, adventurous architecture
+- z = Arch.new("xyzzy")
+- assert z
+- assert_equal "xyzzy", z.to_s
+- assert_equal false, z.is_builtin
+-
+- # predefined archs
+- assert_equal Arch.new("noarch"), Arch.noarch
+- assert_equal a, Arch.i386
+- assert_equal b, Arch.i486
+- assert_equal Arch.new("i586"), Arch.i586
+- assert_equal Arch.new("i686"), Arch.i686
+- assert_equal Arch.new("x86_64"), Arch.x86_64
+- assert_equal Arch.new("ia64"), Arch.ia64
+- assert_equal Arch.new("ppc"), Arch.ppc
+- assert_equal Arch.new("ppc64"), Arch.ppc64
+- assert_equal Arch.new("s390"), Arch.s390
+- assert_equal Arch.new("s390x"), Arch.s390x
+- end
+-end
+diff --git a/swig/ruby/tests/bytecount.rb b/swig/ruby/tests/bytecount.rb
+deleted file mode 100644
+index 5b46e14..0000000
+--- a/swig/ruby/tests/bytecount.rb
++++ /dev/null
+@@ -1,25 +0,0 @@
+-#
+-# Test Bytecount
+-#
+-
+-$:.unshift "../../../build/swig/ruby"
+-
+-
+-# test loading of extension
+-require 'test/unit'
+-
+-class LoadTest < Test::Unit::TestCase
+- require 'zypp'
+- include Zypp
+-
+- def test_bytecount
+- g = ByteCount.new(ByteCount.G)
+- assert g
+- gb = ByteCount.new(ByteCount.GB)
+- assert gb
+- k = ByteCount.new(ByteCount.K)
+- assert k.to_i == 1024
+- mb = ByteCount.new(ByteCount.MB)
+- assert mb.to_i == 1000*1000
+- end
+-end
+diff --git a/swig/ruby/tests/commit_callbacks.rb b/swig/ruby/tests/commit_callbacks.rb
+deleted file mode 100644
+index 74767ce..0000000
+--- a/swig/ruby/tests/commit_callbacks.rb
++++ /dev/null
+@@ -1,46 +0,0 @@
+-#
+-# Test commit callbacks
+-#
+-
+-$:.unshift "../../../build/swig/ruby"
+-
+-
+-require 'test/unit'
+-require 'zypp'
+-
+-class CommitReceiver
+- # Define class function, we pass the class (not an instance of the class)
+- # to the CommitCallbacks
+- def self.removal_start resolvable
+- $stderr.puts "Starting to remove #{resolvable}"
+- end
+-end
+-
+-class CommitCallbacksTest < Test::Unit::TestCase
+- def test_removal_callback
+- commit_callbacks = Zypp::CommitCallbacks.new
+- assert_equal nil, commit_callbacks.receiver
+- # In Ruby the class is also an object, so we connect to the class
+- commit_callbacks.connect CommitReceiver
+- assert_equal CommitReceiver, commit_callbacks.receiver
+-
+- z = Zypp::ZYppFactory::instance.getZYpp
+-
+- z.initializeTarget(Zypp::Pathname.new("/"))
+- t = z.target
+- t.load
+- t.buildCache
+-
+- emitter = Zypp::CommitCallbacksEmitter.new
+- p = z.pool
+- p.each do |item|
+- puts "Emitting removal of ", item
+- puts item.methods.inspect
+- emitter.remove_start(item)
+- break
+- end
+-
+- commit_callbacks.disconnect
+- assert_equal nil, commit_callbacks.receiver
+- end
+-end
+diff --git a/swig/ruby/tests/loading.rb b/swig/ruby/tests/loading.rb
+deleted file mode 100644
+index 01ae25a..0000000
+--- a/swig/ruby/tests/loading.rb
++++ /dev/null
+@@ -1,16 +0,0 @@
+-#
+-# Test loading of the bindings
+-#
+-
+-$:.unshift "../../../build/swig/ruby"
+-
+-
+-# test loading of extension
+-require 'test/unit'
+-
+-class LoadTest < Test::Unit::TestCase
+- def test_loading
+- require 'zypp'
+- assert true
+- end
+-end
+diff --git a/swig/ruby/tests/starting.rb b/swig/ruby/tests/starting.rb
+deleted file mode 100644
+index 5f3afb2..0000000
+--- a/swig/ruby/tests/starting.rb
++++ /dev/null
+@@ -1,22 +0,0 @@
+-#
+-# Test starting of zypp
+-#
+-
+-$:.unshift "../../../build/swig/ruby"
+-
+-
+-# test loading of extension
+-require 'test/unit'
+-
+-class LoadTest < Test::Unit::TestCase
+- def test_loading
+- require 'zypp'
+- zypp = Zypp::ZYppFactory::instance.getZYpp
+- assert zypp
+- zconfig = Zypp::ZConfig::instance
+- assert zconfig
+- puts zconfig.systemArchitecture
+- zconfig.setSystemArchitecture(Zypp::Arch.new("i686"))
+- puts zconfig.systemArchitecture
+- end
+-end
+diff --git a/swig/ruby/tests/target.rb b/swig/ruby/tests/target.rb
+deleted file mode 100644
+index cfecfff..0000000
+--- a/swig/ruby/tests/target.rb
++++ /dev/null
+@@ -1,44 +0,0 @@
+-#
+-# Example for target
+-#
+-
+-$:.unshift "../../../build/swig/ruby"
+-
+-
+-# test loading of extension
+-require 'test/unit'
+-
+-class LoadTest < Test::Unit::TestCase
+- require 'zypp'
+- include Zypp
+- def test_target
+- z = ZYppFactory::instance.getZYpp
+-
+- assert z.homePath
+- assert z.tmpPath
+-
+- z.initializeTarget(Zypp::Pathname.new("/"))
+- t = z.target
+- assert t
+- t.load
+- t.buildCache
+-
+- p = z.pool
+- assert p
+- assert p.size > 0
+-
+- # Iterate over pool, gives PoolItems
+- i = 0
+- puts "#{p.size} PoolItems:"
+- p.each do | pi |
+- i = i + 1
+- break if i > 10
+- puts pi
+- # PoolItems have status and a resolvable
+-# r = pi.resolvable
+-# puts "#{r.name}-#{r.edition}"
+- end
+-
+- assert true
+- end
+-end
+diff --git a/swig/zypp.i b/swig/zypp.i
+index 08d573b..c270d6c 100644
+--- a/swig/zypp.i
++++ b/swig/zypp.i
+@@ -5,25 +5,8 @@
+ */
+ #define PRODUCTION 1
+
+-#ifdef SWIGPERL5
+-%{
+- #undef NORMAL
+- #undef readdir
+- #undef Fflush
+- #undef Mkdir
+- #undef strerror
+-%}
+-#endif
+-
+ %{
+ /* Includes the header in the wrapper code */
+-#ifdef SWIGRUBY
+-#define REG_EXTENDED 1
+-#define REG_ICASE (REG_EXTENDED << 1)
+-#define REG_NEWLINE (REG_ICASE << 1)
+-#define REG_NOSUB (REG_NEWLINE << 1)
+-#endif
+-
+ /*
+ * type definitions to keep the C code generic
+ */
+@@ -52,62 +35,6 @@
+ #define TARGET_THREAD_END_ALLOW SWIG_PYTHON_THREAD_END_ALLOW
+ #endif
+
+-#if defined(SWIGRUBY)
+-#define Target_Null_p(x) NIL_P(x)
+-#define Target_INCREF(x)
+-#define Target_DECREF(x)
+-#define Target_True Qtrue
+-#define Target_False Qfalse
+-#define Target_Null Qnil
+-#define Target_Type VALUE
+-#define Target_Bool(x) ((x)?Qtrue:Qfalse)
+-#define Target_WChar(x) INT2FIX(x)
+-#define Target_Int(x) INT2FIX(x)
+-#define Target_String(x) rb_str_new2(x)
+-#define Target_Real(x) rb_float_new(x)
+-#define Target_Array() rb_ary_new()
+-#define Target_SizedArray(len) rb_ary_new2(len)
+-#define Target_Append(x,y) rb_ary_push(x,y)
+-#define Target_DateTime(x) Qnil
+-#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
+-#define TARGET_THREAD_END_BLOCK do {} while(0)
+-#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
+-#define TARGET_THREAD_END_ALLOW do {} while(0)
+-#include <ruby.h>
+-#include <rubyio.h>
+-#endif
+-
+-#if defined(SWIGPERL)
+-#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
+-#define TARGET_THREAD_END_BLOCK do {} while(0)
+-#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
+-#define TARGET_THREAD_END_ALLOW do {} while(0)
+-
+-SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value);
+-SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr);
+-SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value);
+-
+-#define Target_Null_p(x) (x == NULL)
+-#define Target_INCREF(x)
+-#define Target_DECREF(x)
+-#define Target_True (&PL_sv_yes)
+-#define Target_False (&PL_sv_no)
+-#define Target_Null NULL
+-#define Target_Type SV *
+-#define Target_Bool(x) (x)?Target_True:Target_False
+-#define Target_WChar(x) NULL
+-#define Target_Int(x) SWIG_From_long(x)
+-#define Target_String(x) SWIG_FromCharPtr(x)
+-#define Target_Real(x) SWIG_From_double(x)
+-#define Target_Array() (SV *)newAV()
+-#define Target_SizedArray(len) (SV *)newAV()
+-#define Target_Append(x,y) av_push(((AV *)(x)), y)
+-#define Target_DateTime(x) NULL
+-#include <perl.h>
+-#include <EXTERN.h>
+-#endif
+-
+-
+ #include <sstream>
+ #include "zypp/base/PtrTypes.h"
+ #include "zypp/base/ReferenceCounted.h"
+@@ -144,33 +71,15 @@ typedef std::list<std::string> StringList;
+ %}
+
+ /* prevent swig from creating a type called 'Target_Type' */
+-#if defined(SWIGRUBY)
+-#define Target_Type VALUE
+-#endif
+ #if defined(SWIGPYTHON)
+ #define Target_Type PyObject*
+ #endif
+-#if defined(SWIGPERL)
+-#define Target_Type SV *
+-#endif
+-
+-#ifdef SWIGRUBY
+-%include "ruby/std_list.i"
+-%include "ruby/std_set.i"
+-%include "ruby/ruby.i"
+-#endif
+-
+ #ifdef SWIGPYTHON
+ %include "std_list.i"
+ %include "std_set.i"
+ %include "python/python.i"
+ #endif
+
+-#ifdef SWIGPERL5
+-%include "std_list.i"
+-%include "perl5/perl.i"
+-#endif
+-
+ #define VERSION ZYPP_VERSION
+
+ /* These include files are pending to be cleaned up from C++ cruft */
diff --git a/packaging/support-armv7-architectures.patch b/packaging/support-armv7-architectures.patch
new file mode 100644
index 0000000..bf2f45e
--- /dev/null
+++ b/packaging/support-armv7-architectures.patch
@@ -0,0 +1,26 @@
+diff -uNr libzypp-bindings-0.5.50/swig/Arch.i libzypp-bindings-0.5.50.new/swig/Arch.i
+--- libzypp-bindings-0.5.50/swig/Arch.i 2011-10-19 00:35:54.000000000 +0800
++++ libzypp-bindings-0.5.50.new/swig/Arch.i 2012-01-29 16:11:03.839382406 +0800
+@@ -84,6 +84,22 @@
+ * builtin: s390s (zSeries 64 bit)
+ */
+ static Arch s390x() { return zypp::Arch_s390x; }
++ /*
++ * builtin: armv7tnhl
++ */
++ static Arch armv7tnhl() { return zypp::Arch_armv7tnhl; }
++ /*
++ * builtin: armv7thl
++ */
++ static Arch armv7thl() { return zypp::Arch_armv7thl; }
++ /*
++ * builtin: armv7nhl
++ */
++ static Arch armv7nhl() { return zypp::Arch_armv7nhl; }
++ /*
++ * builtin: armv7hl
++ */
++ static Arch armv7hl() { return zypp::Arch_armv7hl; }
+ /*
+ * builtin: armv7tnhl
+ */
diff --git a/swig/Arch.i b/swig/Arch.i
new file mode 100644
index 0000000..1129197
--- /dev/null
+++ b/swig/Arch.i
@@ -0,0 +1,238 @@
+/*
+ * Arch.i
+ *
+ * Architecture definitions
+ *
+ * Document-class: Arch
+ * Instances of Arch represent architecture and compatibility.
+ * The system has an architecture (i.e. x86_64) and so does every
+ * Resolvable.
+ *
+ * +Arch#compatible_with?+ is used to detect compatible architectures.
+ * 'noarch' is compatible with any system architecture.
+ *
+ * There is no limit to architecture specifiers, any string can be
+ * passed to the Arch constructor.
+ * However, there is a set of architectures built into libzypp.
+ * +Arch#builtin?+ returns true for an architecture from the builtin set.
+ *
+ * === Usage
+ * arch = Arch.new("i686")
+ * # equivalent:
+ * # arch = Arch.i686
+ *
+ * arch.builtin? -> true
+ *
+ */
+
+%nodefault zypp::Arch;
+namespace zypp {
+class Arch {
+};
+};
+
+%extend zypp::Arch
+{
+ Arch(const char *s) {
+ return new zypp::Arch(s);
+ }
+ ~Arch() {
+ delete $self;
+ }
+
+ /*
+ * builtin: noarch
+ */
+ static Arch noarch() { return zypp::Arch_noarch; }
+ /*
+ * builtin: i386
+ */
+ static Arch i386() { return zypp::Arch_i386; }
+ /*
+ * builtin: i486
+ */
+ static Arch i486() { return zypp::Arch_i486; }
+ /*
+ * builtin: i586
+ */
+ static Arch i586() { return zypp::Arch_i586; }
+ /*
+ * builtin: i686
+ */
+ static Arch i686() { return zypp::Arch_i686; }
+ /*
+ * builtin: i86_64 (AMD 64)
+ */
+ static Arch x86_64() { return zypp::Arch_x86_64; }
+ /*
+ * builtin: ia64 (Itanium)
+ */
+ static Arch ia64() { return zypp::Arch_ia64; }
+ /*
+ * builtin: ppc (Power PC 32 bit)
+ */
+ static Arch ppc() { return zypp::Arch_ppc; }
+ /*
+ * builtin: ppc64 (Power PC 64 bit)
+ */
+ static Arch ppc64() { return zypp::Arch_ppc64; }
+ /*
+ * builtin: s390 (zSeries 32 bit)
+ */
+ static Arch s390() { return zypp::Arch_s390; }
+ /*
+ * builtin: s390s (zSeries 64 bit)
+ */
+ static Arch s390x() { return zypp::Arch_s390x; }
+ /*
+ * builtin: armv7tnhl
+ */
+ static Arch armv7tnhl() { return zypp::Arch_armv7tnhl; }
+ /*
+ * builtin: armv7thl
+ */
+ static Arch armv7thl() { return zypp::Arch_armv7thl; }
+ /*
+ * builtin: armv7nhl
+ */
+ static Arch armv7nhl() { return zypp::Arch_armv7nhl; }
+ /*
+ * builtin: armv7hl
+ */
+ static Arch armv7hl() { return zypp::Arch_armv7hl; }
+
+ /*
+ * builtin: armv7l
+ */
+ static Arch armv7l() { return zypp::Arch_armv7l; }
+ /*
+ * builtin: armv6l
+ */
+ static Arch armv6l() { return zypp::Arch_armv6l; }
+ /*
+ * builtin: armv5tejl
+ */
+ static Arch armv5tejl() { return zypp::Arch_armv5tejl; }
+ /*
+ * builtin: armv5tel
+ */
+ static Arch armv5tel() { return zypp::Arch_armv5tel; }
+ /*
+ * builtin: armv5l
+ */
+ static Arch armv5l() { return zypp::Arch_armv5l; }
+ /*
+ * builtin: armv4tl
+ */
+ static Arch armv4tl() { return zypp::Arch_armv4tl; }
+ /*
+ * builtin: armv4l
+ */
+ static Arch armv4l() { return zypp::Arch_armv4l; }
+ /*
+ * builtin: armv3l
+ */
+ static Arch armv3l() { return zypp::Arch_armv3l; }
+
+#if 0 /* defined(SWIGRUBY) */
+%typemap(out) int is_builtin
+ "$result = $1 ? Qtrue : Qfalse;";
+%rename("builtin?") builtin;
+#endif
+ /*
+ * Whether this is a builtin (or known) architecture.
+ *
+ */
+ bool is_builtin() {
+ return ($self->isBuiltIn() ? 1 : 0);
+ }
+#if defined(SWIGRUBY)
+%typemap(out) int compatible_with
+ "$result = $1 ? Qtrue : Qfalse;";
+%rename("compatible_with?") compatible_with;
+#endif
+ /*
+ * Check if this architecture is compatible with another one
+ *
+ * e.g. 'noarch' is compatible with any arch
+ *
+ */
+ int compatible_with(const zypp::Arch & arch) {
+ return ($self->compatibleWith(arch) ? 1 : 0);
+ }
+
+#if ZYPP_VERSION > 800
+ /*
+ * return the arch before noarch if it's not a multilib arch
+ * (e.g. x86_64,sparc64v,sparc64,ppc64,s390x).
+ *
+ */
+ zypp::Arch base_arch()
+ {
+ return $self->baseArch();
+ }
+#endif
+
+#if defined(SWIGRUBY)
+%alias compare "<=>";
+#endif
+#if defined(SWIGPYTHON)
+ /*
+ * :nodoc:
+ */
+ int __cmp__( const zypp::Arch & arch )
+#else
+ /*
+ * Comparison operator
+ *
+ * returning <0 (smaller), 0 (equal) or >0 (greater)
+ *
+ */
+ int compare( const zypp::Arch & arch )
+#endif
+ { return $self->compare( arch ); }
+
+#if defined(SWIGPERL)
+ /*
+ * :nodoc:
+ */
+ int __eq__( const zypp::Arch & arch )
+#endif
+#if defined(SWIGRUBY)
+%typemap(out) int equal
+ "$result = $1 ? Qtrue : Qfalse;";
+%rename("==") equal;
+ /*
+ * Equality operator
+ *
+ */
+ int equal( const zypp::Arch & arch )
+#endif
+
+#if defined(SWIGPYTHON)
+ /*
+ * :nodoc:
+ * Python treats 'eq' and 'ne' distinct.
+ */
+ int __ne__( const zypp::Arch & arch )
+ { return $self->compare(arch) != 0; }
+ int __eq__( const zypp::Arch & arch )
+#endif
+ { return $self->compare(arch) == 0; }
+
+
+#ifdef SWIGPYTHON
+%rename ("__str__") string();
+#endif
+#ifdef SWIGRUBY
+%rename ("to_s") string();
+#endif
+ /*
+ * String representation
+ *
+ */
+ const char *string()
+ {
+ return $self->c_str();
+ }
+}
diff --git a/swig/ByteCount.i b/swig/ByteCount.i
new file mode 100644
index 0000000..03f17c6
--- /dev/null
+++ b/swig/ByteCount.i
@@ -0,0 +1,49 @@
+
+
+#ifdef SWIGRUBY
+
+namespace zypp
+{
+ // how to do that?
+ // %rename "ByteCount::operator SizeType()" to_i;
+}
+
+#endif
+
+
+// TODO: tell make about dependencies
+%include <zypp/ByteCount.h>
+
+
+#ifdef SWIGRUBY
+
+namespace zypp
+{
+ %extend ByteCount
+ {
+ long long int to_i()
+ {
+ ByteCount::SizeType tmp = *self;
+ return tmp;
+ }
+ }
+}
+
+#endif
+
+#ifdef SWIGPYTHON
+
+namespace zypp
+{
+ %extend ByteCount
+ {
+ long long int __int__()
+ {
+ ByteCount::SizeType tmp = *self;
+ return tmp;
+ }
+ }
+}
+
+#endif
+
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
new file mode 100644
index 0000000..efa48c4
--- /dev/null
+++ b/swig/CMakeLists.txt
@@ -0,0 +1,29 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig
+#
+#
+
+ENABLE_TESTING()
+
+SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" )
+
+#
+# Let's see which target languages are available
+#
+
+FIND_PACKAGE(Ruby)
+FIND_PACKAGE(PythonLibs)
+FIND_PACKAGE(Perl)
+
+
+IF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+ ADD_SUBDIRECTORY(ruby)
+ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+
+IF (PYTHON_LIBRARY)
+ ADD_SUBDIRECTORY(python)
+ENDIF(PYTHON_LIBRARY)
+
+IF (PERL_EXECUTABLE)
+ ADD_SUBDIRECTORY(perl5)
+ENDIF (PERL_EXECUTABLE)
diff --git a/swig/Callbacks.i b/swig/Callbacks.i
new file mode 100644
index 0000000..9a91ddb
--- /dev/null
+++ b/swig/Callbacks.i
@@ -0,0 +1,613 @@
+/*
+ * Callbacks.i
+ *
+ * Callback glue code
+ *
+ * Author: Klaus Kaempf <kkaempf@suse.de>
+ *
+ */
+
+
+/*
+ * Commit callbacks
+ *
+ */
+
+%{
+#include <cstdarg>
+#include <zypp/ZYppCallbacks.h>
+/*
+ * Helpers
+ *
+ */
+
+/*
+ * Action
+ * Symbol representation of :abort, :retry, and :ignore
+ *
+ */
+
+static Target_Type action_abort()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("abort"));
+ return value;
+#endif
+ return 0; // fallback
+ }
+
+static Target_Type action_retry()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("retry"));
+ return value;
+#endif
+ return 0; // fallback
+ }
+
+static Target_Type action_ignore()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("ignore"));
+ return value;
+#endif
+ return 0; // fallback
+ }
+
+/*
+ * Error
+ * Symbol representation of :no_error, :not_found, :io, :invalid
+ *
+ */
+
+static Target_Type error_no_error()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("no_error"));
+ return value;
+#endif
+#if defined(SWIGPYTHON)
+ return Target_String("no_error");
+#endif
+ return 0; // fallback
+ }
+
+static Target_Type error_not_found()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("not_found"));
+ return value;
+#endif
+#if defined(SWIGPYTHON)
+ return Target_String("not_found");
+#endif
+ return 0; // fallback
+ }
+
+static Target_Type error_io()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("io"));
+ return value;
+#endif
+#if defined(SWIGPYTHON)
+ return Target_String("io");
+#endif
+ return 0; // fallback
+ }
+
+static Target_Type error_invalid()
+ {
+#if defined(SWIGRUBY)
+ static VALUE value = Qnil;
+ if (value == Qnil)
+ value = ID2SYM(rb_intern("invalid"));
+ return value;
+#endif
+#if defined(SWIGPYTHON)
+ return Target_String("invalid");
+#endif
+ return 0; // fallback
+ }
+
+/*
+ * This is what makes people hate the ZYPP API. Why can't there
+ * be _one_ Error type ?!
+ */
+static Target_Type
+remove_error2target(target::rpm::RemoveResolvableReport::Error error)
+{
+ Target_Type e;
+ switch(error) {
+ case target::rpm::RemoveResolvableReport::NO_ERROR: e = error_no_error(); break;
+ case target::rpm::RemoveResolvableReport::NOT_FOUND: e = error_not_found(); break;
+ case target::rpm::RemoveResolvableReport::IO: e = error_io(); break;
+ case target::rpm::RemoveResolvableReport::INVALID: e = error_invalid(); break;
+ }
+ return e;
+}
+
+
+/*
+ * This is what makes people hate the ZYPP API. Why can't there
+ * be _one_ Error type ?!
+ */
+static Target_Type
+install_error2target(target::rpm::InstallResolvableReport::Error error)
+{
+ Target_Type e;
+ switch(error) {
+ case target::rpm::InstallResolvableReport::NO_ERROR: e = error_no_error(); break;
+ case target::rpm::InstallResolvableReport::NOT_FOUND: e = error_not_found(); break;
+ case target::rpm::InstallResolvableReport::IO: e = error_io(); break;
+ case target::rpm::InstallResolvableReport::INVALID: e = error_invalid(); break;
+ }
+ return e;
+}
+
+
+/*
+ * This is what makes people hate the ZYPP API. Why can't there
+ * be _one_ Action type ?!
+ */
+static target::PatchScriptReport::Action
+target2patch_script_action(Target_Type a)
+{
+#if defined(SWIGPYTHON)
+ const char *s;
+ if (!PyString_Check(a)) {
+ SWIG_exception_fail(SWIG_TypeError, "Expected string type");
+ }
+ s = PyString_AsString(a);
+ if (!strcmp(s, "abort"))
+ return zypp::target::PatchScriptReport::ABORT;
+ else if (!strcmp(s, "retry"))
+ return zypp::target::PatchScriptReport::RETRY;
+ else if (!strcmp(s, "ignore"))
+ return zypp::target::PatchScriptReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected \"abort\", \"retry\" or \"ignore\"");
+#endif
+#if defined(SWIGRUBY)
+ if (a == action_abort())
+ return zypp::target::PatchScriptReport::ABORT;
+ else if (a == action_retry())
+ return zypp::target::PatchScriptReport::RETRY;
+ else if (a == action_ignore())
+ return zypp::target::PatchScriptReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected :abort, :retry or :ignore");
+#endif
+fail:
+ return zypp::target::PatchScriptReport::ABORT;
+}
+
+
+static target::rpm::RemoveResolvableReport::Action
+target2removal_action(Target_Type a)
+{
+#if defined(SWIGPYTHON)
+ const char *s;
+ if (!PyString_Check(a)) {
+ SWIG_exception_fail(SWIG_TypeError, "Expected string type");
+ }
+ s = PyString_AsString(a);
+ if (!strcmp(s, "abort"))
+ return zypp::target::rpm::RemoveResolvableReport::ABORT;
+ else if (!strcmp(s, "retry"))
+ return zypp::target::rpm::RemoveResolvableReport::RETRY;
+ else if (!strcmp(s, "ignore"))
+ return zypp::target::rpm::RemoveResolvableReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected \"abort\", \"retry\" or \"ignore\"");
+#endif
+#if defined(SWIGRUBY)
+ if (a == action_abort())
+ return zypp::target::rpm::RemoveResolvableReport::ABORT;
+ else if (a == action_retry())
+ return zypp::target::rpm::RemoveResolvableReport::RETRY;
+ else if (a == action_ignore())
+ return zypp::target::rpm::RemoveResolvableReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected :abort, :retry or :ignore");
+#endif
+fail:
+ return zypp::target::rpm::RemoveResolvableReport::ABORT;
+}
+
+
+static target::rpm::InstallResolvableReport::Action
+target2install_action(Target_Type a)
+{
+#if defined(SWIGPYTHON)
+ const char *s;
+ if (!PyString_Check(a)) {
+ SWIG_exception_fail(SWIG_TypeError, "Expected string type");
+ }
+ s = PyString_AsString(a);
+ if (!strcmp(s, "abort"))
+ return zypp::target::rpm::InstallResolvableReport::ABORT;
+ else if (!strcmp(s, "retry"))
+ return zypp::target::rpm::InstallResolvableReport::RETRY;
+ else if (!strcmp(s, "ignore"))
+ return zypp::target::rpm::InstallResolvableReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected \"abort\", \"retry\" or \"ignore\"");
+#endif
+#if defined(SWIGRUBY)
+ if (a == action_abort())
+ return zypp::target::rpm::InstallResolvableReport::ABORT;
+ else if (a == action_retry())
+ return zypp::target::rpm::InstallResolvableReport::RETRY;
+ else if (a == action_ignore())
+ return zypp::target::rpm::InstallResolvableReport::IGNORE;
+ SWIG_exception_fail(SWIG_ArgError(SWIG_ValueError), "Expected :abort, :retry or :ignore");
+#endif
+fail:
+ return zypp::target::rpm::InstallResolvableReport::ABORT;
+}
+
+
+/*
+ * target_call
+ *
+ * Generic helper to call a function of the target language
+ *
+ */
+static Target_Type
+target_call(Target_Type instance, const char *name, int argc, ... )
+{
+ va_list ap;
+ va_start(ap, argc);
+#if defined(SWIGPYTHON)
+ /*
+ * Python call with multiple args is like Array
+ */
+ Target_Type argv = PyTuple_New(argc);
+ int i;
+ for (i = 0; i < argc; ++i)
+ {
+ PyObject* arg = va_arg(ap, PyObject*);
+ if (arg == NULL)
+ {
+ arg = Py_None;
+ Py_IncRef(arg);
+ }
+ PyTuple_SET_ITEM(argv, i, arg);
+ }
+
+ PyObject *pyfunc = PyObject_GetAttrString(instance, name);
+ PyObject *result = NULL;
+
+ if (pyfunc == NULL)
+ {
+ PyErr_Print();
+ PyErr_Clear();
+ goto cleanup;
+ }
+ if (! PyCallable_Check(pyfunc))
+ {
+ fprintf(stderr,"%s not callable\n", name);
+ goto cleanup;
+ }
+
+ result = PyObject_CallObject(pyfunc, argv);
+ if (PyErr_Occurred())
+ {
+ fprintf(stderr,"%s returned error\n", name);
+ PyErr_Print();
+ PyErr_Clear();
+ goto cleanup;
+ }
+
+cleanup:
+ if (pyfunc) Py_DecRef(pyfunc);
+ if (argv) Py_DecRef(argv);
+#endif
+#if defined(SWIGRUBY)
+ /*
+ * Ruby call with multiple args is like argc/argv
+ */
+ Target_Type *argv = (Target_Type *)alloca(argc * sizeof(Target_Type));
+ Target_Type *argvp = argv;
+ int i = argc;
+ while(i-- > 0) {
+ *argvp++ = va_arg(ap, Target_Type);
+ }
+ VALUE result = rb_funcall3( instance, rb_intern(name), argc, argv );
+#endif
+#if defined(SWIGPERL)
+ Target_Type result = Target_Null;
+#endif
+ va_end(ap);
+ return result;
+}
+
+
+/*
+ * Patch message
+ *
+ * calls 'show_message(zypp::Patch)'
+ */
+
+struct PatchMessageReportReceiver : public zypp::callback::ReceiveReport<zypp::target::PatchMessageReport>
+{
+
+ Target_Type instance;
+
+ /** Display \c patch->message().
+ * Return \c true to continue, \c false to abort commit.
+ */
+ virtual bool show( zypp::Patch::constPtr & patch )
+ {
+ int result;
+ Target_Type r = SWIG_NewPointerObj((void *)&patch, SWIGTYPE_p_zypp__Patch, 0);
+ Target_Type res = target_call(instance, "patch_message", 1, r );
+#if defined(SWIGPYTHON)
+ result = PyObject_IsTrue(res) ? true : false;
+ if (res) Py_DecRef(res);
+#endif
+#if defined(SWIGRUBY)
+ result = RTEST(res) ? true : false;
+#endif
+ return result;
+ }
+};
+
+
+/*
+ * Patch script
+ *
+ */
+
+struct PatchScriptReportReceiver : public zypp::callback::ReceiveReport<zypp::target::PatchScriptReport>
+{
+
+ Target_Type instance;
+
+ virtual void start( const zypp::Package::constPtr & package,
+ const zypp::Pathname & path_r ) // script path
+ {
+ Target_Type pac = SWIG_NewPointerObj((void *)&(*package), SWIGTYPE_p_zypp__Package, 0);
+ Target_Type path = SWIG_NewPointerObj((void *)&path_r, SWIGTYPE_p_zypp__filesystem__Pathname, 0);
+ Target_Type result = target_call(instance, "patch_script_start", 2, pac, path );
+#if defined(SWIGPYTHON)
+ if (result) Py_DecRef(result);
+ Py_DecRef(path);
+ Py_DecRef(pac);
+#endif
+ return;
+ }
+
+ /**
+ * Progress provides the script output (Notify=OUTPUT). If the script is quiet,
+ * from time to time still-alive pings are sent to the ui. (Notify=PING)
+ * Returning \c FALSE aborts script execution.
+ */
+ virtual bool progress( Notify kind, const std::string &output )
+ {
+ int result;
+ Target_Type str = Target_String(output.c_str());
+ Target_Type k;
+ switch(kind) {
+ case OUTPUT:
+#if defined(SWIGPYTHON)
+ k = Target_String("OUTPUT");
+#endif
+#if defined(SWIGRUBY)
+ k = ID2SYM(rb_intern("OUTPUT"));
+#endif
+ break;
+ case PING:
+#if defined(SWIGPYTHON)
+ k = Target_String("PING");
+#endif
+#if defined(SWIGRUBY)
+ k = ID2SYM(rb_intern("PING"));
+#endif
+ break;
+ }
+ Target_Type res = target_call(instance, "patch_script_progress", 2, k, str );
+#if defined(SWIGPYTHON)
+ result = PyObject_IsTrue(res) ? true : false;
+ if (res) Py_DecRef(res);
+ Py_DecRef(k);
+ Py_DecRef(str);
+#endif
+#if defined(SWIGRUBY)
+ result = RTEST(res) ? true : false;
+#endif
+ return result;
+ }
+
+ /** Report patch script error.
+ */
+ virtual Action problem( const std::string & description )
+ {
+ Action result;
+ Target_Type str = Target_String(description.c_str());
+ Target_Type res = target_call(instance, "patch_script_problem", 1, str );
+ result = target2patch_script_action(res);
+#if defined(SWIGPYTHON)
+ Py_DecRef(str);
+ if (res) Py_DecRef(res);
+#endif
+ return result;
+ }
+
+ /** Patch script finish. */
+ virtual void finish()
+ {
+ Target_Type res = target_call(instance, "patch_script_finish", 0 );
+#if defined(SWIGPYTHON)
+ if (res) Py_DecRef(res);
+#endif
+ return;
+ }
+};
+
+
+/*
+ * Remove
+ *
+ */
+
+struct RemoveResolvableReportReceiver : public zypp::callback::ReceiveReport<zypp::target::rpm::RemoveResolvableReport>
+{
+
+ Target_Type instance;
+
+ virtual void start( Resolvable::constPtr resolvable )
+ {
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type result = target_call(instance, "removal_start", 1, r );
+#if defined(SWIGPYTHON)
+ Py_DecRef(r);
+ if (result) Py_DecRef(result);
+#endif
+ return;
+ }
+
+ /**
+ * Return \c true to continue, \c false to abort commit.
+ */
+ virtual bool progress(int value, zypp::Resolvable::constPtr resolvable)
+ {
+ bool result;
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type v = Target_Int(value);
+ Target_Type res = target_call(instance, "removal_progress", 2, r, v );
+#if defined(SWIGPYTHON)
+ result = PyObject_IsTrue(res) ? true : false;
+ Py_DecRef(v);
+ Py_DecRef(r);
+ if (res) Py_DecRef(res);
+#endif
+#if defined(SWIGRUBY)
+ result = RTEST(res) ? true : false;
+#endif
+ return result;
+ }
+
+ virtual Action problem( zypp::Resolvable::constPtr resolvable, target::rpm::RemoveResolvableReport::Error error, const std::string & description )
+ {
+ Action result;
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type e = remove_error2target(error);
+ Target_Type d = Target_String(description.c_str());
+ Target_Type res = target_call(instance, "removal_problem", 3, r, e, d );
+ result = target2removal_action(res);
+#if defined(SWIGPYTHON)
+ if (res) Py_DecRef(res);
+ Py_DecRef(d);
+ Py_DecRef(e);
+ Py_DecRef(r);
+#endif
+ return result;
+ }
+
+ virtual void finish( zypp::Resolvable::constPtr resolvable, Error error, const std::string & reason )
+ {
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type e = remove_error2target(error);
+ Target_Type d = Target_String(reason.c_str());
+ Target_Type res = target_call(instance, "removal_finish", 3, r, e, d );
+#if defined(SWIGPYTHON)
+ if (res) Py_DecRef(res);
+ Py_DecRef(d);
+ Py_DecRef(e);
+ Py_DecRef(r);
+#endif
+ return;
+ }
+};
+
+
+/*
+ * Install
+ *
+ */
+
+struct InstallResolvableReportReceiver : public zypp::callback::ReceiveReport<zypp::target::rpm::InstallResolvableReport>
+{
+
+ Target_Type instance;
+
+ virtual void start( zypp::Resolvable::constPtr resolvable )
+ {
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type result = target_call(instance, "install_start", 1, r );
+#if defined(SWIGPYTHON)
+ Py_DecRef(r);
+ if (result) Py_DecRef(result);
+#endif
+ return;
+ }
+
+ /**
+ * Return \c true to continue, \c false to abort commit.
+ */
+ virtual bool progress(int value, zypp::Resolvable::constPtr resolvable)
+ {
+ bool result;
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type v = Target_Int(value);
+ Target_Type res = target_call(instance, "install_progress", 2, r, v );
+#if defined(SWIGPYTHON)
+ result = PyObject_IsTrue(res) ? true : false;
+ Py_DecRef(v);
+ Py_DecRef(r);
+ if (res) Py_DecRef(res);
+#endif
+#if defined(SWIGRUBY)
+ result = RTEST(res) ? true : false;
+#endif
+ return result;
+ }
+
+ virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description, RpmLevel level )
+ {
+ Action result;
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type e = install_error2target(error);
+ Target_Type d = Target_String(description.c_str());
+ Target_Type res = target_call(instance, "install_problem", 3, r, e, d );
+ result = target2install_action(res);
+#if defined(SWIGPYTHON)
+ if (res) Py_DecRef(res);
+ Py_DecRef(d);
+ Py_DecRef(e);
+ Py_DecRef(r);
+#endif
+ return result;
+ }
+
+ virtual void finish( zypp::Resolvable::constPtr resolvable, Error error, const std::string & reason, RpmLevel level )
+ {
+ Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
+ Target_Type e = install_error2target(error);
+ Target_Type d = Target_String(reason.c_str());
+ Target_Type res = target_call(instance, "install_finish", 3, r, e, d );
+#if defined(SWIGPYTHON)
+ if (res) Py_DecRef(res);
+ Py_DecRef(d);
+ Py_DecRef(e);
+ Py_DecRef(r);
+#endif
+ return;
+ }
+};
+
+#include "CommitCallbacks.h"
+
+%}
+
+%include "CommitCallbacks.h"
+
diff --git a/swig/CapMatch.i b/swig/CapMatch.i
new file mode 100644
index 0000000..f9f4117
--- /dev/null
+++ b/swig/CapMatch.i
@@ -0,0 +1 @@
+%include <zypp/CapMatch.h>
diff --git a/swig/Capabilities.i b/swig/Capabilities.i
new file mode 100644
index 0000000..88e5c30
--- /dev/null
+++ b/swig/Capabilities.i
@@ -0,0 +1,10 @@
+
+%include <zypp/Capabilities.h>
+
+#ifdef SWIGRUBY
+by_value_iterator(zypp::Capabilities);
+#endif
+
+#ifdef SWIGPERL5
+forwarditer(zypp::Capabilities, zypp::Capability);
+#endif
diff --git a/swig/Capability.i b/swig/Capability.i
new file mode 100644
index 0000000..4d574b5
--- /dev/null
+++ b/swig/Capability.i
@@ -0,0 +1,22 @@
+// Ignore member functions shadowed by static versions
+%ignore zypp::Capability::matches(Capability const &) const;
+%ignore zypp::Capability::matches(IdString const &) const;
+%ignore zypp::Capability::matches(std::string const &) const;
+%ignore zypp::Capability::matches(char const *) const;
+
+%include <zypp/Capability.h>
+
+%extend zypp::Capability
+{
+ int __cmp__(const Capability& other)
+ {
+ // TODO: use CapOrder::operator()?
+ if(self->asString() < other.asString())
+ return -1;
+ if(self->asString() > other.asString())
+ return +1;
+ return 0;
+ }
+}
+
+
diff --git a/swig/CheckSum.i b/swig/CheckSum.i
new file mode 100644
index 0000000..0a0add8
--- /dev/null
+++ b/swig/CheckSum.i
@@ -0,0 +1,2 @@
+%include <zypp/CheckSum.h>
+
diff --git a/swig/CommitCallbacks.h b/swig/CommitCallbacks.h
new file mode 100644
index 0000000..6df36be
--- /dev/null
+++ b/swig/CommitCallbacks.h
@@ -0,0 +1,193 @@
+class CommitCallbacks {
+
+ private:
+ PatchMessageReportReceiver _messageReceiver;
+ PatchScriptReportReceiver _scriptReceiver;
+ RemoveResolvableReportReceiver _removeReceiver;
+ InstallResolvableReportReceiver _installReceiver;
+ Target_Type _instance;
+
+ public:
+ CommitCallbacks()
+ : _instance(Target_Null)
+ {
+ _messageReceiver.connect();
+ _scriptReceiver.connect();
+ _installReceiver.connect();
+ _removeReceiver.connect();
+// printf("CommitCallbacks @ %p\n", this);
+ }
+
+ ~CommitCallbacks()
+ {
+// printf("~CommitCallbacks @ %p\n", this);
+ _removeReceiver.disconnect();
+ _installReceiver.disconnect();
+ _scriptReceiver.disconnect();
+ _messageReceiver.disconnect();
+ disconnect();
+ }
+ /*
+ * Connect callback to receiver instance
+ * Pass NULL receiver to disconnect
+ *
+ */
+ void connect(Target_Type instance) {
+// fprintf(stderr, "connect(%p)\n", instance);
+ disconnect();
+ if (instance) {
+ _instance = instance;
+ Target_INCREF(_instance);
+ _messageReceiver.instance = _instance;
+ _scriptReceiver.instance = _instance;
+ _installReceiver.instance = _instance;
+ _removeReceiver.instance = _instance;
+ }
+ }
+ /*
+ * Disconnect receiver instance
+ *
+ */
+ void disconnect() {
+// fprintf(stderr, "disconnect(%p)\n", _instance);
+ if (_instance != Target_Null) {
+ _messageReceiver.instance = Target_Null;
+ _scriptReceiver.instance = Target_Null;
+ _installReceiver.instance = Target_Null;
+ _removeReceiver.instance = Target_Null;
+ Target_DECREF(_instance);
+ _instance = Target_Null;
+ }
+ }
+ /*
+ * Get current receiver instance
+ *
+ */
+ Target_Type receiver() {
+// fprintf(stderr, "receiver(%p)\n", _instance);
+ return _instance;
+ }
+};
+
+
+/*
+ * A (dummy) commit callback emitter used for testing only
+ *
+ */
+
+class CommitCallbacksEmitter {
+ private:
+ callback::SendReport<target::rpm::InstallResolvableReport> _install_resolvable;
+ callback::SendReport<target::rpm::RemoveResolvableReport> _remove_resolvable;
+ callback::SendReport<target::PatchMessageReport> _patch_message;
+ callback::SendReport<target::PatchScriptReport> _patch_script;
+ public:
+ /*
+ * InstallResolvableReport
+ *
+ */
+ void install_start(zypp::ResObject::constPtr resobj)
+ {
+ _install_resolvable->start( resobj );
+ }
+
+ bool install_progress(zypp::ResObject::constPtr resobj, int value)
+ {
+ return _install_resolvable->progress( value, resobj ); /* arguments reversed :-/ */
+ }
+
+ target::rpm::InstallResolvableReport::Action install_problem(
+ zypp::ResObject::constPtr resobj,
+ target::rpm::InstallResolvableReport::Error error,
+ const std::string & description,
+ target::rpm::InstallResolvableReport::RpmLevel level)
+ {
+ return _install_resolvable->problem( resobj, error, description, level );
+ }
+
+ void install_finish(
+ zypp::ResObject::constPtr resobj,
+ target::rpm::InstallResolvableReport::Error error,
+ const std::string & reason,
+ target::rpm::InstallResolvableReport::RpmLevel level)
+ {
+ return _install_resolvable->finish( resobj, error, reason, level );
+ }
+
+ /*
+ * RemoveResolvableReport
+ *
+ */
+ void remove_start(zypp::ResObject::constPtr resobj)
+ {
+ _remove_resolvable->start( resobj );
+ }
+
+ bool remove_progress(zypp::ResObject::constPtr resobj, int value)
+ {
+ return _remove_resolvable->progress( value, resobj ); /* arguments reversed :-/ */
+ }
+
+ target::rpm::RemoveResolvableReport::Action remove_problem(
+ zypp::ResObject::constPtr resobj,
+ target::rpm::RemoveResolvableReport::Error error,
+ const std::string & description)
+ {
+ return _remove_resolvable->problem( resobj, error, description );
+ }
+
+ void remove_finish(
+ zypp::ResObject::constPtr resobj,
+ target::rpm::RemoveResolvableReport::Error error,
+ const std::string & reason)
+ {
+ return _remove_resolvable->finish( resobj, error, reason );
+ }
+
+ /*
+ * PatchMessageReport
+ *
+ */
+
+ bool patch_message(zypp::Patch::constPtr & patch)
+ {
+ return _patch_message->show(patch);
+ }
+
+ /*
+ * PatchScriptReport
+ *
+ */
+
+ void script_start( const zypp::Package::constPtr & package,
+ const zypp::Pathname & path_r ) // script path
+ {
+ _patch_script->start(package, path_r);
+ }
+
+ /**
+ * Progress provides the script output. If the script is quiet,
+ * from time to time still-alive pings are sent to the ui. (Notify=PING)
+ * Returning \c FALSE aborts script execution.
+ */
+ bool script_progress( target::PatchScriptReport::Notify kind, const std::string &output )
+ {
+ return _patch_script->progress(kind, output);
+ }
+
+ /** Report error. */
+ target::PatchScriptReport::Action script_problem( const std::string & description )
+ {
+ return _patch_script->problem(description);
+ }
+
+ /** Report success. */
+ void finish()
+ {
+ _patch_script->finish();
+ }
+
+};
+
+#define REMOVE_NO_ERROR target::rpm::RemoveResolvableReport::NO_ERROR
+#define INSTALL_NO_ERROR target::rpm::InstallResolvableReport::NO_ERROR
diff --git a/swig/Date.i b/swig/Date.i
new file mode 100644
index 0000000..f436832
--- /dev/null
+++ b/swig/Date.i
@@ -0,0 +1,3 @@
+
+// TODO: tell make about dependencies
+%include <zypp/Date.h>
diff --git a/swig/Dep.i b/swig/Dep.i
new file mode 100644
index 0000000..9fce196
--- /dev/null
+++ b/swig/Dep.i
@@ -0,0 +1,3 @@
+
+%nodefault Dep;
+%include "zypp/Dep.h"
diff --git a/swig/Edition.i b/swig/Edition.i
new file mode 100644
index 0000000..db08090
--- /dev/null
+++ b/swig/Edition.i
@@ -0,0 +1,18 @@
+// Ignore member functions shadowed by static versions
+// ma@: maybe one should ignore the statics and keep the members?
+%ignore zypp::Edition::match(Edition const &) const;
+%ignore zypp::Edition::match(IdString const &) const;
+%ignore zypp::Edition::match(std::string const &) const;
+%ignore zypp::Edition::match(char const *) const;
+
+// ma@: Why do we need this?
+//namespace zypp
+//{
+// %rename Edition::compare(const Edition& lhs, const Edition& rhs) compare2;
+// %rename Edition::match(const Edition& lhs, const Edition& rhs) match2;
+//}
+
+//%ignore zypp::Edition::compare(const Edition &, const Edition &);
+
+%template(IdStringEdition) zypp::IdStringType<zypp::Edition>;
+%include <zypp/Edition.h>
diff --git a/swig/IdStringType.i b/swig/IdStringType.i
new file mode 100644
index 0000000..ef67a56
--- /dev/null
+++ b/swig/IdStringType.i
@@ -0,0 +1,2 @@
+%include <zypp/IdString.h>
+%include <zypp/IdStringType.h>
diff --git a/swig/KeyRing.i b/swig/KeyRing.i
new file mode 100644
index 0000000..dd938fc
--- /dev/null
+++ b/swig/KeyRing.i
@@ -0,0 +1,27 @@
+
+%ignore zypp::KeyRingReport;
+%ignore zypp::KeyRingSignals;
+
+%rename(dontuse_setDefaultAccept) zypp::KeyRing::setDefaultAccept;
+%rename(setDefaultAccept) zypp::KeyRing::setDefaultAcceptBits;
+
+%rename(dontuse_defaultAccept) zypp::KeyRing::defaultAccept;
+%rename(defaultAccept) zypp::KeyRing::defaultAcceptBits;
+
+%include <zypp/KeyRing.h>
+%extend zypp::KeyRing
+{
+ static void setDefaultAcceptBits( unsigned i ) {
+ zypp::KeyRing::setDefaultAccept( zypp::KeyRing::DefaultAccept(i) );
+ }
+ static unsigned defaultAcceptBits() {
+ return zypp::KeyRing::defaultAccept();
+ }
+}
+namespace zypp
+{
+ typedef intrusive_ptr<KeyRing> KeyRing_Ptr;
+ %template(KeyRing_Ptr) intrusive_ptr<KeyRing>;
+}
+
+%template(List_PublicKey) std::list<zypp::PublicKey>;
diff --git a/swig/Kind.i b/swig/Kind.i
new file mode 100644
index 0000000..7f71dfc
--- /dev/null
+++ b/swig/Kind.i
@@ -0,0 +1,5 @@
+
+%ignore zypp::ResKind::satIdent( const std::string & name_r ) const;
+
+%template(IdStringResKind) zypp::IdStringType<zypp::ResKind>;
+%include <zypp/ResKind.h>
diff --git a/swig/MediaSetAccess.i b/swig/MediaSetAccess.i
new file mode 100644
index 0000000..5775d28
--- /dev/null
+++ b/swig/MediaSetAccess.i
@@ -0,0 +1,3 @@
+
+%include <zypp/MediaSetAccess.h>
+
diff --git a/swig/NeedAType.i b/swig/NeedAType.i
new file mode 100644
index 0000000..23192ce
--- /dev/null
+++ b/swig/NeedAType.i
@@ -0,0 +1,7 @@
+
+typedef std::string Label;
+
+typedef std::string Text;
+
+typedef std::string Vendor;
+
diff --git a/swig/OnMediaLocation.i b/swig/OnMediaLocation.i
new file mode 100644
index 0000000..d2b633f
--- /dev/null
+++ b/swig/OnMediaLocation.i
@@ -0,0 +1,2 @@
+
+%include <zypp/OnMediaLocation.h> \ No newline at end of file
diff --git a/swig/Package.i b/swig/Package.i
new file mode 100644
index 0000000..734c59d
--- /dev/null
+++ b/swig/Package.i
@@ -0,0 +1,4 @@
+//%ignore zypp::Package::checksum();
+
+%include <zypp/Package.h>
+
diff --git a/swig/Patch.i b/swig/Patch.i
new file mode 100644
index 0000000..acd62b4
--- /dev/null
+++ b/swig/Patch.i
@@ -0,0 +1,5 @@
+%ignore zypp::Patch::reboot_needed;
+%ignore zypp::Patch::affects_pkg_manager;
+%ignore zypp::Patch::id;
+
+%include <zypp/Patch.h> \ No newline at end of file
diff --git a/swig/Pathname.i b/swig/Pathname.i
new file mode 100644
index 0000000..6b7305b
--- /dev/null
+++ b/swig/Pathname.i
@@ -0,0 +1,12 @@
+// Ignore static versions shadowed by member functions
+%ignore zypp::filesystem::Pathname::dirname(Pathname const &);
+%ignore zypp::filesystem::Pathname::basename(Pathname const &);
+%ignore zypp::filesystem::Pathname::extension(Pathname const &);
+%ignore zypp::filesystem::Pathname::absolutename(Pathname const &);
+%ignore zypp::filesystem::Pathname::relativename(Pathname const &);
+%ignore zypp::filesystem::Pathname::cat(Pathname const &,Pathname const &);
+%ignore zypp::filesystem::Pathname::extend(Pathname const &,std::string const &);
+
+%ignore zypp::filesystem::operator<( const Pathname & l, const Pathname & r );
+
+%include <zypp/Pathname.h>
diff --git a/swig/Pattern.i b/swig/Pattern.i
new file mode 100644
index 0000000..3d88887
--- /dev/null
+++ b/swig/Pattern.i
@@ -0,0 +1 @@
+%include <zypp/Pattern.h> \ No newline at end of file
diff --git a/swig/PoolItem.i b/swig/PoolItem.i
new file mode 100644
index 0000000..34a2eeb
--- /dev/null
+++ b/swig/PoolItem.i
@@ -0,0 +1,23 @@
+%include <zypp/PoolItem.h>
+
+#ifdef SWIGPERL5
+#else
+%template(PoolItemSet) std::set<zypp::PoolItem>;
+#endif
+
+%extend zypp::PoolItem
+{
+#ifdef SWIGPYTHON
+%rename ("__str__") string();
+#endif
+#ifdef SWIGRUBY
+%rename ("to_s") string();
+#endif
+
+ std::string string() const
+ {
+ std::ostringstream str;
+ str << *self;
+ return str.str();
+ }
+}
diff --git a/swig/Product.i b/swig/Product.i
new file mode 100644
index 0000000..4b8ce3f
--- /dev/null
+++ b/swig/Product.i
@@ -0,0 +1,2 @@
+%ignore zypp::Product::type;
+%include <zypp/Product.h>
diff --git a/swig/PublicKey.i b/swig/PublicKey.i
new file mode 100644
index 0000000..3f4341f
--- /dev/null
+++ b/swig/PublicKey.i
@@ -0,0 +1 @@
+%include <zypp/PublicKey.h> \ No newline at end of file
diff --git a/swig/RepoInfo.i b/swig/RepoInfo.i
new file mode 100644
index 0000000..f86a254
--- /dev/null
+++ b/swig/RepoInfo.i
@@ -0,0 +1,56 @@
+#ifdef SWIGPERL5
+#else
+%template(UrlSet) std::set<zypp::Url>;
+#endif
+
+namespace zypp
+{
+ namespace repo
+ {
+ %ignore operator==;
+ %ignore operator!=;
+ %ignore operator<<;
+ %ignore operator<;
+ }
+ typedef std::list<Url> UrlSet;
+}
+
+%ignore zypp::repo::RepoInfoBase::dumpOn(std::ostream &) const;
+%ignore zypp::repo::RepoInfoBase::dumpAsIniOn(std::ostream &) const;
+%ignore zypp::repo::RepoInfoBase::dumpAsXMLOn(std::ostream &) const;
+%include <zypp/repo/RepoInfoBase.h>
+
+// This is due to a typo in libzypp < 5.4.0
+%ignore zypp::RepoInfo::defaultPrioity();
+
+%ignore zypp::RepoInfo::dumpOn(std::ostream &) const;
+%ignore zypp::RepoInfo::dumpAsIniOn(std::ostream &) const;
+%ignore zypp::RepoInfo::dumpAsXMLOn(std::ostream &) const;
+
+%include <zypp/RepoInfo.h>
+typedef std::list<zypp::RepoInfo> RepoInfoList;
+%template(RepoInfoList) std::list<zypp::RepoInfo>;
+
+%extend zypp::RepoInfo
+{
+ std::string dump(void) const
+ {
+ std::ostringstream str;
+ self->dumpOn(str);
+ return str.str();
+ }
+
+ std::string dumpAsIni(void) const
+ {
+ std::ostringstream str;
+ self->dumpAsIniOn(str);
+ return str.str();
+ }
+
+ std::string dumpAsXML(void) const
+ {
+ std::ostringstream str;
+ self->dumpAsXMLOn(str);
+ return str.str();
+ }
+}
diff --git a/swig/RepoManager.i b/swig/RepoManager.i
new file mode 100644
index 0000000..8f7870d
--- /dev/null
+++ b/swig/RepoManager.i
@@ -0,0 +1 @@
+%include <zypp/RepoManager.h>
diff --git a/swig/RepoStatus.i b/swig/RepoStatus.i
new file mode 100644
index 0000000..8f89dae
--- /dev/null
+++ b/swig/RepoStatus.i
@@ -0,0 +1 @@
+%include <zypp/RepoStatus.h> \ No newline at end of file
diff --git a/swig/RepoType.i b/swig/RepoType.i
new file mode 100644
index 0000000..d9f1164
--- /dev/null
+++ b/swig/RepoType.i
@@ -0,0 +1 @@
+%include <zypp/repo/RepoType.h> \ No newline at end of file
diff --git a/swig/Repository.i b/swig/Repository.i
new file mode 100644
index 0000000..e7a2ecb
--- /dev/null
+++ b/swig/Repository.i
@@ -0,0 +1,3 @@
+%ignore zypp::Repository::name;
+
+%include <zypp/Repository.h>
diff --git a/swig/ResObject.i b/swig/ResObject.i
new file mode 100644
index 0000000..d25b6ef
--- /dev/null
+++ b/swig/ResObject.i
@@ -0,0 +1,13 @@
+%ignore zypp::make_res_object;
+%ignore zypp::ResObject::installsize;
+%ignore zypp::ResObject::size;
+
+%include <zypp/ResObject.h>
+
+%extend intrusive_ptr<const ResObject>
+{
+ int __cmp__(intrusive_ptr<const ResObject>& other)
+ {
+ return *self == other;
+ }
+}
diff --git a/swig/ResPool.i b/swig/ResPool.i
new file mode 100644
index 0000000..c57f57c
--- /dev/null
+++ b/swig/ResPool.i
@@ -0,0 +1,92 @@
+// missing resfilter:: to call these
+%ignore zypp::ResPool::byKindBegin;
+%ignore zypp::ResPool::byKindEnd;
+%ignore zypp::ResPool::byNameBegin;
+%ignore zypp::ResPool::byNameEnd;
+%apply unsigned { zypp::ResPool::size_type };
+%include <zypp/ResPool.h>
+
+%ignore zypp::pool::operator<<;
+%include <zypp/pool/GetResolvablesToInsDel.h>
+namespace zypp
+{
+ typedef ::std::list<zyppPoolItem> PoolItemList;
+ %template(PoolItemList) ::std::list<PoolItem>;
+}
+
+namespace zypp
+{
+
+#ifdef SWIGPERL5
+
+iter2(ResPool, PoolItem);
+
+#endif
+
+#ifdef SWIGRUBY
+
+iter3(ResPool, PoolItem*);
+
+// %extend ResPool {
+// void each()
+// {
+// ResPool::const_iterator i = self->begin();
+// while ( i != self->end() ) {
+// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0));
+// ++i;
+// }
+// }
+// }
+
+%extend ResPool {
+ void each_by_kind( const ResObject::Kind & kind_r )
+ {
+ ResPool::byKind_iterator i = self->byKindBegin( kind_r );
+ while ( i != self->byKindEnd( kind_r ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0));
+ ++i;
+ }
+ }
+}
+
+%extend ResPool {
+ void each_by_name( const std::string &name )
+ {
+ ResPool::byName_iterator i = self->byNameBegin( name );
+ while ( i != self->byNameEnd( name ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem), 0));
+ ++i;
+ }
+ }
+}
+
+#endif
+
+#ifdef SWIGPYTHON
+%newobject ResPool::const_iterator(PyObject **PYTHON_SELF);
+%extend ResPool {
+ swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF)
+ {
+ return swig::make_output_iterator(self->begin(), self->begin(),
+ self->end(), *PYTHON_SELF);
+ }
+ swig::SwigPyIterator* kinditerator(PyObject **PYTHON_SELF, const ResObject::Kind & kind_r)
+ {
+ return swig::make_output_iterator(self->byKindBegin( kind_r ), self->byKindBegin( kind_r ),
+ self->byKindEnd( kind_r ), *PYTHON_SELF);
+ }
+ swig::SwigPyIterator* nameiterator(PyObject **PYTHON_SELF, const std::string &name)
+ {
+ return swig::make_output_iterator(self->byNameBegin( name ), self->byNameBegin( name ),
+ self->byNameEnd( name ), *PYTHON_SELF);
+ }
+%pythoncode {
+ def __iter__(self): return self.iterator()
+ def byKindIterator(self, kind): return self.kinditerator(kind)
+ def byNameIterator(self, name): return self.nameiterator(name)
+}
+}
+
+#endif
+
+}
diff --git a/swig/ResStatus.i b/swig/ResStatus.i
new file mode 100644
index 0000000..e91df8c
--- /dev/null
+++ b/swig/ResStatus.i
@@ -0,0 +1,28 @@
+
+%include <zypp/ResStatus.h>
+
+#ifdef SWIGPERL5
+
+ %extend ResStatus {
+
+ bool setToBeInstalledUser()
+ {
+ return self->setToBeInstalled(ResStatus::USER);
+ }
+
+ bool resetTransactUser()
+ {
+ return self->resetTransact(ResStatus::USER);
+ }
+ };
+#endif
+
+%extend zypp::ResStatus
+{
+ std::string asString() const
+ {
+ std::ostringstream str;
+ str << *self;
+ return str.str();
+ }
+}
diff --git a/swig/ResTraits.i b/swig/ResTraits.i
new file mode 100644
index 0000000..664113d
--- /dev/null
+++ b/swig/ResTraits.i
@@ -0,0 +1,77 @@
+
+/** Base of ResTraits. Defines the Resolvable::Kind type. */
+/*struct ResolvableTraits
+{
+ typedef KindOf<Resolvable> KindType;
+};*/
+
+namespace zypp
+{
+ /** ResTraits. Defines common types and the Kind value. */
+ template<typename _Res>
+ struct ResTraits
+ {
+ typedef zypp::intrusive_ptr<_Res> PtrType;
+ typedef zypp::intrusive_ptr<const _Res> constPtrType;
+ };
+
+ typedef intrusive_ptr<const ResObject> ResObject_constPtr;
+ typedef intrusive_ptr<ResObject> ResObject_Ptr;
+ %template(ResObject_constPtr) intrusive_ptr<const zypp::ResObject>;
+ %template(ResObject_Ptr) intrusive_ptr<zypp::ResObject>;
+
+}
+
+%template(ResTraitsResolvable) zypp::ResTraits<zypp::Resolvable>;
+%template(ResTraitsResObject) zypp::ResTraits<zypp::ResObject>;
+
+// Common definitions for all Resolvable types
+// - *_Ptr and *_constPtr
+// - isKind* to test whether a ResObject/PoolItem is
+// of a specific kind.
+// - asKind* to convert a ResObject/PoolItem into a
+// specific *_constPtr.
+%define %STUFF(X)
+namespace zypp
+{
+ typedef intrusive_ptr<const X> X##_constPtr;
+ typedef intrusive_ptr<X> X##_Ptr;
+ %template(X##_constPtr) intrusive_ptr<const X>;
+ %template(X##_Ptr) intrusive_ptr<X>;
+
+ bool isKind##X( const zypp::Resolvable::constPtr & p );
+ bool isKind##X( const zypp::PoolItem & p );
+
+ X##_constPtr asKind##X( const zypp::Resolvable::constPtr & p );
+ X##_constPtr asKind##X( const zypp::PoolItem & p );
+}
+
+%header
+{
+ namespace zypp
+ {
+ inline bool isKind##X( const zypp::Resolvable::constPtr & p )
+ { return isKind<X>( p ); }
+ inline bool isKind##X( const zypp::PoolItem & p )
+ { return isKind<X>( p.resolvable() ); }
+ inline X::constPtr asKind##X( const zypp::Resolvable::constPtr & p )
+ { return asKind<X>( p ); }
+ inline X::constPtr asKind##X( const zypp::PoolItem & p )
+ { return asKind<X>( p.resolvable() ); }
+ }
+}
+
+#if defined(SWIGPYTHON)
+%pythoncode
+{
+ def KindOf##X():
+ return KindOfResolvable( #X )
+}
+#endif
+%enddef
+
+%STUFF(Package)
+%STUFF(Patch)
+%STUFF(SrcPackage)
+%STUFF(Pattern)
+%STUFF(Product)
diff --git a/swig/Resolvable.i b/swig/Resolvable.i
new file mode 100644
index 0000000..7055b9f
--- /dev/null
+++ b/swig/Resolvable.i
@@ -0,0 +1,4 @@
+%ignore zypp::make;
+%import <zypp/sat/Solvable.h>
+%include <zypp/Resolvable.h>
+
diff --git a/swig/Resolver.i b/swig/Resolver.i
new file mode 100644
index 0000000..2d1f402
--- /dev/null
+++ b/swig/Resolver.i
@@ -0,0 +1,27 @@
+#ifdef SWIGPERL5
+ %template(StringList) std::list<std::string>;
+#endif
+
+%include <zypp/ProblemTypes.h>
+%include <zypp/ResolverProblem.h>
+%include <zypp/ProblemSolution.h>
+%include <zypp/Resolver.h>
+
+namespace zypp
+{
+ typedef intrusive_ptr< Resolver > Resolver_Ptr;
+ %template(Resolver_Ptr) intrusive_ptr<Resolver>;
+
+#ifndef SWIGRUBY
+ /* swig generates wrong code (>> instead of > > for template type)
+ * in Ruby
+ */
+
+ typedef ::boost::intrusive_ptr< ResolverProblem > ResolverProblem_Ptr;
+ %template(ResolverProblem_Ptr) ::boost::intrusive_ptr< ResolverProblem >;
+ typedef std::list< ResolverProblem_Ptr > ResolverProblemList;
+ %template(ResolverProblemList) ::std::list< ResolverProblem_Ptr >;
+
+#endif
+}
+
diff --git a/swig/ServiceInfo.i b/swig/ServiceInfo.i
new file mode 100644
index 0000000..fb9004f
--- /dev/null
+++ b/swig/ServiceInfo.i
@@ -0,0 +1 @@
+%include <zypp/ServiceInfo.h>
diff --git a/swig/SrcPackage.i b/swig/SrcPackage.i
new file mode 100644
index 0000000..b239fe6
--- /dev/null
+++ b/swig/SrcPackage.i
@@ -0,0 +1 @@
+%include <zypp/SrcPackage.h>;
diff --git a/swig/Target.i b/swig/Target.i
new file mode 100644
index 0000000..0c81a33
--- /dev/null
+++ b/swig/Target.i
@@ -0,0 +1,23 @@
+%ignore zypp::Target::reset;
+#if ZYPP_VERSION > 631
+namespace zypp
+{
+ // Redefine nested class in global scope for SWIG
+ struct DistributionLabel {};
+}
+#endif
+%include <zypp/Target.h>
+namespace zypp
+{
+typedef intrusive_ptr<Target> Target_Ptr;
+%template(Target_Ptr) intrusive_ptr<Target>;
+}
+#if ZYPP_VERSION > 631
+%{
+ namespace zypp
+ {
+ // Tell c++ compiler about SWIGs global class
+ typedef Target::DistributionLabel DistributionLabel;
+ }
+%}
+#endif \ No newline at end of file
diff --git a/swig/TmpPath.i b/swig/TmpPath.i
new file mode 100644
index 0000000..d8b2ea8
--- /dev/null
+++ b/swig/TmpPath.i
@@ -0,0 +1,4 @@
+
+// TODO: tell make about dependencies
+%include <zypp/TmpPath.h>
+
diff --git a/swig/Url.i b/swig/Url.i
new file mode 100644
index 0000000..e3a65b3
--- /dev/null
+++ b/swig/Url.i
@@ -0,0 +1 @@
+%include <zypp/Url.h>
diff --git a/swig/ZConfig.i b/swig/ZConfig.i
new file mode 100644
index 0000000..d4b6c08
--- /dev/null
+++ b/swig/ZConfig.i
@@ -0,0 +1,2 @@
+%include <zypp/ZConfig.h>
+
diff --git a/swig/ZYppCommitPolicy.i b/swig/ZYppCommitPolicy.i
new file mode 100644
index 0000000..b0bce36
--- /dev/null
+++ b/swig/ZYppCommitPolicy.i
@@ -0,0 +1,10 @@
+#if ZYPP_VERSION > 615
+#ifdef SWIGRUBY
+%rename("dryRun=") ZYppCommitPolicy::dryRun(bool);
+%rename("rpmNoSignature=") ZYppCommitPolicy::rpmNoSignature(bool);
+%rename("syncPoolAfterCommit=") ZYppCommitPolicy::syncPoolAfterCommit(bool);
+#endif
+
+%include <zypp/DownloadMode.h>
+%include <zypp/ZYppCommitPolicy.h>
+#endif \ No newline at end of file
diff --git a/swig/ZYppCommitResult.i b/swig/ZYppCommitResult.i
new file mode 100644
index 0000000..ef5cae4
--- /dev/null
+++ b/swig/ZYppCommitResult.i
@@ -0,0 +1,11 @@
+%include <zypp/ZYppCommitResult.h>
+
+%extend zypp::ZYppCommitResult
+{
+ std::string asString() const
+ {
+ std::ostringstream str;
+ str << *self;
+ return str.str();
+ }
+}
diff --git a/swig/ZYppFactory.i b/swig/ZYppFactory.i
new file mode 100644
index 0000000..1c1d676
--- /dev/null
+++ b/swig/ZYppFactory.i
@@ -0,0 +1,9 @@
+
+%include <zypp/ZYppFactory.h>
+
+namespace zypp
+{
+typedef intrusive_ptr<ZYpp> ZYpp_Ptr;
+%template(ZYpp_Ptr) intrusive_ptr<ZYpp>;
+}
+
diff --git a/swig/perl5/CMakeLists.txt b/swig/perl5/CMakeLists.txt
new file mode 100644
index 0000000..df226a4
--- /dev/null
+++ b/swig/perl5/CMakeLists.txt
@@ -0,0 +1,57 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig/perl5
+#
+# !!Attn!!: This creates two files
+# 1. zypp.so
+# 2. zypp.pm
+# and the .pm file gets loaded.
+#
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(tests)
+
+# SWIG_OUPUT is per-target
+SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libzypp_perl.cc" )
+
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{cppflags}" OUTPUT_VARIABLE PERL_CXXFLAGS)
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{archlib}.\"/CORE\"" OUTPUT_VARIABLE PERL_CORE_DIR)
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorarch}" OUTPUT_VARIABLE PERL_VENDOR_ARCH)
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorlib}" OUTPUT_VARIABLE PERL_VENDOR_LIB)
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{ccdlflags}" OUTPUT_VARIABLE PERL_LINK_FLAGS)
+
+MESSAGE(STATUS "Perl executable: ${PERL_EXECUTABLE}")
+MESSAGE(STATUS "Perl core dir: ${PERL_CORE_DIR}")
+MESSAGE(STATUS "Perl vendor arch dir: ${PERL_VENDORDIR}")
+
+ADD_DEFINITIONS( ${PERL_CXXFLAGS} -Wno-unused -Wno-error )
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PERL_CXXFLAGS}")
+
+LINK_DIRECTORIES( ${PERL_CORE_DIR} )
+
+if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+endif(COMMAND cmake_policy)
+
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${SWIG_OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for perl..."
+ COMMAND ${SWIG_EXECUTABLE} ${SWIG_DEFINITIONS} -c++ -perl5 -o ${SWIG_OUTPUT} -I${ZYPP_INCLUDE_DIR} ${SWIG_INPUT}
+ COMMAND ${CMAKE_COMMAND} -E echo "Done."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/../*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+)
+
+ADD_LIBRARY( zypp_perl SHARED ${SWIG_OUTPUT} )
+SET_TARGET_PROPERTIES( zypp_perl
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME zypp
+)
+
+INCLUDE_DIRECTORIES( ${PERL_CORE_DIR} )
+INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/swig )
+INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+TARGET_LINK_LIBRARIES( zypp_perl ${ZYPP_LIBRARY} )
+
+INSTALL(TARGETS zypp_perl LIBRARY DESTINATION ${PERL_VENDOR_ARCH})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zypp.pm DESTINATION ${PERL_VENDOR_LIB})
diff --git a/swig/perl5/perl.i b/swig/perl5/perl.i
new file mode 100644
index 0000000..8c60f30
--- /dev/null
+++ b/swig/perl5/perl.i
@@ -0,0 +1,91 @@
+
+%ignore zypp::Arch_empty;
+
+namespace zypp
+{
+ // These operators must be ignored otherwise the wrapper does
+ // not compile (using swig 1.3.29).
+ %ignore operator<<;
+ %ignore operator==;
+ %ignore operator!=;
+
+ namespace filesystem
+ {
+ // Same as above.
+ %ignore operator==;
+ %ignore operator!=;
+ %ignore operator<<;
+ }
+}
+
+%define iter(cls, storetype)
+%extend cls {
+ cls::const_iterator iterator_incr(cls::const_iterator *it){
+ (*it)++;
+ return *it;
+ }
+ cls::const_iterator iterator_decr(cls::const_iterator *it){
+ (*it)--;
+ return *it;
+ }
+ bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+ return (it1 == it2);
+ }
+ storetype iterator_value(cls::const_iterator it) {
+ return (&**it);
+ }
+ cls::const_iterator cBegin() {
+ return self->begin();
+ }
+ cls::const_iterator cEnd() {
+ return self->end();
+ }
+};
+%enddef
+
+%define iter2(cls, storetype)
+%extend cls {
+ cls::const_iterator iterator_incr(cls::const_iterator *it){
+ ++(*it);
+ return *it;
+ }
+ cls::const_iterator iterator_decr(cls::const_iterator *it){
+ --(*it);
+ return *it;
+ }
+ bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+ return (it1 == it2);
+ }
+ storetype iterator_value(cls::const_iterator it) {
+ return (*it);
+ }
+ cls::const_iterator cBegin() {
+ return self->begin();
+ }
+ cls::const_iterator cEnd() {
+ return self->end();
+ }
+};
+%enddef
+
+// no operator--
+%define forwarditer(cls, storetype)
+%extend cls {
+ cls::const_iterator iterator_incr(cls::const_iterator *it){
+ ++(*it);
+ return *it;
+ }
+ bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+ return (it1 == it2);
+ }
+ storetype iterator_value(cls::const_iterator it) {
+ return (*it);
+ }
+ cls::const_iterator cBegin() {
+ return self->begin();
+ }
+ cls::const_iterator cEnd() {
+ return self->end();
+ }
+};
+%enddef
diff --git a/swig/perl5/tests/CMakeLists.txt b/swig/perl5/tests/CMakeLists.txt
new file mode 100644
index 0000000..af6e7a7
--- /dev/null
+++ b/swig/perl5/tests/CMakeLists.txt
@@ -0,0 +1,8 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig/perl5/tests
+#
+
+ENABLE_TESTING()
+
+ADD_TEST(bindings_perl_loading perl ${CMAKE_CURRENT_SOURCE_DIR}/loading.pl)
+ADD_TEST(bindings_perl_starting perl ${CMAKE_CURRENT_SOURCE_DIR}/starting.pl)
diff --git a/swig/perl5/tests/loading.pl b/swig/perl5/tests/loading.pl
new file mode 100644
index 0000000..0f45c2d
--- /dev/null
+++ b/swig/perl5/tests/loading.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+
+use FindBin qw($Bin);
+use lib "$Bin/../../../build/swig/perl5";
+
+use zypp;
+
diff --git a/swig/perl5/tests/starting.pl b/swig/perl5/tests/starting.pl
new file mode 100644
index 0000000..09d3954
--- /dev/null
+++ b/swig/perl5/tests/starting.pl
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+use FindBin qw($Bin);
+use lib "$Bin/../../../build/swig/perl5";
+
+use zypp;
+
+$zfactory = zyppc::ZYppFactory_instance();
+$zypp = $zfactory->getZYpp;
diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt
new file mode 100644
index 0000000..284bcb0
--- /dev/null
+++ b/swig/python/CMakeLists.txt
@@ -0,0 +1,48 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig/python
+#
+# !!Attn!!: This creates two files
+# 1. zypp.so
+# 2. zypp.py
+# and the .py file gets imported.
+#
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(tests)
+
+# SWIG_OUPUT is per-target
+
+SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libzypp_python.cc" )
+
+FIND_PACKAGE(PythonInterp REQUIRED)
+IF (NOT PYTHON_SITEDIR)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(1))" OUTPUT_VARIABLE PYTHON_SITEDIR)
+ENDIF (NOT PYTHON_SITEDIR)
+
+MESSAGE(STATUS "Python executable: ${PYTHON_EXECUTABLE}")
+MESSAGE(STATUS "Python include path: ${PYTHON_INCLUDE_PATH}")
+MESSAGE(STATUS "Python site dir: ${PYTHON_SITEDIR}")
+
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${SWIG_OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for python..."
+ COMMAND ${SWIG_EXECUTABLE} -v ${SWIG_DEFINITIONS} -c++ -python -o ${SWIG_OUTPUT} -I${ZYPP_INCLUDE_DIR} ${SWIG_INPUT}
+ COMMAND ${CMAKE_COMMAND} -E echo "Done."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/../*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+)
+
+ADD_LIBRARY( zypp_python SHARED ${SWIG_OUTPUT} )
+SET_TARGET_PROPERTIES( zypp_python
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME _zypp
+)
+
+INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )
+INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/swig )
+INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+TARGET_LINK_LIBRARIES( zypp_python ${ZYPP_LIBRARY} )
+
+INSTALL(TARGETS zypp_python LIBRARY DESTINATION ${PYTHON_SITEDIR})
+INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/zypp.py DESTINATION ${PYTHON_SITEDIR})
diff --git a/swig/python/python.i b/swig/python/python.i
new file mode 100644
index 0000000..139cc2d
--- /dev/null
+++ b/swig/python/python.i
@@ -0,0 +1,55 @@
+
+
+%rename *::asString "__str__";
+
+%ignore zypp::Arch_empty;
+
+namespace zypp
+{
+ // These operators must be ignored otherwise the wrapper does
+ // not compile (using swig 1.3.29).
+ %ignore operator==;
+ %ignore operator!=;
+
+ // Just to avoid warnings.
+ %ignore operator<<;
+ namespace repo
+ {
+ // These operators must be ignored otherwise the wrapper does
+ // not compile (using swig 1.3.29).
+ %ignore operator==;
+ %ignore operator!=;
+
+ // Just to avoid warnings.
+ %ignore operator<<;
+ }
+
+}
+
+
+
+%define iter( cls )
+%extend cls {
+ %pythoncode %{
+ def __iter__(self):
+ r = self.range()
+ while not r.empty():
+ yield r.head()
+ r.removeFirst()
+ %}
+};
+%enddef
+
+
+%exception
+{
+ try {
+ $action
+ }
+ catch (const Exception& e) {
+ std::string tmp = e.historyAsString() + e.asUserString();
+ PyErr_SetString(PyExc_RuntimeError, const_cast<char*>(tmp.c_str()));
+ return NULL;
+ }
+}
+
diff --git a/swig/python/tests/CMakeLists.txt b/swig/python/tests/CMakeLists.txt
new file mode 100644
index 0000000..932da25
--- /dev/null
+++ b/swig/python/tests/CMakeLists.txt
@@ -0,0 +1,11 @@
+##
+# CMakeLists.txt for libzypp-bindings/swig/python/tests
+#
+
+ENABLE_TESTING()
+
+ADD_TEST(bindings_python_loading python ${CMAKE_CURRENT_SOURCE_DIR}/loading.py)
+ADD_TEST(bindings_python_repoinfo python ${CMAKE_CURRENT_SOURCE_DIR}/repoinfo.py)
+ADD_TEST(bindings_python_commit_callbacks python ${CMAKE_CURRENT_SOURCE_DIR}/commit_callbacks.py)
+ADD_TEST(bindings_python_problems python ${CMAKE_CURRENT_SOURCE_DIR}/problems.py)
+# ADD_TEST(bindings_python_installed_path python ${CMAKE_CURRENT_SOURCE_DIR}/installed_path.py)
diff --git a/swig/python/tests/arch.py b/swig/python/tests/arch.py
new file mode 100644
index 0000000..524d217
--- /dev/null
+++ b/swig/python/tests/arch.py
@@ -0,0 +1,46 @@
+#
+# Arch
+#
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+from zypp import Arch
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def testarch(self):
+ a = Arch("i386")
+ assert a
+ assert "i386" == a.__str__()
+ assert a.is_builtin()
+
+ b = Arch("i486")
+ assert b
+ assert "i486" == b.__str__()
+ assert b.is_builtin()
+ assert a == b.base_arch()
+ assert a < b
+ assert a.compatible_with(b)
+
+ z = Arch("xyzzy")
+ assert z
+ assert "xyzzy" == z.__str__()
+ assert not z.is_builtin()
+
+ assert Arch("noarch") == Arch.noarch()
+ assert a, Arch.i386()
+ assert b, Arch.i486()
+ assert Arch("i586") == Arch.i586()
+ assert Arch("i686") == Arch.i686()
+ assert Arch("x86_64") == Arch.x86_64()
+ assert Arch("ia64") == Arch.ia64()
+ assert Arch("ppc") == Arch.ppc()
+ assert Arch("ppc64") == Arch.ppc64()
+ assert Arch("s390") == Arch.s390()
+ assert Arch("s390x") == Arch.s390x()
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/python/tests/commit_callbacks.py b/swig/python/tests/commit_callbacks.py
new file mode 100644
index 0000000..24a1ff3
--- /dev/null
+++ b/swig/python/tests/commit_callbacks.py
@@ -0,0 +1,273 @@
+#
+# Test commit callbacks
+#
+#
+# Callbacks are implemented by calling a specific object function
+#
+# You need
+# - define a (receiver) class which include the function(s) you're interested in.
+# - create an object instance of this class
+# - tell Zypp where to send the callbacks
+#
+# There can only be one receiver instance be active at any time.
+# So if you want to receive different callbacks, define the appropriate
+# functions in the one receiver class
+#
+#
+# See below for sample code
+#
+#
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+import zypp
+
+#
+# This is counting the number of times our callback was called
+# (its just for testing purposes to assert() that the callback was
+# actually run)
+#
+removals = 0
+installs = 0
+
+
+#
+# This is the receiver class.
+# The _class name_ does not matter, but the _function name_ does
+#
+# TODO: provide a complete list of function names and parameters
+#
+# I. Patch message
+# patch_message(zypp::Patch) - show patch message
+#
+# II. Patch script
+# patch_script_start(zypp::Package, String)
+# patch_script_progress(zypp::Notify, String)
+# patch_script_problem(String)
+# patch_script_finish()
+#
+# III. Removal
+# removal_start(zypp::Resolvable) - start of resolvable uninstall
+# removal_progress(zypp::Resolvable, Integer) - progress in percent
+# removal_problem(zypp::Resolvable, zypp::Error, String) - problem report
+# removal_finish(zypp::Resolvable, zypp::Error, String) - uninstall finish
+#
+# IV. Install
+# install_start(zypp::Resolvable) - start of resolvable uninstall
+# install_progress(zypp::Resolvable, Integer) - progress in percent
+# install_problem(zypp::Resolvable, zypp::Error, String) - problem report
+# install_finish(zypp::Resolvable, zypp::Error, String) - uninstall finish
+#
+
+class CommitReceiver:
+
+ ################################
+ # removal callbacks
+
+ #
+ # removal_start() will be called at the beginning of a resolvable (typically package) uninstall
+ # and be passed the resolvable to-be-removed
+ #
+ def removal_start(self, resolvable):
+ # testing: increment the number of removals and print the resolvable
+ global removals
+ removals += 1
+ print "Starting to remove ", resolvable
+
+ #
+ # removal_progress() is called during a resolvable (typically package) uninstall
+ # and be passed the resolvable to-be-removed and a percentage value
+ # Must return True (continue) or False (abort removal)
+ #
+ def removal_progress(self, resolvable, percentage):
+ assert percentage == 42
+ print "Remove of ", resolvable, " at ", percentage, "%"
+ return True
+
+ #
+ # removal_finish() is called after a resolvable (typically package) was uninstalled
+ # and be passed the resolvable just removed and a status (string) with detail (string)
+ # status is either
+ # - "no_error": typical 'good' status
+ # - "not_found": resolvable not found (i.e. not installed)
+ # - "io": (disk) I/O error
+ # - "invalid": any other error
+ #
+ def removal_finish(self, resolvable, status, detail):
+ print "Remove of ", resolvable.name(), " finished with problem ", status, ": ", detail
+
+ #
+ # report a problem during resolvable removal
+ # error is the same as 'status' of removal_finish()
+ #
+ # Must return "abort", "retry" or "ignore"
+ #
+ def removal_problem(self, resolvable, error, description):
+ print "Remove of ", resolvable.name(), " has problem ", error, ": ", description
+ return "ignore"
+
+ ################################
+ # install callbacks
+
+ #
+ # install_start() will be called at the beginning of a resolvable (typically package) install
+ # and be passed the resolvable to-be-installed
+ #
+ def install_start(self, resolvable):
+ # testing: increment the number of removals and print the resolvable
+ global installs
+ installs += 1
+ print "Starting to install ", resolvable
+
+ #
+ # install_progress() is called during a resolvable (typically package) install
+ # and be passed the resolvable to-be-removed and a percentage value
+ # Must return True (continue) or False (abort install)
+ #
+ def install_progress(self, resolvable, percentage):
+ assert percentage == 42
+ print "Install of ", resolvable, " at ", percentage, "%"
+ return True
+
+ #
+ # install_finish() is called after a resolvable (typically package) was installed
+ # and be passed the resolvable just installed and a status (string) with detail (string)
+ # status is either
+ # - "no_error": typical 'good' status
+ # - "not_found": resolvable not found
+ # - "io": (disk) I/O error
+ # - "invalid": any other error
+ #
+ def install_finish(self, resolvable, status, detail):
+ print "Install of ", resolvable.name(), " finished with problem ", status, ": ", detail
+
+ #
+ # report a problem during resolvable install
+ # error is the same as 'status' of install_finish()
+ #
+ # Must return "abort", "retry" or "ignore"
+ #
+ def install_problem(self, resolvable, error, description):
+ print "Install of ", resolvable.name(), " has problem ", error, ": ", description
+ return "ignore"
+
+#
+# Testcase for Callbacks
+#
+
+class CommitCallbacksTestCase(unittest.TestCase):
+ def setUp(self):
+ #
+ # Normal zypp startup
+ #
+ self.Z = zypp.ZYppFactory_instance().getZYpp()
+ self.Z.initializeTarget( zypp.Pathname("/") )
+ self.Z.target().load()
+
+ # The 'zypp.CommitCallbacksEmitter()' is a test/debug class
+ # which can be used to trigger various callbacks
+ # (This is callback test code - we cannot do an actual package uninstall here!)
+ self.commit_callbacks_emitter = zypp.CommitCallbacksEmitter()
+
+ #
+ # create an instance of our CommitReceiver class defined above
+ #
+ self.commit_receiver = CommitReceiver()
+
+ # zypp.CommitCallbacks is the callback 'handler' which must be informed
+ # about the receiver
+ self.commit_callbacks = zypp.CommitCallbacks()
+
+ #
+ # Ensure that no other receiver is registered
+ #
+ assert None == self.commit_callbacks.receiver()
+
+ #
+ # Connect the receiver instance with the callback handler
+ #
+ self.commit_callbacks.connect(self.commit_receiver)
+
+ #
+ # Ensure that its set correctly
+ #
+ assert self.commit_receiver == self.commit_callbacks.receiver()
+
+ def tearDown(self):
+ #
+ # Disconnect the receiver from the callback handler
+ #
+ self.commit_callbacks.disconnect()
+
+ #
+ # Ensure that the disconnect was successful
+ #
+ assert None == self.commit_callbacks.receiver()
+
+ # test patch message
+ def testPatchMessageCallback(self):
+ #
+ # Ugh, this would need a patch with a message :-/
+ #
+ # FIXME
+ assert True
+
+ # test patch script
+ def testPatchScriptCallback(self):
+ #
+ # Ugh, this would need a patch with a script :-/
+ #
+ # FIXME
+ assert True
+
+ # this will test the remove callback
+ def testRemoveCallback(self):
+
+ #
+ # Loop over pool - just to get real instances of Resolvable
+ #
+ for item in self.Z.pool():
+ print "Emitting removal of ", item.resolvable()
+ #
+ # Use the zypp.CommitCallbacksEmitter to fake an actual package removal
+ #
+ resolvable = item.resolvable()
+ self.commit_callbacks_emitter.remove_start(resolvable)
+ self.commit_callbacks_emitter.remove_progress(resolvable, 42)
+# self.commit_callbacks_emitter.remove_problem(resolvable, zypp.REMOVE_NO_ERROR, "All fine")
+# self.commit_callbacks_emitter.remove_finish(resolvable, zypp.REMOVE_NO_ERROR, "Done")
+ break # one is sufficient
+ #
+ # Did the actual callback got executed ?
+ #
+ assert removals == 1
+
+ # this will test the install callback
+ def testInstallCallback(self):
+
+ #
+ # Loop over pool - just to get real instances of Resolvable
+ #
+ for item in self.Z.pool():
+ print "Emitting install of ", item.resolvable()
+ #
+ # Use the zypp.CommitCallbacksEmitter to fake an actual package removal
+ #
+ resolvable = item.resolvable()
+ self.commit_callbacks_emitter.install_start(resolvable)
+ self.commit_callbacks_emitter.install_progress(resolvable, 42)
+# self.commit_callbacks_emitter.install_problem(resolvable, zypp.REMOVE_NO_ERROR, "All fine")
+# self.commit_callbacks_emitter.install_finish(resolvable, zypp.REMOVE_NO_ERROR, "Done")
+ break # one is sufficient
+ #
+ # Did the actual callback got executed ?
+ #
+ assert installs == 1
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/python/tests/installed_path.py b/swig/python/tests/installed_path.py
new file mode 100644
index 0000000..95cecd7
--- /dev/null
+++ b/swig/python/tests/installed_path.py
@@ -0,0 +1,27 @@
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def testpath(self):
+ import zypp
+ Z = zypp.ZYppFactory.instance().getZYpp()
+ assert Z
+ Z.initializeTarget( zypp.Pathname("/") )
+ Z.target().load()
+ installed_pkgs = Z.pool()
+ for item in installed_pkgs:
+ if zypp.isKindPackage(item):
+ print "Repopath %s" % item.repoInfo().packagesPath()
+ item = zypp.asKindPackage(item)
+ print "Location filename %s" % item.location().filename()
+ print "%s.%s %s:%d" % (item.name(), item.arch(), item.edition(), item.installSize())
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/python/tests/loading.py b/swig/python/tests/loading.py
new file mode 100644
index 0000000..4072ea7
--- /dev/null
+++ b/swig/python/tests/loading.py
@@ -0,0 +1,16 @@
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def testloading(self):
+ import zypp
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/python/tests/problems.py b/swig/python/tests/problems.py
new file mode 100644
index 0000000..0406290
--- /dev/null
+++ b/swig/python/tests/problems.py
@@ -0,0 +1,21 @@
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def testproblems(self):
+ import zypp
+ Z = zypp.ZYppFactory.instance().getZYpp()
+ assert Z
+ if not Z.resolver().resolvePool():
+ for problem in Z.resolver().problems():
+ print "Problem %s" % problem.description()
+# raise "Solver Error"
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/python/tests/repoinfo.py b/swig/python/tests/repoinfo.py
new file mode 100644
index 0000000..9934f09
--- /dev/null
+++ b/swig/python/tests/repoinfo.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+#
+# Author: Jan Blunck <jblunck@suse.de>
+#
+
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+from zypp import RepoInfo, Url, UrlSet, RepoType
+
+repo_urls = [ "file:/mounts/mirror/SuSE/ftp.opensuse.org/srv/ftp/pub/opensuse/debug/update/11.1/",
+ "http://download.opensuse.org/debug/update/11.1/" ]
+
+class RepoInfoTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.info = RepoInfo()
+ self.info.addBaseUrl(Url(repo_urls[0]))
+ self.info.addBaseUrl(Url(repo_urls[1]))
+ self.info.setAlias("default")
+ self.info.setName("default")
+ self.info.setEnabled(True)
+ self.info.setType(RepoType.RPMMD)
+ self.info.setGpgCheck(False)
+
+ def testUrlSetIsUrlSet(self):
+ urls = UrlSet()
+ assert urls.__class__.__name__ == "UrlSet", 'Incorrect class (' + urls.__class__.__name__ + ')'
+
+ def testUrlSetAppend(self):
+ urls = UrlSet()
+ urls.append(Url(repo_urls[0]))
+ urls.append(Url(repo_urls[1]))
+ assert urls.size() == 2, 'Incorrect size ' + urls.size()
+
+ def testBaseUrlsReturnsTuple(self):
+ baseurls = self.info.baseUrls()
+ assert baseurls.__class__.__name__ == "tuple", 'Incorrect class (' + baseurls.__class__.__name__ + ')'
+
+ def testBaseUrlsIteratable(self):
+ baseurls = self.info.baseUrls()
+ for url in baseurls:
+ assert url.__str__() in repo_urls, 'Incorrect URL ' + url.__str__()
+
+ def testSetBaseUrl(self):
+ baseurls = self.info.baseUrls()
+ assert len(baseurls) == 2
+ self.info.setBaseUrl(Url(repo_urls[0]))
+ baseurls = self.info.baseUrls()
+ assert len(baseurls) == 1
+
+ def testDump(self):
+ out = self.info.dump()
+ assert len(out) == 396, 'Invalid output length %d' % len(out)
+
+ def testDumpIni(self):
+ out = self.info.dumpAsIni()
+ assert len(out) == 208, 'Invalid output length %d' % len(out)
+
+ def testDumpXML(self):
+ out = self.info.dumpAsXML()
+ assert len(out) == 253, 'Invalid output length %d' % len(out)
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/swig/python/tests/starting.py b/swig/python/tests/starting.py
new file mode 100644
index 0000000..91d4f4d
--- /dev/null
+++ b/swig/python/tests/starting.py
@@ -0,0 +1,19 @@
+import unittest
+
+import os
+cwd = os.path.abspath(os.path.dirname(__file__))
+
+import sys
+sys.path.insert(0, cwd + "/../../../build/swig/python")
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def teststarting(self):
+ import zypp
+ Z = zypp.ZYppFactory.instance().getZYpp()
+ assert Z
+ Z.initializeTarget( zypp.Pathname("/") )
+ Z.target().load();
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/swig/ruby/CMakeLists.txt b/swig/ruby/CMakeLists.txt
new file mode 100644
index 0000000..08d6329
--- /dev/null
+++ b/swig/ruby/CMakeLists.txt
@@ -0,0 +1,62 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig/ruby
+#
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(tests)
+
+# SWIG_OUPUT is per-target
+
+SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libzypp_ruby.cc" )
+
+MESSAGE(STATUS "Ruby executable: ${RUBY_EXECUTABLE}")
+MESSAGE(STATUS "Ruby vendor arch dir: ${RUBY_VENDORARCH_DIR}")
+MESSAGE(STATUS "Ruby include path: ${RUBY_INCLUDE_PATH}")
+
+ADD_CUSTOM_COMMAND (
+ OUTPUT "${SWIG_OUTPUT}"
+ COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Ruby..."
+ COMMAND ${SWIG_EXECUTABLE} ${SWIG_DEFINITIONS} -c++ -ruby -o ${SWIG_OUTPUT} -I${ZYPP_INCLUDE_DIR} ${SWIG_INPUT}
+ COMMAND ${CMAKE_COMMAND} -E echo "Done."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/../*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+)
+
+ADD_LIBRARY( zypp_ruby SHARED ${SWIG_OUTPUT} )
+
+# name it 'zypp.so'
+# and don't prefix with 'lib'
+SET_TARGET_PROPERTIES( zypp_ruby PROPERTIES OUTPUT_NAME "zypp" PREFIX "" )
+
+INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} )
+INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/swig )
+INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+
+TARGET_LINK_LIBRARIES( zypp_ruby ${RUBY_LIBRARY} )
+TARGET_LINK_LIBRARIES( zypp_ruby ${ZYPP_LIBRARY} )
+
+INSTALL(TARGETS zypp_ruby LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR})
+
+#
+# Generate HTML documentation with rdoc
+#
+# This requires rdoc-swig from https://github.com/kkaempf/rdoc-swig
+#
+
+IF(EXISTS ${CMAKE_SOURCE_DIR}/swig/ruby/rdoc)
+SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${rdoc_dir}
+ COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..."
+ COMMAND rm -rf ${rdoc_dir}
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rdoc -o ${rdoc_dir} zypp.i *.i ruby/*.i
+ COMMAND ${CMAKE_COMMAND} -E echo "Done."
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/swig
+ DEPENDS ${CMAKE_SOURCE_DIR}/swig/*.i ${CMAKE_SOURCE_DIR}/swig/ruby/*.rb ${CMAKE_SOURCE_DIR}/swig/ruby/*.i
+)
+ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}")
+ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/swig/ruby/rdoc)
+
+#
+# Leave this to %doc in the .spec file
+#INSTALL(DIRECTORY "${rdoc_dir}" DESTINATION ${DOC_INSTALL_DIR})
diff --git a/swig/ruby/ruby.i b/swig/ruby/ruby.i
new file mode 100644
index 0000000..d2d3025
--- /dev/null
+++ b/swig/ruby/ruby.i
@@ -0,0 +1,125 @@
+
+%rename *::asString "to_s";
+
+namespace zypp
+{
+ // Not ignoring gives a very strange error in the "pokus" testsuite: SWIG
+ // defines a Ruby module-function "==" which (when included into the main
+ // namespace) is apparently used where is should not.
+ %ignore operator==;
+
+ // Just to avoid warnings.
+ %ignore operator!=;
+ %ignore operator<<;
+
+ namespace filesystem
+ {
+ // Same as above.
+ %ignore operator==;
+ %ignore operator!=;
+ %ignore operator<<;
+ }
+
+}
+
+/*
+ * Extend cls with an ruby-like each iterator and a to_a method. Yields
+ * objects of type storetype. Parameter storetype must be a pointer type.
+ */
+#define iter2(cls, storetype) \
+%mixin cls "Enumerable"; \
+%extend cls \
+{ \
+ void each() { \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const storetype tmp = &**i; \
+ rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+ i++; \
+ } \
+ } \
+\
+ VALUE to_a() { \
+ VALUE ary = rb_ary_new(); \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const storetype tmp = &**i; \
+ rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+ i++; \
+ } \
+ return ary; \
+ } \
+}
+
+
+/*
+ * Like iter2, but does only one dereferencing from the iterator.
+ */
+#define iter3(cls, storetype) \
+%mixin cls "Enumerable"; \
+%extend cls \
+{ \
+ void each() { \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const storetype tmp = &*i; \
+ rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+ i++; \
+ } \
+ } \
+\
+ VALUE to_a() { \
+ VALUE ary = rb_ary_new(); \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const storetype tmp = &*i; \
+ rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
+ i++; \
+ } \
+ return ary; \
+ } \
+}
+
+/*
+ * This is for an iterator whichs operator* returns by value (i.e. a temporary).
+ * Like e.g. the Capabilities::const_iterator does. If the compiler warns you are
+ * taking the address of a temporary when using iter3, you most probaly need this one.
+ *
+ */
+#define by_value_iterator(cls) \
+%mixin cls "Enumerable"; \
+%extend cls \
+{ \
+ void each() { \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const cls::value_type* tmp = new cls::value_type( *i ); \
+ rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+ i++; \
+ } \
+ } \
+\
+ VALUE to_a() { \
+ VALUE ary = rb_ary_new(); \
+ cls::const_iterator i = self->begin(); \
+ while (i != self->end()) { \
+ const cls::value_type* tmp = new cls::value_type( *i ); \
+ rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+ i++; \
+ } \
+ return ary; \
+ } \
+}
+
+%exception
+{
+ try {
+ $action
+ }
+ catch (const Exception& e) {
+ static VALUE zyppexception = rb_define_class("ZYppException", rb_eStandardError);
+ std::string tmp = e.historyAsString() + e.asUserString();
+ rb_raise(zyppexception, tmp.c_str());
+ }
+}
+
diff --git a/swig/ruby/std_list.i b/swig/ruby/std_list.i
new file mode 100644
index 0000000..f6d36e6
--- /dev/null
+++ b/swig/ruby/std_list.i
@@ -0,0 +1,533 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_list.i
+ *
+ * SWIG typemaps for std::list
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::list
+//
+// The aim of all that follows would be to integrate std::list with
+// Ruby as much as possible, namely, to allow the user to pass and
+// be returned Ruby arrays
+// const declarations are used to guess the intent of the function being
+// exported; therefore, the following rationale is applied:
+//
+// -- f(std::list<T>), f(const std::list<T>&), f(const std::list<T>*):
+// the parameter being read-only, either a Ruby array or a
+// previously wrapped std::list<T> can be passed.
+// -- f(std::list<T>&), f(std::list<T>*):
+// the parameter must be modified; therefore, only a wrapped std::list
+// can be passed.
+// -- std::list<T> f():
+// the list is returned by copy; therefore, a Ruby array of T:s
+// is returned which is most easily used in other Ruby functions
+// -- std::list<T>& f(), std::list<T>* f(), const std::list<T>& f(),
+// const std::list<T>* f():
+// the list is returned by reference; therefore, a wrapped std::list
+// is returned
+// ------------------------------------------------------------------------
+
+%{
+#include <list>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+// exported class
+
+namespace std {
+
+ %mixin list "Enumerable";
+
+ template<class T> class list {
+ %typemap(in) list<T> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ $1.push_back(*x);
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const list<T>& (std::list<T> temp),
+ const list<T>* (std::list<T> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ temp.push_back(*x);
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+
+ void each() {
+ for ( std::list<T>::const_iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+
+
+ %typemap(out) list<T> {
+ $result = rb_ary_new2($1.size());
+ unsigned int i = 0;
+ for ( std::list<T>::iterator it = $1.begin();
+ it != $1.end();
+ ++it )
+ {
+ T* x = new T((*it));
+ rb_ary_store($result,i,
+ SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 1));
+ ++i;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) list<T> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const list<T>&,
+ const list<T>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ list();
+ list(unsigned int size);
+ list(unsigned int size, const T& value);
+ list(const list<T> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) push_back;
+ void push_back(const T& x);
+ %extend {
+ /*
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty list");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T& __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ void __setitem__(int i, const T& x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ */
+ void each() {
+ for ( std::list<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+
+ // Partial specialization for lists of pointers. [ beazley ]
+
+ %mixin list<T*> "Enumerable";
+ template<class T> class list<T*> {
+ %typemap(in) list<T*> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = std::list<T* >(size);
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ (($1_type &)$1)[i] = x;
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const list<T*>& (std::list<T*> temp),
+ const list<T*>* (std::list<T*> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ temp = std::list<T* >(size);
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ temp[i] = x;
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+ %typemap(out) list<T*> {
+ $result = rb_ary_new2($1.size());
+ for (unsigned int i=0; i<$1.size(); i++) {
+ T* x = (($1_type &)$1)[i];
+ rb_ary_store($result,i,
+ SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) list<T*> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T* >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const list<T*>&,
+ const list<T*>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T* >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ list();
+ list(unsigned int size);
+ list(unsigned int size, T * &value);
+ list(const list<T*> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) push_back;
+ void push_back(T* x);
+ %extend {
+ /*
+ T* pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty list");
+ T* x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T* __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ void __setitem__(int i, T* x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ */
+ void each() {
+ for ( std::list<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+
+
+ // specializations for built-ins
+
+ %define specialize_std_list(T,CHECK,CONVERT_FROM,CONVERT_TO)
+ %mixin list<T> "Enumerable";
+ template<> class list<T> {
+ %typemap(in) list<T> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = std::list<T >(size);
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ if (CHECK(o))
+ (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+ else
+ rb_raise(rb_eTypeError,
+ "wrong argument type"
+ " (expected list<" #T ">)");
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const list<T>& (std::list<T> temp),
+ const list<T>* (std::list<T> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ temp = std::list<T >(size);
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ if (CHECK(o))
+ temp[i] = (T)(CONVERT_FROM(o));
+ else
+ rb_raise(rb_eTypeError,
+ "wrong argument type"
+ " (expected list<" #T ">)");
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+ %typemap(out) list<T> {
+ $result = rb_ary_new2($1.size());
+ for (unsigned int i=0; i<$1.size(); i++)
+ rb_ary_store($result,i,CONVERT_TO((($1_type &)$1)[i]));
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) list<T> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ VALUE o = RARRAY($input)->ptr[0];
+ if (CHECK(o))
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const list<T>&,
+ const list<T>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ VALUE o = RARRAY($input)->ptr[0];
+ if (CHECK(o))
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped list? */
+ std::list<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ list();
+ list(unsigned int size);
+ list(unsigned int size, const T& value);
+ list(const list<T> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) push_back;
+ void push_back(T x);
+ %extend {
+ /*
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty list");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ void __setitem__(int i, T x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ */
+ void each() {
+ for ( std::list<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+ %enddef
+
+ specialize_std_list(bool,SWIG_BOOL_P,SWIG_RB2BOOL,SWIG_BOOL2RB);
+ specialize_std_list(char,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(int,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(short,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(long,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(unsigned char,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(unsigned int,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(unsigned short,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(unsigned long,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_list(double,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+ specialize_std_list(float,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+ specialize_std_list(std::string,SWIG_STRING_P,SWIG_RB2STR,SWIG_STR2RB);
+
+}
+
diff --git a/swig/ruby/std_set.i b/swig/ruby/std_set.i
new file mode 100644
index 0000000..af2a146
--- /dev/null
+++ b/swig/ruby/std_set.i
@@ -0,0 +1,527 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_set.i
+ *
+ * SWIG typemaps for std::set
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::set
+//
+// The aim of all that follows would be to integrate std::set with
+// Ruby as much as possible, namely, to allow the user to pass and
+// be returned Ruby arrays
+// const declarations are used to guess the intent of the function being
+// exported; therefore, the following rationale is applied:
+//
+// -- f(std::set<T>), f(const std::set<T>&), f(const std::set<T>*):
+// the parameter being read-only, either a Ruby array or a
+// previously wrapped std::set<T> can be passed.
+// -- f(std::set<T>&), f(std::set<T>*):
+// the parameter must be modified; therefore, only a wrapped std::set
+// can be passed.
+// -- std::set<T> f():
+// the set is returned by copy; therefore, a Ruby array of T:s
+// is returned which is most easily used in other Ruby functions
+// -- std::set<T>& f(), std::set<T>* f(), const std::set<T>& f(),
+// const std::set<T>* f():
+// the set is returned by reference; therefore, a wrapped std::set
+// is returned
+// ------------------------------------------------------------------------
+
+%{
+#include <set>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+// exported class
+
+namespace std {
+
+ %mixin set "Enumerable";
+
+ template<class T> class set {
+ %typemap(in) set<T> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ $1.insert(*x);
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const set<T>& (std::set<T> temp),
+ const set<T>* (std::set<T> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ temp.insert(*x);
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+
+ void each() {
+ for ( std::set<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = (T *) &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+
+
+ %typemap(out) set<T> {
+ $result = rb_ary_new2($1.size());
+ unsigned int i = 0;
+ for ( std::set<T>::iterator it = $1.begin();
+ it != $1.end();
+ ++it )
+ {
+ T* x = new T((*it));
+ rb_ary_store($result,i,
+ SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 1));
+ ++i;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) set<T> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const set<T>&,
+ const set<T>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ set();
+ set(const set<T> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) insert;
+ void insert(const T& x);
+ %extend {
+ /*
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty set");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T& __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ void __setitem__(int i, const T& x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ */
+ void each() {
+ for ( std::set<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = (T *)&(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+
+ // Partial specialization for sets of pointers. [ beazley ]
+
+ %mixin set<T*> "Enumerable";
+ template<class T> class set<T*> {
+ %typemap(in) set<T*> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = std::set<T* >(size);
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ (($1_type &)$1)[i] = x;
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const set<T*>& (std::set<T*> temp),
+ const set<T*>* (std::set<T*> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ temp = std::set<T* >(size);
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ T* x;
+ SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
+ temp[i] = x;
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+ %typemap(out) set<T*> {
+ $result = rb_ary_new2($1.size());
+ for (unsigned int i=0; i<$1.size(); i++) {
+ T* x = (($1_type &)$1)[i];
+ rb_ary_store($result,i,
+ SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) set<T*> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T* >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const set<T*>&,
+ const set<T*>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ VALUE o = RARRAY($input)->ptr[0];
+ if ((SWIG_ConvertPtr(o,(void **) &x,
+ $descriptor(T *),0)) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T* >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ set();
+ set(const set<T*> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) insert;
+ void insert(T* x);
+ %extend {
+ /*
+ T* pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty set");
+ T* x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T* __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ void __setitem__(int i, T* x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ */
+ void each() {
+ for ( std::set<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = (T*) &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+
+
+ // specializations for built-ins
+
+ %define specialize_std_set(T,CHECK,CONVERT_FROM,CONVERT_TO)
+ %mixin set<T> "Enumerable";
+ template<> class set<T> {
+ %typemap(in) set<T> {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ $1 = std::set<T >(size);
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ if (CHECK(o))
+ (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+ else
+ rb_raise(rb_eTypeError,
+ "wrong argument type"
+ " (expected set<" #T ">)");
+ }
+ } else {
+ void *ptr;
+ SWIG_ConvertPtr($input, &ptr, $&1_descriptor, 1);
+ $1 = *(($&1_type) ptr);
+ }
+ }
+ %typemap(in) const set<T>& (std::set<T> temp),
+ const set<T>* (std::set<T> temp) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ temp = std::set<T >(size);
+ $1 = &temp;
+ for (unsigned int i=0; i<size; i++) {
+ VALUE o = RARRAY($input)->ptr[i];
+ if (CHECK(o))
+ temp[i] = (T)(CONVERT_FROM(o));
+ else
+ rb_raise(rb_eTypeError,
+ "wrong argument type"
+ " (expected set<" #T ">)");
+ }
+ } else {
+ SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
+ }
+ }
+ %typemap(out) set<T> {
+ $result = rb_ary_new2($1.size());
+ for (unsigned int i=0; i<$1.size(); i++)
+ rb_ary_store($result,i,CONVERT_TO((($1_type &)$1)[i]));
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) set<T> {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ VALUE o = RARRAY($input)->ptr[0];
+ if (CHECK(o))
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const set<T>&,
+ const set<T>* {
+ /* native sequence? */
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ unsigned int size = RARRAY($input)->len;
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ VALUE o = RARRAY($input)->ptr[0];
+ if (CHECK(o))
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else {
+ /* wrapped set? */
+ std::set<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor,0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ set();
+ set(const set<T> &);
+
+ %rename(__len__) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ void clear();
+ %rename(push) insert;
+ void insert(T x);
+ %extend {
+ /*
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty set");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T __getitem__(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i += size;
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ void __setitem__(int i, T x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i<0) i+= size;
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("set index out of range");
+ }
+ */
+ void each() {
+ for ( std::set<T>::iterator it = self->begin();
+ it != self->end();
+ ++it )
+ {
+ T* x = &(*it);
+ rb_yield(SWIG_NewPointerObj((void *) x,
+ $descriptor(T *), 0));
+ }
+ }
+ }
+ };
+ %enddef
+
+ specialize_std_set(bool,SWIG_BOOL_P,SWIG_RB2BOOL,SWIG_BOOL2RB);
+ specialize_std_set(char,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(int,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(short,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(long,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(unsigned char,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(unsigned int,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(unsigned short,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(unsigned long,FIXNUM_P,FIX2INT,INT2NUM);
+ specialize_std_set(double,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+ specialize_std_set(float,SWIG_FLOAT_P,SWIG_NUM2DBL,rb_float_new);
+ specialize_std_set(std::string,SWIG_STRING_P,SWIG_RB2STR,SWIG_STR2RB);
+
+}
+
diff --git a/swig/ruby/tests/CMakeLists.txt b/swig/ruby/tests/CMakeLists.txt
new file mode 100644
index 0000000..3b084df
--- /dev/null
+++ b/swig/ruby/tests/CMakeLists.txt
@@ -0,0 +1,11 @@
+#
+# CMakeLists.txt for libzypp-bindings/swig/ruby/tests
+#
+
+ENABLE_TESTING()
+
+ADD_TEST(bindings_ruby_loading ruby -C ${CMAKE_CURRENT_SOURCE_DIR} loading.rb)
+ADD_TEST(bindings_ruby_arch.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} arch.rb)
+ADD_TEST(bindings_ruby_bytecount.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} bytecount.rb)
+ADD_TEST(bindings_ruby_starting.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} starting.rb)
+ADD_TEST(bindings_ruby_target.rb ruby -C ${CMAKE_CURRENT_SOURCE_DIR} target.rb)
diff --git a/swig/ruby/tests/arch.rb b/swig/ruby/tests/arch.rb
new file mode 100644
index 0000000..3e2f508
--- /dev/null
+++ b/swig/ruby/tests/arch.rb
@@ -0,0 +1,55 @@
+#
+# Arch
+#
+
+$:.unshift File.expand_path(File.join(File.dirname(__FILE__),"..","..","..","build","swig","ruby"))
+
+require 'test/unit'
+require 'zypp'
+
+class Zypp::Arch
+ include Comparable
+end
+
+class ArchTest < Test::Unit::TestCase
+ include Zypp
+ def test_arch
+ # define i386, a builtin
+
+ a = Arch.new("i386")
+ assert a
+ assert_equal "i386", a.to_s
+ assert_equal true, a.is_builtin
+
+ # i486 is 'bigger' than i386
+
+ b = Arch.new("i486")
+ assert b
+ assert_equal "i486", b.to_s
+ assert b.is_builtin
+ if VERSION > 800
+ assert_equal a, b.base_arch
+ end
+ assert a < b
+ assert a.compatible_with?(b)
+
+ # A new, adventurous architecture
+ z = Arch.new("xyzzy")
+ assert z
+ assert_equal "xyzzy", z.to_s
+ assert_equal false, z.is_builtin
+
+ # predefined archs
+ assert_equal Arch.new("noarch"), Arch.noarch
+ assert_equal a, Arch.i386
+ assert_equal b, Arch.i486
+ assert_equal Arch.new("i586"), Arch.i586
+ assert_equal Arch.new("i686"), Arch.i686
+ assert_equal Arch.new("x86_64"), Arch.x86_64
+ assert_equal Arch.new("ia64"), Arch.ia64
+ assert_equal Arch.new("ppc"), Arch.ppc
+ assert_equal Arch.new("ppc64"), Arch.ppc64
+ assert_equal Arch.new("s390"), Arch.s390
+ assert_equal Arch.new("s390x"), Arch.s390x
+ end
+end
diff --git a/swig/ruby/tests/bytecount.rb b/swig/ruby/tests/bytecount.rb
new file mode 100644
index 0000000..5b46e14
--- /dev/null
+++ b/swig/ruby/tests/bytecount.rb
@@ -0,0 +1,25 @@
+#
+# Test Bytecount
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+ require 'zypp'
+ include Zypp
+
+ def test_bytecount
+ g = ByteCount.new(ByteCount.G)
+ assert g
+ gb = ByteCount.new(ByteCount.GB)
+ assert gb
+ k = ByteCount.new(ByteCount.K)
+ assert k.to_i == 1024
+ mb = ByteCount.new(ByteCount.MB)
+ assert mb.to_i == 1000*1000
+ end
+end
diff --git a/swig/ruby/tests/commit_callbacks.rb b/swig/ruby/tests/commit_callbacks.rb
new file mode 100644
index 0000000..74767ce
--- /dev/null
+++ b/swig/ruby/tests/commit_callbacks.rb
@@ -0,0 +1,46 @@
+#
+# Test commit callbacks
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+require 'test/unit'
+require 'zypp'
+
+class CommitReceiver
+ # Define class function, we pass the class (not an instance of the class)
+ # to the CommitCallbacks
+ def self.removal_start resolvable
+ $stderr.puts "Starting to remove #{resolvable}"
+ end
+end
+
+class CommitCallbacksTest < Test::Unit::TestCase
+ def test_removal_callback
+ commit_callbacks = Zypp::CommitCallbacks.new
+ assert_equal nil, commit_callbacks.receiver
+ # In Ruby the class is also an object, so we connect to the class
+ commit_callbacks.connect CommitReceiver
+ assert_equal CommitReceiver, commit_callbacks.receiver
+
+ z = Zypp::ZYppFactory::instance.getZYpp
+
+ z.initializeTarget(Zypp::Pathname.new("/"))
+ t = z.target
+ t.load
+ t.buildCache
+
+ emitter = Zypp::CommitCallbacksEmitter.new
+ p = z.pool
+ p.each do |item|
+ puts "Emitting removal of ", item
+ puts item.methods.inspect
+ emitter.remove_start(item)
+ break
+ end
+
+ commit_callbacks.disconnect
+ assert_equal nil, commit_callbacks.receiver
+ end
+end
diff --git a/swig/ruby/tests/loading.rb b/swig/ruby/tests/loading.rb
new file mode 100644
index 0000000..01ae25a
--- /dev/null
+++ b/swig/ruby/tests/loading.rb
@@ -0,0 +1,16 @@
+#
+# Test loading of the bindings
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+ def test_loading
+ require 'zypp'
+ assert true
+ end
+end
diff --git a/swig/ruby/tests/starting.rb b/swig/ruby/tests/starting.rb
new file mode 100644
index 0000000..5f3afb2
--- /dev/null
+++ b/swig/ruby/tests/starting.rb
@@ -0,0 +1,22 @@
+#
+# Test starting of zypp
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+ def test_loading
+ require 'zypp'
+ zypp = Zypp::ZYppFactory::instance.getZYpp
+ assert zypp
+ zconfig = Zypp::ZConfig::instance
+ assert zconfig
+ puts zconfig.systemArchitecture
+ zconfig.setSystemArchitecture(Zypp::Arch.new("i686"))
+ puts zconfig.systemArchitecture
+ end
+end
diff --git a/swig/ruby/tests/target.rb b/swig/ruby/tests/target.rb
new file mode 100644
index 0000000..cfecfff
--- /dev/null
+++ b/swig/ruby/tests/target.rb
@@ -0,0 +1,44 @@
+#
+# Example for target
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+ require 'zypp'
+ include Zypp
+ def test_target
+ z = ZYppFactory::instance.getZYpp
+
+ assert z.homePath
+ assert z.tmpPath
+
+ z.initializeTarget(Zypp::Pathname.new("/"))
+ t = z.target
+ assert t
+ t.load
+ t.buildCache
+
+ p = z.pool
+ assert p
+ assert p.size > 0
+
+ # Iterate over pool, gives PoolItems
+ i = 0
+ puts "#{p.size} PoolItems:"
+ p.each do | pi |
+ i = i + 1
+ break if i > 10
+ puts pi
+ # PoolItems have status and a resolvable
+# r = pi.resolvable
+# puts "#{r.name}-#{r.edition}"
+ end
+
+ assert true
+ end
+end
diff --git a/swig/zypp.i b/swig/zypp.i
new file mode 100644
index 0000000..08d573b
--- /dev/null
+++ b/swig/zypp.i
@@ -0,0 +1,283 @@
+%module zypp
+
+/* set this to 0 (zero) to only create a subset of the bindings
+ * for testing
+ */
+#define PRODUCTION 1
+
+#ifdef SWIGPERL5
+%{
+ #undef NORMAL
+ #undef readdir
+ #undef Fflush
+ #undef Mkdir
+ #undef strerror
+%}
+#endif
+
+%{
+/* Includes the header in the wrapper code */
+#ifdef SWIGRUBY
+#define REG_EXTENDED 1
+#define REG_ICASE (REG_EXTENDED << 1)
+#define REG_NEWLINE (REG_ICASE << 1)
+#define REG_NOSUB (REG_NEWLINE << 1)
+#endif
+
+/*
+ * type definitions to keep the C code generic
+ */
+
+#if defined(SWIGPYTHON)
+#define Target_Null_p(x) (x == Py_None)
+#define Target_INCREF(x) Py_INCREF(x)
+#define Target_DECREF(x) Py_DECREF(x)
+#define Target_True Py_True
+#define Target_False Py_False
+#define Target_Null Py_None
+#define Target_Type PyObject*
+#define Target_Bool(x) PyBool_FromLong(x)
+#define Target_WChar(x) PyInt_FromLong(x)
+#define Target_Int(x) PyInt_FromLong(x)
+#define Target_String(x) PyString_FromString(x)
+#define Target_Real(x) Py_None
+#define Target_Array() PyList_New(0)
+#define Target_SizedArray(len) PyList_New(len)
+#define Target_Append(x,y) PyList_Append(x,y)
+#define Target_DateTime(x) Py_None
+#include <Python.h>
+#define TARGET_THREAD_BEGIN_BLOCK SWIG_PYTHON_THREAD_BEGIN_BLOCK
+#define TARGET_THREAD_END_BLOCK SWIG_PYTHON_THREAD_END_BLOCK
+#define TARGET_THREAD_BEGIN_ALLOW SWIG_PYTHON_THREAD_BEGIN_ALLOW
+#define TARGET_THREAD_END_ALLOW SWIG_PYTHON_THREAD_END_ALLOW
+#endif
+
+#if defined(SWIGRUBY)
+#define Target_Null_p(x) NIL_P(x)
+#define Target_INCREF(x)
+#define Target_DECREF(x)
+#define Target_True Qtrue
+#define Target_False Qfalse
+#define Target_Null Qnil
+#define Target_Type VALUE
+#define Target_Bool(x) ((x)?Qtrue:Qfalse)
+#define Target_WChar(x) INT2FIX(x)
+#define Target_Int(x) INT2FIX(x)
+#define Target_String(x) rb_str_new2(x)
+#define Target_Real(x) rb_float_new(x)
+#define Target_Array() rb_ary_new()
+#define Target_SizedArray(len) rb_ary_new2(len)
+#define Target_Append(x,y) rb_ary_push(x,y)
+#define Target_DateTime(x) Qnil
+#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
+#define TARGET_THREAD_END_BLOCK do {} while(0)
+#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
+#define TARGET_THREAD_END_ALLOW do {} while(0)
+#include <ruby.h>
+#include <rubyio.h>
+#endif
+
+#if defined(SWIGPERL)
+#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
+#define TARGET_THREAD_END_BLOCK do {} while(0)
+#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
+#define TARGET_THREAD_END_ALLOW do {} while(0)
+
+SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value);
+SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr);
+SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value);
+
+#define Target_Null_p(x) (x == NULL)
+#define Target_INCREF(x)
+#define Target_DECREF(x)
+#define Target_True (&PL_sv_yes)
+#define Target_False (&PL_sv_no)
+#define Target_Null NULL
+#define Target_Type SV *
+#define Target_Bool(x) (x)?Target_True:Target_False
+#define Target_WChar(x) NULL
+#define Target_Int(x) SWIG_From_long(x)
+#define Target_String(x) SWIG_FromCharPtr(x)
+#define Target_Real(x) SWIG_From_double(x)
+#define Target_Array() (SV *)newAV()
+#define Target_SizedArray(len) (SV *)newAV()
+#define Target_Append(x,y) av_push(((AV *)(x)), y)
+#define Target_DateTime(x) NULL
+#include <perl.h>
+#include <EXTERN.h>
+#endif
+
+
+#include <sstream>
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/Edition.h"
+#include "zypp/Pathname.h"
+#include "zypp/ResTraits.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/ZYpp.h"
+
+#include "zypp/ResObjects.h"
+#include "zypp/Target.h"
+#include "zypp/target/TargetImpl.h"
+#include "zypp/MediaSetAccess.h"
+#include "zypp/ResFilters.h"
+#include "zypp/OnMediaLocation.h"
+#include "zypp/Repository.h"
+#include "zypp/ServiceInfo.h"
+#include "zypp/RepoManager.h"
+#include "zypp/repo/RepoType.h"
+#include "zypp/TmpPath.h"
+#include "zypp/Resolver.h"
+#include "zypp/pool/GetResolvablesToInsDel.h"
+
+#include "zypp/Product.h"
+
+using namespace boost;
+using namespace zypp;
+using namespace zypp::repo;
+using namespace zypp::resfilter;
+using namespace zypp::filesystem;
+
+typedef std::list<std::string> StringList;
+
+%}
+
+/* prevent swig from creating a type called 'Target_Type' */
+#if defined(SWIGRUBY)
+#define Target_Type VALUE
+#endif
+#if defined(SWIGPYTHON)
+#define Target_Type PyObject*
+#endif
+#if defined(SWIGPERL)
+#define Target_Type SV *
+#endif
+
+#ifdef SWIGRUBY
+%include "ruby/std_list.i"
+%include "ruby/std_set.i"
+%include "ruby/ruby.i"
+#endif
+
+#ifdef SWIGPYTHON
+%include "std_list.i"
+%include "std_set.i"
+%include "python/python.i"
+#endif
+
+#ifdef SWIGPERL5
+%include "std_list.i"
+%include "perl5/perl.i"
+#endif
+
+#define VERSION ZYPP_VERSION
+
+/* These include files are pending to be cleaned up from C++ cruft */
+#if PRODUCTION /* set 0 for testing, these files still carry the full C++ cruft */
+
+%nodefault ByKind;
+
+%rename("+") "operator+";
+%rename("<<") "operator<<";
+%rename("!=") "operator!=";
+%rename("!") "operator!";
+%rename("==") "operator==";
+
+namespace zypp {
+ namespace base {
+ // silence 'Nothing known about class..' warning
+ class ReferenceCounted {};
+ }
+}
+
+%include "std_string.i"
+%include "stl.i"
+
+#ifdef BOOST_SMARTPTR_INCLUDE_DIR
+%import <boost/smart_ptr/scoped_ptr.hpp>
+%import <boost/smart_ptr/shared_ptr.hpp>
+%import <boost/smart_ptr/weak_ptr.hpp>
+%import <boost/smart_ptr/intrusive_ptr.hpp>
+#else
+%import <boost/scoped_ptr.hpp>
+%import <boost/shared_ptr.hpp>
+%import <boost/weak_ptr.hpp>
+%import <boost/intrusive_ptr.hpp>
+#endif
+%import <zypp/base/PtrTypes.h>
+%import <zypp/base/Flags.h>
+
+%include "IdStringType.i"
+%include "Pathname.i"
+%include "ByteCount.i"
+%include "Url.i"
+%include "NeedAType.i"
+%include "Edition.i"
+%include "Kind.i"
+%include "CheckSum.i"
+%include "Date.i"
+%include "Dep.i"
+%include "Capability.i"
+%include "Capabilities.i"
+%include "CapMatch.i"
+%include "OnMediaLocation.i"
+%include "Resolvable.i"
+%include "RepoType.i"
+%include "RepoInfo.i"
+%include "ServiceInfo.i"
+%include "ResTraits.i"
+%include "ResStatus.i"
+%include "ResObject.i"
+%include "Package.i"
+%include "Patch.i"
+%include "Pattern.i"
+%include "Product.i"
+%include "SrcPackage.i"
+%include "Repository.i"
+%include "RepoStatus.i"
+%include "RepoManager.i"
+%include "PublicKey.i"
+%include "KeyRing.i"
+%include "Target.i"
+%include "MediaSetAccess.i"
+%include "PoolItem.i"
+%include "ResPool.i"
+%include "ZYppCommitPolicy.i"
+%include "ZYppCommitResult.i"
+%include "TmpPath.i"
+%include "Resolver.i"
+%include "ZConfig.i"
+
+%ignore zypp::ZYpp::setTextLocale;
+%ignore zypp::ZYpp::getTextLocale;
+%ignore zypp::ZYpp::setRequestedLocales;
+%ignore zypp::ZYpp::getRequestedLocales;
+%ignore zypp::ZYpp::getAvailableLocales;
+%ignore zypp::ZYpp::architecture;
+%ignore zypp::ZYpp::setArchitecture;
+%ignore zypp::ZYpp::applyLocks;
+
+%include <zypp/ZYpp.h>
+
+%include "ZYppFactory.i"
+#endif
+
+%include "Arch.i"
+%include "Callbacks.i"
+
+//
+// helper
+//
+%{
+#include <zypp/base/LogControl.h>
+%}
+%inline %{
+ namespace zypp
+ {
+ void setZyppLogfile( const std::string & file_r )
+ {
+ base::LogControl::instance().logfile( file_r );
+ }
+ }
+%}