2014-02-22 8:09 GMT+01:00 Niels Thykier <ni...@thykier.net>: > > Hi,
Hi Niels, > The result is "unordered" because it is the result of a "keys %{...}" > operation and the order of hash keys are "undefined" in Perl (between > runs at least). It would be simple to get a "defined" order by simply > sorting the keys before returning, but I guess you want the order from > the d/control file? > > To do that you would need to patch _load_ctrl to store a reference to > @control_data on $self and then fetch/use that from from the "binaries" > sub. The return-statement would become something like: > return @{ self->{...} }; Thanks for your pointer. I attached a patch following your advice. Regards -- Mathieu
From 77533593dd983ae85baa6874ec6be1d0f1f9a214 Mon Sep 17 00:00:00 2001 From: Mathieu Parent <math.par...@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..4d023ec 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