1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
package Youri::Submit::Check::Deps;
=head1 NAME
Youri::Submit::Check::Deps - Check dependencies
=head1 DESCRIPTION
This check plugin rejects packages with unresolved dependencies.
=cut
use warnings;
use strict;
use Carp;
use Youri::Media::URPM;
use base qw/Youri::Submit::Check/;
sub resolvedep {
my ($media, @requires) = @_;
my @errors;
my $index = sub {
my ($package) = @_;
my @provides = $package->get_provides();
@requires = grep {
my $require = $_;
my $notfound = 1;
foreach my $provide (@provides) {
next unless $provide->[Youri::Package::DEPENDENCY_NAME] eq $require->[Youri::Package::DEPENDENCY_NAME];
if ($require->[Youri::Package::DEPENDENCY_RANGE]) {
next unless $package->check_ranges_compatibility($provide->[Youri::Package::DEPENDENCY_RANGE], $require->[Youri::Package::DEPENDENCY_RANGE]);
}
$notfound = 0;
}
if ($notfound && $require->[Youri::Package::DEPENDENCY_NAME] =~ m|/|) {
foreach my $file ($package->get_files()) {
next unless $file eq $require->[Youri::Package::DEPENDENCY_NAME];
$notfound = 0;
last;
}
}
$notfound;
} @requires;
};
$media->traverse_headers($index);
foreach my $require (@requires) {
push (@errors, "Unresolved dep on " . $require->[Youri::Package::DEPENDENCY_NAME] . " " . $require->[Youri::Package::DEPENDENCY_RANGE]);
}
return @errors;
}
sub run {
my ($self, $package, $repository, $target, $define) = @_;
croak "Not a class method" unless ref $self;
# FIXME Define some Youri::Media with allowed_deps in the config and
# match target + section to a media
my $section = $repository->_get_section($package, $target, $define);
return unless $target eq "cauldron" && $section eq 'core/release';
my @requires = $package->get_requires();
my $path = $repository->get_install_root() . "/" . $target;
# FIXME we need dependencies on all archs except for ExclusiveArch
# Unfortunately some dependencies depend on the arch were the src.rpm was geenrated
# Currently src.rpm is generated on x86_64, so we need to check on that one
# If the package is not buildable on x86_64 we just don't test anything
my $arch = 'x86_64';
my @exclusivearchs = $package->get_tag("exclusivearchs");
return if @exclusivearchs && ! (grep {$_ eq $arch} @exclusivearchs);
# foreach my $arch ($repository->get_extra_arches()) {
my $media = new Youri::Media::URPM(name => "core.".$arch,
type => "binary",
hdlist => "$path/$arch/media/$section/media_info/hdlist.cz");
return resolvedep($media, @requires);
# }
}
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2011, YOURI project
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=cut
1;
|