Mailinglist Archive: zypp-commit (545 mails)

< Previous Next >
[zypp-commit] r8693 - in /trunk/sat-solver/bindings: ruby/tests/Makefile ruby/tests/providers.rb satsolver.i
  • From: kkaempf@xxxxxxxxxxxxxxxx
  • Date: Thu, 14 Feb 2008 16:45:38 -0000
  • Message-id: <20080214164538.889BA107784@xxxxxxxxxxxxxxxx>
Author: kkaempf
Date: Thu Feb 14 17:45:38 2008
New Revision: 8693

URL: http://svn.opensuse.org/viewcvs/zypp?rev=8693&view=rev
Log:
add 'Pool::each_provider' as a capability iterator

Added:
trunk/sat-solver/bindings/ruby/tests/providers.rb
Modified:
trunk/sat-solver/bindings/ruby/tests/Makefile
trunk/sat-solver/bindings/satsolver.i

Modified: trunk/sat-solver/bindings/ruby/tests/Makefile
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/tests/Makefile?rev=8693&r1=8692&r2=8693&view=diff
==============================================================================
--- trunk/sat-solver/bindings/ruby/tests/Makefile (original)
+++ trunk/sat-solver/bindings/ruby/tests/Makefile Thu Feb 14 17:45:38 2008
@@ -11,6 +11,9 @@

ruby solvable.rb
ruby relation.rb
+ ruby repodata.rb
+
+ ruby providers.rb

ruby transaction.rb
ruby covenants.rb

Added: trunk/sat-solver/bindings/ruby/tests/providers.rb
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/tests/providers.rb?rev=8693&view=auto
==============================================================================
--- trunk/sat-solver/bindings/ruby/tests/providers.rb (added)
+++ trunk/sat-solver/bindings/ruby/tests/providers.rb Thu Feb 14 17:45:38 2008
@@ -0,0 +1,37 @@
+#
+# Check each_provider callback
+#
+
+$:.unshift "../../../build/bindings/ruby"
+
+# test EachProvider
+require 'test/unit'
+require 'satsolver'
+
+class EachProviderTest < Test::Unit::TestCase
+ def test_repo_create
+ pool = SatSolver::Pool.new
+ assert pool
+ pool.arch = "x86_64"
+ repo = pool.add_solv( "10.3-x86_64.solv" )
+ repo.name = "10.3-x86_64"
+ puts "Repo #{repo.name} loaded with #{repo.size} solvables"
+ system = pool.add_rpmdb( "/" )
+ system.name = "@system"
+ puts "Repo #{system.name} loaded with #{system.size} solvables"
+
+ pool.prepare
+
+ puts "Providers of 'ispell_dictionary':"
+ pool.each_provider( "ispell_dictionary" ) { |s|
+ puts " #{s} [#{s.repo.name}]"
+ }
+
+ rel = pool.create_relation( "ispell_english_dictionary",
SatSolver::REL_GT, "3.3.02-23" )
+
+ puts "Providers of #{rel}:"
+ pool.each_provider(rel) { |s|
+ puts " #{s} [#{s.repo.name}]"
+ }
+ end
+end

Modified: trunk/sat-solver/bindings/satsolver.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/satsolver.i?rev=8693&r1=8692&r2=8693&view=diff
==============================================================================
--- trunk/sat-solver/bindings/satsolver.i (original)
+++ trunk/sat-solver/bindings/satsolver.i Thu Feb 14 17:45:38 2008
@@ -451,6 +451,31 @@
}

/*
+ * iterate over providers of relation
+ */
+ void each_provider( Relation *rel )
+ {
+ Id p, *pp;
+ Pool *pool = $self;
+ if (!$self->whatprovides)
+ pool_createwhatprovides( $self );
+
+ FOR_PROVIDES(p, pp, rel->id)
+ generic_xsolvables_iterate_callback( xsolvable_new( $self, p ) );
+ }
+
+ void each_provider( const char *name )
+ {
+ Id p, *pp;
+ Pool *pool = $self;
+ if (!$self->whatprovides)
+ pool_createwhatprovides( $self );
+
+ FOR_PROVIDES(p, pp, str2id( $self, name, 0) )
+ generic_xsolvables_iterate_callback( xsolvable_new( $self, p ) );
+ }
+
+ /*
* Solvable management
*/


--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages