aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2012-09-29 18:35:39 +0000
committerNicolas Vigier <boklm@mageia.org>2012-09-29 18:35:39 +0000
commit0282114cf208a3705ff47ced4744c62bb452aacb (patch)
tree0552b6fcfba4e9256d0464e9de77df4f81118067
parent308318092d308b42c60dd7c40ffd6d439c0a669b (diff)
downloadmga-youri-submit-0282114cf208a3705ff47ced4744c62bb452aacb.tar
mga-youri-submit-0282114cf208a3705ff47ced4744c62bb452aacb.tar.gz
mga-youri-submit-0282114cf208a3705ff47ced4744c62bb452aacb.tar.bz2
mga-youri-submit-0282114cf208a3705ff47ced4744c62bb452aacb.tar.xz
mga-youri-submit-0282114cf208a3705ff47ced4744c62bb452aacb.zip
Use target specific options if available
-rw-r--r--lib/Youri/Submit/Check/Rpmlint.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Youri/Submit/Check/Rpmlint.pm b/lib/Youri/Submit/Check/Rpmlint.pm
index a58e283..f56ba0e 100644
--- a/lib/Youri/Submit/Check/Rpmlint.pm
+++ b/lib/Youri/Submit/Check/Rpmlint.pm
@@ -1,4 +1,4 @@
-# $Id$
+# $Id: Rpmlint.pm 234384 2008-02-12 09:42:32Z blino $
package Youri::Submit::Check::Rpmlint;
=head1 NAME
@@ -51,12 +51,11 @@ sub _init {
@_
);
- croak "no results to check" unless $options{results};
- croak "fatal should be an arrayref" unless ref $options{results} eq 'ARRAY';
- $self->{_config} = $options{config};
- $self->{_path} = $options{path};
- $self->{_pattern} = '^(?:' . join('|', @{$options{results}}) . ')$';
+ $self->{opt} = sub {
+ my ($name, $target) = @_;
+ (exists $options{$target}->{$name}) ? $options{$target}->{$name} : $options{$name};
+ };
}
sub run {
@@ -65,6 +64,12 @@ sub run {
my @errors;
+ my $results = $self->{opt}->('results', $_target);
+ croak "no results to check" unless $results;
+ croak "fatal should be an arrayref" unless ref $results eq 'ARRAY';
+ $self->{_config} = $self->{opt}->('config', $_target);
+ $self->{_path} = $self->{opt}->('path', $_target);
+ $self->{_pattern} = '^(?:' . join('|', @$results) . ')$';
my $command = "$self->{_path} -f $self->{_config} " . $package->as_file;
open(my $RPMLINT, "$command |") or die "Can't run $command: $!";
while (my $line = <$RPMLINT>) {