5 use Test
::Simple tests
=> 2;
7 use Fedora
::Rebuild
::Solver
;
8 use Fedora
::Rebuild
::Set
::Package
;
9 use Fedora
::Rebuild
::Package
;
10 use Fedora
::Rebuild
::RPM
;
16 # Create and return package.
18 my ($name, $provides, $runrequires, $buildrequires) = @_;
20 my $package = Fedora
::Rebuild
::Package
->new(
28 $package->provides(shared_clone
($provides));
29 $package->runrequires(shared_clone
($runrequires));
30 $package->requires(shared_clone
($buildrequires));
41 my $perl_DBI = build_package
(
45 { 'perl(ExtUtils::MakeMaker)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
48 my $perl = build_package
(
51 '0:perl-ExtUtils-MakeMaker-6.56-162.fc16' => {
52 'perl(ExtUtils::MakeMaker)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']]
54 '4:perl-5.12.3-162.fc16' => {
55 'perl(strict)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']]
57 '0:perl-PathTools-3.31-162.fc16' => {
58 'perl(File::Spec::Unix)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']],
59 'perl(File::Spec)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']],
63 '0:perl-ExtUtils-MakeMaker-6.56-162.fc16' => {
64 'perl(strict)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']]
66 '4:perl-5.12.3-162.fc16' => {
67 'perl(File::Spec::Unix)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']]
69 '0:perl-PathTools-3.31-162.fc16' => {
70 'perl(File::Spec)' => [[Fedora
::Rebuild
::RPM
::ANY
, '']]
76 my $packages = Fedora
::Rebuild
::Set
::Package
->new();
77 $packages->insert($perl);
79 my $solver = Fedora
::Rebuild
::Solver
->new(packages
=> $packages);
81 ok
($solver->is_buildable($perl_DBI, \
$message),
82 "perl-DBI build-requires perl-ExtUtils-MakeMaker " .
83 "that is satisfied by perl " .
84 "that is satisfied by perl-PathTools " .
85 "that requires different symbol provided by perl-PathTool again: $message");
89 # Load hashe fo $what for package $name.
91 my ($name, $what) = @_;
92 my $store = 't/regression1';
94 my $file = File
::Spec
->catfile($store, $name . '-' . $what . '.store');
96 return retrieve
($file);
102 # Create and return package. Populate dependencies from files.
103 sub build_package_from_store
{
106 return build_package
(
108 load_hash
($name, 'provides'),
109 load_hash
($name, 'runrequires'),
110 load_hash
($name, 'buildrequires')
114 my $perl = build_package_from_store
('perl');
115 my $perl_Test_Simple = build_package_from_store
('perl-Test-Simple');
116 my $perl_Test_Pod = build_package_from_store
('perl-Test-Pod');
117 my $perl_Crypt_CBC = build_package_from_store
('perl-Crypt-CBC');
118 my $perl_Crypt_DES = build_package_from_store
('perl-Crypt-DES');
119 my $perl_Net_Daemon = build_package_from_store
('perl-Net-Daemon');
120 my $perl_PlRPC = build_package_from_store
('perl-PlRPC');
121 my $perl_DBI = build_package_from_store
('perl-DBI');
123 my $packages = Fedora
::Rebuild
::Set
::Package
->new();
124 $packages->insert($perl);
125 $packages->insert($perl_Test_Simple);
126 $packages->insert($perl_Test_Pod);
127 $packages->insert($perl_Crypt_CBC);
128 $packages->insert($perl_Crypt_DES);
130 my $solver = Fedora
::Rebuild
::Solver
->new(
131 packages
=> $packages,
132 dependencyfilter
=> sub {
133 $_[0] !~ /^\s*perl\(/ or
134 $_[0] =~ /^\s*perl\(:MODULE_COMPAT/;
138 #ok($solver->is_buildable($perl_DBI, \$message),
139 # "perl-DBI build-requires perl-ExtUtils-MakeMaker " .
140 # "that is satisfied by perl: $message");
141 ok
($solver->is_buildable($perl_Net_Daemon, \
$message),
142 "perl-Net-Daemon: $message");