Bug#636994: lintian: add check for deprecated perl libraries
On 2011-08-14 18:58, Dominic Hargreaves wrote:
> tags 636994 +patch
> thanks
>
> On Sun, Aug 07, 2011 at 05:11:51PM +0100, Dominic Hargreaves wrote:
>> [...]
>
> Okay, I had a stab at implementing this. It involved a lot of guesswork
> and cargo-culting, but it appears to work. Patch attached. Please do
> let me know if I can do anything to improve the patch.
>
> Cheers,
> Dominic.
>
Hi,
Thanks for the patch and sorry if it has been difficult to get an
overview of how the whole machinery. :)
I got two issues with the patch; first off, the return value from open
is not (always) checked. The second issue is that there are no checks
for symlinks (possible exception being checks/scripts, I cannot remember
the context).
With the latter, we probably still have a couple of cases in other
checks, where it fails to do that as well. So if you copy-pasted this
from somewhere, let me know and I will fix that part as well[1].
For this particular check, I would personally just skip symlinks,
since whatever they point to ought to be picked up anyway.
There is no need to introduce a collection just to "pick" .pm files.
Either add it to checks/files (finding the right place can be tricky
though) or rewrite the collection to open the scripts and modules and
write what they do/require/use. The check can then be simplified to
check that, this approach would also make it easier to check for other
deprecated modules later. :)
We can start with the simple approach you use now and modify it later
if you are more comfortable with that. :)
Other comments:
[checks/perl_modules]
"""
+#
+# This is probably the right file to add a check for the use of
+# set -e in bash and sh scripts.
+#
"""
Copy/waste error? :)
[checks/perl_modules]
"""
+foreach (@{$info->sorted_index}) {
+ next if $_ eq '';
+ my $index_info = $info->index->{$_};
+ my $operm = $index_info->{operm};
+ next unless ($index_info->{type} =~ m,^[-h], and ($operm & 01 or
+ $operm & 010 or $operm & 0100));
+}
"""
I am missing something here or is this just a no-op?
[checks/perl_modules]
"""
+my $all_deps = '';
+for my $field (qw/suggests recommends depends pre-depends provides/) {
+ if (defined $info->field($field)) {
+ $all_deps .= ', ' if $all_deps;
+ $all_deps .= $info->field($field);
+ }
+}
+$all_deps .= ', ' if $all_deps;
+$all_deps .= $pkg;
+my $all_parsed = Lintian::Relation->new($all_deps);
"""
Looks to me like a:
"""
my $all_parsed = $info->relation('all');
"""
($info is a Lintian::Collect::Binary in this case)
[checks/perl_modules.desc]
"""
Needs-Info: unpacked, file-info, perl_modules, bin-pkg-control, fields,
index
"""
To me it only looks like unpacked, perl_modules and index are used[2].
And the latter (as far as I can tell) only in the (possible) no-op loop
above.
~Niels
[1] On a related note, I am looking at making a better API to make
symlink handling easier.
[2] collections/fields was deprecated in 2.5.2 (did nothing) and has
been removed on the master branch. :) Unfortunately I failed to
properly clean up the Lintian::Collect API, so some of them still claim
to be using it in 2.5.2.
Reply to: