![](https://seccdn.libravatar.org/avatar/eb2ff594a217acb7dff96eaafa6c848c.jpg?s=120&d=mm&r=g)
Author: kkaempf Date: Thu Nov 20 20:43:25 2008 New Revision: 11757 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11757&view=rev Log: Perl testcase for solvable.identical() Added: trunk/sat-solver/bindings/perl/tests/identical.pl Added: trunk/sat-solver/bindings/perl/tests/identical.pl URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/perl/tests/identical.pl?rev=11757&view=auto ============================================================================== --- trunk/sat-solver/bindings/perl/tests/identical.pl (added) +++ trunk/sat-solver/bindings/perl/tests/identical.pl Thu Nov 20 20:43:25 2008 @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +# +# providers.pl +# +# Test iterating over provider of name or relation +# +# + +use lib '../../../build/bindings/perl'; + +use satsolver; + +# Open Solvable file +# open(F, "gzip -cd tmp/primary.gz |") || die; + +# Create Pool and Repository +my $pool = new satsolver::Pool; +# use x86_64, as this will consider both x86_64 and i?86 packages +$pool->set_arch( 'x86_64' ); +my $repo1 = $pool->create_repo('test_x86_64') || die; + +# Add Solvable to Repository +$repo1->add_solv ("../../testdata/os11-beta5-x86_64.solv"); + +# Create another Repository +my $repo2 = $pool->create_repo('test_biarch') || die; + +# Add Solvable to Repository +$repo2->add_solv ("../../testdata/os11-biarch.solv"); + +# Create dependencies to provides table +$pool->prepare(); + +# Print how much we have +print "\"" . $repo1->name() . "\" size: " . $repo1->size() . "\n"; +print "\"" . $repo2->name() . "\" size: " . $repo2->size() . "\n"; + +# Find a Solvable in the x86_64 Repo +my $solvname = "aaa_base"; +my $solvable1 = $repo1->find($solvname); +die if not defined $solvable1; + +print "\n" . $repo1->name() . ": found: " . $solvable1->string() . "\n"; + +# Find Providers of this Solvable in the biarch Repo +print "\nFinding providers in the biarch repo for $solvname\n"; +foreach my $solvable2 ($pool->providers($solvname)) { + print "--\n"; + next if not defined $solvable2; + + if ($solvable1->identical($solvable2)) { + printf("identical: %s and %s\n", + $solvable1->string(), + $solvable2->string()); + } else { + printf("different: %s and %s\n", + $solvable1->string(), + $solvable2->string()); + } +} -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org