aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2020-03-15 23:14:52 +0000
committerPascal Terjan <pterjan@mageia.org>2020-03-15 23:16:33 +0000
commitd1617f868b16a297a9644b86b00889b954b450f1 (patch)
tree9b319a3b2551aabc3e6c7eb779ad5593959cf86a /lib/Iurt
parent6511f894ab99f9036505ba315834d2470569c6b9 (diff)
downloadiurt-d1617f868b16a297a9644b86b00889b954b450f1.tar
iurt-d1617f868b16a297a9644b86b00889b954b450f1.tar.gz
iurt-d1617f868b16a297a9644b86b00889b954b450f1.tar.bz2
iurt-d1617f868b16a297a9644b86b00889b954b450f1.tar.xz
iurt-d1617f868b16a297a9644b86b00889b954b450f1.zip
Move check_{no,}arch to a new RPM module
They have nothing to do with the config and work on an RPM file.
Diffstat (limited to 'lib/Iurt')
-rw-r--r--lib/Iurt/Config.pm45
-rw-r--r--lib/Iurt/RPM.pm55
2 files changed, 55 insertions, 45 deletions
diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm
index 1600e5b..3b8bbe1 100644
--- a/lib/Iurt/Config.pm
+++ b/lib/Iurt/Config.pm
@@ -1,7 +1,6 @@
package Iurt::Config;
use base qw(Exporter);
-use RPM4::Header;
use Data::Dumper;
use MDK::Common;
use Iurt::Util qw(plog);
@@ -17,8 +16,6 @@ our @EXPORT = qw(
get_date
get_prefix
get_author_email
- check_arch
- check_noarch
get_package_prefix
get_mandatory_arch
get_target_arch
@@ -149,48 +146,6 @@ sub get_author_email {
return $authoremail;
}
-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;
-}
-
sub get_mandatory_arch {
my ($config, $target) = @_;
find { ref($_) eq 'ARRAY' } $config->{mandatory_arch},
diff --git a/lib/Iurt/RPM.pm b/lib/Iurt/RPM.pm
new file mode 100644
index 0000000..de09ba4
--- /dev/null
+++ b/lib/Iurt/RPM.pm
@@ -0,0 +1,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;