From 0282114cf208a3705ff47ced4744c62bb452aacb Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Sat, 29 Sep 2012 18:35:39 +0000 Subject: Use target specific options if available --- lib/Youri/Submit/Check/Rpmlint.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib') 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>) { -- cgit v1.2.1