[zypp-devel] [PATCH] Perl satsolver bindings: testing identical()
Here is a Perl test script for the identical() function in the bindings. --- /dev/null 2007-09-21 21:12:45.000000000 +0200 +++ bindings/perl/tests/identical.pl 2008-11-20 20:11:25.000000000 +0100 @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +# +# providers.pl +# +# Test the identical() function +# +# + +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()); + } +} -- Olaf Dabrunz (od/odabrunz) SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (1)
-
Olaf Dabrunz