Author: kkaempf Date: Tue Oct 21 11:33:39 2008 New Revision: 11426 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11426&view=rev Log: - enable pool.search - work around missing consistency in dataiterator_init - search tests for Ruby Modified: trunk/sat-solver/bindings/pool.i trunk/sat-solver/bindings/repo.i trunk/sat-solver/bindings/ruby/tests/search.rb Modified: trunk/sat-solver/bindings/pool.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/pool.i?rev=11426&r1=11425&r2=11426&view=diff ============================================================================== --- trunk/sat-solver/bindings/pool.i (original) +++ trunk/sat-solver/bindings/pool.i Tue Oct 21 11:33:39 2008 @@ -296,6 +296,18 @@ XSolvable *find( char *name, Repo *repo = NULL ) { return xsolvable_find( $self, name, repo ); } + /* + * Dataiterator - find solvables by their attributes + */ +#if defined(SWIGPYTHON) + %pythoncode %{ + def search(self, match, flags, solvable = None, keyname = None): + d = Dataiterator(self, None, match, flags, solvable, keyname) + while d.step(): + yield d + %} +#endif + /************************** * Transaction management */ Modified: trunk/sat-solver/bindings/repo.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/repo.i?rev=11426&r1=11425&r2=11426&view=diff ============================================================================== --- trunk/sat-solver/bindings/repo.i (original) +++ trunk/sat-solver/bindings/repo.i Tue Oct 21 11:33:39 2008 @@ -163,7 +163,7 @@ #if defined(SWIGPYTHON) %pythoncode %{ def search(self, match, flags, solvable = None, keyname = None): - d = Dataiterator(self,match,flags, solvable, keyname) + d = Dataiterator(self.pool(), self, match, flags, solvable, keyname) while d.step(): yield d %} Modified: trunk/sat-solver/bindings/ruby/tests/search.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/tests/search.rb?rev=11426&r1=11425&r2=11426&view=diff ============================================================================== --- trunk/sat-solver/bindings/ruby/tests/search.rb (original) +++ trunk/sat-solver/bindings/ruby/tests/search.rb Tue Oct 21 11:33:39 2008 @@ -10,6 +10,34 @@ require 'satsolver' class RepodataTest < Test::Unit::TestCase + # + # Pool search + # + def test_pool_search + pool = Satsolver::Pool.new + assert pool + pool.arch = "x86_64" + repo = pool.add_solv( Pathname( File.dirname( __FILE__ ) ) + "os11-biarch.solv" ) + repo.name = "openSUSE 11.0 Beta3 BiArch" + puts "Repo #{repo.name} loaded with #{repo.size} solvables" + + for d in pool.search("yast2", satsolver.SEARCH_STRING): + print d.solvable(), "matches 'yast2' in ", d.key(), ": ", d.value() + assert True + + def test_pool_search_files(self): + pool = satsolver.Pool() + assert pool + pool.set_arch("i686") + repo = pool.add_solv( "os11-biarch.solv" ) + repo.set_name("test") + for d in pool.search("/usr/bin/python", satsolver.SEARCH_STRING|satsolver.SEARCH_FILES): + print d.solvable(), "matches '/usr/bin/python' in ", d.key(), ": ", d.value() + assert True + + # + # Repo search + # def test_repo_search pool = Satsolver::Pool.new assert pool -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org