blob: de09ba41d2f9a04b44abcd41354fee688e6aa409 (
plain)
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
|
package Iurt::RPM;
use base qw(Exporter);
use RPM4::Header;
use MDK::Common;
use strict;
our @EXPORT = qw(
check_arch
check_noarch
);
sub check_noarch {
my ($rpm) = @_;
my $hdr = RPM4::Header->new($rpm);
# Stupid rpm doesn't return an empty list so we must check for (none)
my ($build_archs) = $hdr->queryformat('%{BUILDARCHS}');
if ($build_archs ne '(none)') {
($build_archs) = $hdr->queryformat('[%{BUILDARCHS} ]');
my @list = split ' ', $build_archs;
return 1 if member('noarch', @list);
}
return 0;
}
sub check_arch {
my ($rpm, $arch) = @_;
my $hdr = RPM4::Header->new($rpm);
# Stupid rpm doesn't return an empty list so we must check for (none)
my ($exclusive_arch) = $hdr->queryformat('%{EXCLUSIVEARCH}');
if ($exclusive_arch ne '(none)') {
($exclusive_arch) = $hdr->queryformat('[%{EXCLUSIVEARCH} ]');
my @list = split ' ', $exclusive_arch;
return 0 unless member($arch, @list);
}
my ($exclude_arch) = $hdr->queryformat('[%{EXCLUDEARCH} ]');
if ($exclude_arch ne '(none)') {
($exclude_arch) = $hdr->queryformat('[%{EXCLUDEARCH} ]');
my @list = split ' ', $exclude_arch;
return 0 if member($arch, @list);
}
return 1;
}
1;
|