[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#739671: phppear check randomly checks one binary



2014-02-22 18:42 GMT+01:00 Niels Thykier <niels@thykier.net>:
[...]

Hi,

Thanks for your review.

>>
>> +    $self->{binary_names} = ();
>
> I think you need to use "[]" instead of "()" here (to get a list ref)

[...]
>> +        push $self->{binary_names}, $pkg;
>
> Likewise, you need "push(@{$self->{binary_names} }, $pkg);" here.
>
> Technically, I believe this one will work with "very recent" versions of
> Perl (possibly as an experimental feature), but I doubt it works with
> the version in stable.
>
>>      }
>>      $self->{binary_field} = \%packages;
>
> Alternatively, I believe you can replace those two lines with:
>       $self->{binary_names} = \@control_data;

I've implemented the first solution. See attachment.

Regads
-- 
Mathieu Parneet
From 5dcdec67d92988600c7f96947816c3151557c6b0 Mon Sep 17 00:00:00 2001
From: Mathieu Parent <math.parent@gmail.com>
Date: Sat, 22 Feb 2014 17:39:04 +0100
Subject: [PATCH] Ensure Lintian::Collect::Source::binaries are ordered

This is needed by the phppear check to get the main (i.e. the first) package.

Closes: #739671
---
 lib/Lintian/Collect/Source.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index e468a15..9f20922 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -191,8 +191,8 @@ Needs-Info requirements for using I<binaries>: L<Same as binary_package_type|/bi
 sub binaries {
     my ($self) = @_;
     # binary_package_type does all the work for us.
-    $self->binary_package_type('') unless exists $self->{binaries};
-    return keys %{ $self->{binaries} };
+    $self->_load_dctrl unless exists $self->{binary_names};
+    return @{ $self->{binary_names} };
 }
 
 =item binary_package_type (BINARY)
@@ -369,6 +369,7 @@ sub _load_dctrl {
         $ok = 1 if -e $dctrl;
     }
 
+    $self->{binary_names} = [];
     unless ($ok) {
         # Bad file, assume the package and field does not exist.
         $self->{binary_field} = {};
@@ -396,6 +397,7 @@ sub _load_dctrl {
         my $pkg = $binary->{'package'};
         next unless defined($pkg) and $pkg =~ m{\A $PKGNAME_REGEX \Z}xsmo;
         $packages{$pkg} = $binary;
+        push(@{$self->{binary_names} }, $pkg);
     }
     $self->{binary_field} = \%packages;
 
-- 
1.8.5.3


Reply to: