[SCM] Debian package checker branch, master, updated. 2.5.2-110-g71a5b80
The following commit has been merged in the master branch:
commit 71a5b8008f87f79e2a50ee210035e86cfa926018
Author: Dominic Hargreaves <dom@earth.li>
Date: Wed Sep 7 11:43:54 2011 +0200
Added check for usage of perl4 libs
These new checks add the following tags:
- perl-module-uses-perl4-libs-without-dep
- script-uses-perl4-libs-without-dep
Closes: #636994
The orignal patch has been modified to prettify the tag extra, use
relation rather than fields + Lintian::Relation->new() and split the
tests + renamed to fit the test guide lines.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/files b/checks/files
index 22c57f4..039935b 100644
--- a/checks/files
+++ b/checks/files
@@ -813,6 +813,21 @@ foreach my $file (@{$info->sorted_index}) {
unless $is_perl;
}
+ # ---------------- perl modules using old libraries
+ # we do the same check on perl scripts in checks/scripts
+ {
+ my $dep = $info->relation('strong');
+ if ($index_info->{type} =~ m/^[-h]/o && $file =~ m,\.pm$, && !$dep->implies('libperl4-corelibs-perl')) {
+ open (PM, '<', $info->unpacked($file)) or fail("cannot open .pm file: $!");
+ while (<PM>) {
+ if (/(?:do|require)\s+(?:'|")(abbrev|assert|bigfloat|bigint|bigrat|cacheout|complete|ctime|dotsh|exceptions|fastcwd|find|finddepth|flush|getcwd|getopt|getopts|hostname|importenv|look|newgetopt|open2|open3|pwd|shellwords|stat|syslog|tainted|termcap|timelocal|validate)\.pl(?:'|")/) {
+ tag 'perl-module-uses-perl4-libs-without-dep', "$file:$. ${1}.pl";
+ }
+ }
+ close(PM);
+ }
+ }
+
# ---------------- license files
if ($file =~ m,(?:copying|licen[cs]e)(?:\.[^/]+)?$,i
# Ignore some common extensions for source or compiled extension files.
diff --git a/checks/files.desc b/checks/files.desc
index 932bea9..1331a5d 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1295,3 +1295,12 @@ Info: Vim addons should not be installed directly under a directory contained
in the Vim runtime path. Users shall be given the freedom to choose which
addons they want to have enabled and which they don't.
Ref: vim-policy 3.1
+
+Tag: perl-module-uses-perl4-libs-without-dep
+Severity: normal
+Certainty: possible
+Info: This package includes perl modules using obsoleted perl 4-era
+ libraries. These libraries have been deprecated in perl in 5.14, and
+ are likely to be removed from the core in perl 5.16. Please either
+ remove references to these libraries, or add a dependency on
+ <tt>libperl4-corelibs-perl | perl (<< 5.12.3-7)</tt> to this package.
diff --git a/checks/scripts b/checks/scripts
index 0e00823..a58656b 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -338,6 +338,8 @@ for my $field (qw/suggests recommends depends pre-depends provides/) {
$all_deps .= ', ' if $all_deps;
$all_deps .= $pkg;
my $all_parsed = Lintian::Relation->new($all_deps);
+my $str_deps = $info->relation('strong');
+
for my $filename (sort keys %{$info->scripts}) {
my $interpreter = $info->scripts->{$filename}->{interpreter};
@@ -449,6 +451,17 @@ for my $filename (sort keys %{$info->scripts}) {
script_tag('unusual-interpreter', $filename, "#!$interpreter");
}
+ # Check for obsolete perl libraries
+ if ($base eq 'perl' && !$str_deps->implies('libperl4-corelibs-perl')) {
+ open(FH, '<', $path) or fail("could not open script $path");
+ while (<FH>) {
+ if (/(?:do|require)\s+(?:'|")(abbrev|assert|bigfloat|bigint|bigrat|cacheout|complete|ctime|dotsh|exceptions|fastcwd|find|finddepth|flush|getcwd|getopt|getopts|hostname|importenv|look|newgetopt|open2|open3|pwd|shellwords|stat|syslog|tainted|termcap|timelocal|validate)\.pl(?:'|")/) {
+ tag 'script-uses-perl4-libs-without-dep', "$filename:$. ${1}.pl";
+ }
+ }
+ close(FH);
+ }
+
# If we found the interpreter and the script is executable, check
# dependencies. This should be the last thing we do in the loop so that
# we can use next for an early exit and reduce the nesting.
diff --git a/checks/scripts.desc b/checks/scripts.desc
index 10ac00d..113e30c 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -671,3 +671,12 @@ Info: The maintainer script removes a diversion that it didn't add. If
you're cleaning up unnecessary diversions from older versions of the
package, remove them in <tt>preinst</tt> or <tt>postinst</tt> instead of
waiting for <tt>postrm</tt> to do it.
+
+Tag: script-uses-perl4-libs-without-dep
+Severity: normal
+Certainty: possible
+Info: This package includes perl scripts using obsoleted perl 4-era
+ libraries. These libraries have been deprecated in perl in 5.14, and
+ are likely to be removed from the core in perl 5.16. Please either
+ remove references to these libraries, or add a dependency on
+ <tt>libperl4-corelibs-perl | perl (<< 5.12.3-7)</tt> to this package.
diff --git a/debian/changelog b/debian/changelog
index 745ae80..6dcc9c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,7 +15,9 @@ lintian (2.5.3) UNRELEASED; urgency=low
- obsolete-field-in-dep5-copyright
- out-of-date-copyright-format-uri
- package-contains-no-arch-dependent-files
+ - perl-module-uses-perl4-libs-without-dep
- readme-debian-contains-invalid-email-address
+ - script-uses-perl4-libs-without-dep
- syntax-error-in-dep5-copyright
- unknown-copyright-format-uri
- unknown-paragraph-in-dep5-copyright
@@ -93,6 +95,9 @@ lintian (2.5.3) UNRELEASED; urgency=low
(Closes: #640211)
+ [JW] Add check for Vim addons installing files into a directory
within Vim runtime path. (Closes: #640371)
+ + [NT] Added check for Perl modules using perl4 libs without depending
+ on libperl4-core-libs-perl. Thanks to Dominic Hargreaves for the
+ initial patch.
* checks/menus.desc:
+ [NT] Added reference to the doc-base manual to help people
find the list of valid doc-base sections. (Closes: #584280)
@@ -105,6 +110,9 @@ lintian (2.5.3) UNRELEASED; urgency=low
the variable is used as a target). (Closes: #638411)
* checks/scripts{,.desc}:
+ [NT] Remove script-calls-init-script-directly. (Closes: #617959)
+ + [NT] Added check for Perl scripts using perl4 libs without depending
+ on libperl4-core-libs-perl. Thanks to Dominic Hargreaves for the
+ initial patch. (Closes: #636994)
* checks/shared-libs{,.desc}:
+ [JW] Fixed a typo in a tag description. (Closes: #639177)
+ [NT] Do not emit shlib-calls-exit for libraries that have an
diff --git a/t/COVERAGE b/t/COVERAGE
index b2a2f5c..8d84549 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,5 @@
-Last generated 2011-09-04
-Coverage: 719/934 (76.98%), w. legacy tests: 841/934 (90.04%)
+Last generated 2011-09-07
+Coverage: 720/935 (77.01%), w. legacy tests: 842/935 (90.05%)
The following tags are not tested by the test suite:
diff --git a/t/tests/files-uses-perl4-libs-with-dep/debian/Naughty.pm b/t/tests/files-uses-perl4-libs-with-dep/debian/Naughty.pm
new file mode 100644
index 0000000..f4a8c51
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-with-dep/debian/Naughty.pm
@@ -0,0 +1,7 @@
+package Naughty;
+use strict;
+use warnings;
+
+require 'assert.pl';
+
+1;
diff --git a/t/tests/files-uses-perl4-libs-with-dep/debian/debian/control.in b/t/tests/files-uses-perl4-libs-with-dep/debian/debian/control.in
new file mode 100644
index 0000000..426e421
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-with-dep/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}, libperl4-corelibs-perl
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
diff --git a/t/tests/files-uses-perl4-libs-with-dep/debian/debian/install b/t/tests/files-uses-perl4-libs-with-dep/debian/debian/install
new file mode 100644
index 0000000..595d5ed
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-with-dep/debian/debian/install
@@ -0,0 +1 @@
+Naughty.pm usr/share/perl5
diff --git a/t/tests/files-uses-perl4-libs-with-dep/desc b/t/tests/files-uses-perl4-libs-with-dep/desc
new file mode 100644
index 0000000..efae44d
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-with-dep/desc
@@ -0,0 +1,5 @@
+Testname: files-uses-perl4-libs-with-dep
+Sequence: 6000
+Version: 1.0
+Description: Check that script-uses-perl4-libs-without-dep works (negative)
+Test-Against: perl-module-uses-perl4-libs-without-dep
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/files-uses-perl4-libs-with-dep/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/files-uses-perl4-libs-with-dep/tags
diff --git a/t/tests/files-uses-perl4-libs-without-dep/debian/Naughty.pm b/t/tests/files-uses-perl4-libs-without-dep/debian/Naughty.pm
new file mode 100644
index 0000000..f4a8c51
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-without-dep/debian/Naughty.pm
@@ -0,0 +1,7 @@
+package Naughty;
+use strict;
+use warnings;
+
+require 'assert.pl';
+
+1;
diff --git a/t/tests/files-uses-perl4-libs-without-dep/debian/debian/control.in b/t/tests/files-uses-perl4-libs-without-dep/debian/debian/control.in
new file mode 100644
index 0000000..9f42d6b
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-without-dep/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~), perl
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
diff --git a/t/tests/files-uses-perl4-libs-without-dep/debian/debian/install b/t/tests/files-uses-perl4-libs-without-dep/debian/debian/install
new file mode 100644
index 0000000..595d5ed
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-without-dep/debian/debian/install
@@ -0,0 +1 @@
+Naughty.pm usr/share/perl5
diff --git a/t/tests/files-uses-perl4-libs-without-dep/desc b/t/tests/files-uses-perl4-libs-without-dep/desc
new file mode 100644
index 0000000..12d849b
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-without-dep/desc
@@ -0,0 +1,5 @@
+Testname: files-uses-perl4-libs-without-dep
+Sequence: 6000
+Version: 1.0
+Description: Check that script-uses-perl4-libs-without-dep works (positive)
+Test-For: perl-module-uses-perl4-libs-without-dep
diff --git a/t/tests/files-uses-perl4-libs-without-dep/tags b/t/tests/files-uses-perl4-libs-without-dep/tags
new file mode 100644
index 0000000..46568a2
--- /dev/null
+++ b/t/tests/files-uses-perl4-libs-without-dep/tags
@@ -0,0 +1 @@
+W: files-uses-perl4-libs-without-dep: perl-module-uses-perl4-libs-without-dep usr/share/perl5/Naughty.pm:5 assert.pl
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/debian/Makefile b/t/tests/scripts-uses-perl4-libs-with-dep/debian/Makefile
new file mode 100644
index 0000000..a7ddd36
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/debian/Makefile
@@ -0,0 +1,7 @@
+all: naughty-script.1
+
+%.1: %
+ pod2man --section 1 "$<" > "$@"
+
+clean:
+ rm -f naughty-script.1
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/control.in b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/control.in
new file mode 100644
index 0000000..c5d2e1c
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~), perl
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}, libperl4-corelibs-perl
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/install b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/install
new file mode 100644
index 0000000..1cd0e18
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/install
@@ -0,0 +1 @@
+naughty-script usr/bin
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/manpages b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/manpages
new file mode 100644
index 0000000..36ff204
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/debian/debian/manpages
@@ -0,0 +1 @@
+naughty-script.1
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/debian/naughty-script b/t/tests/scripts-uses-perl4-libs-with-dep/debian/naughty-script
new file mode 100644
index 0000000..50f342e
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/debian/naughty-script
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+naughty-script -- uses obsolete perl4 libs
+
+=head1 SYNOPSIS
+
+ naught-script
+
+=head1 DESCRIPTION
+
+This manpage is present to avoid a "binary-without-manpage" warning. :)
+
+=cut
+
+use strict;
+use warnings;
+
+do 'newgetopt.pl';
+
+NGetOpt();
diff --git a/t/tests/scripts-uses-perl4-libs-with-dep/desc b/t/tests/scripts-uses-perl4-libs-with-dep/desc
new file mode 100644
index 0000000..0ce604b
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-with-dep/desc
@@ -0,0 +1,5 @@
+Testname: scripts-uses-perl4-libs-with-dep
+Sequence: 6000
+Version: 1.0
+Description: Check that script-uses-perl4-libs-without-dep works (negative)
+Test-Against: script-uses-perl4-libs-without-dep
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/scripts-uses-perl4-libs-with-dep/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/scripts-uses-perl4-libs-with-dep/tags
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/debian/Makefile b/t/tests/scripts-uses-perl4-libs-without-dep/debian/Makefile
new file mode 100644
index 0000000..a7ddd36
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/debian/Makefile
@@ -0,0 +1,7 @@
+all: naughty-script.1
+
+%.1: %
+ pod2man --section 1 "$<" > "$@"
+
+clean:
+ rm -f naughty-script.1
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/control.in b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/control.in
new file mode 100644
index 0000000..9f42d6b
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~), perl
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian. It is part of the Lintian test suite and may do very odd
+ things. It should not be installed like a regular package. It may
+ be an empty package.
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/install b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/install
new file mode 100644
index 0000000..1cd0e18
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/install
@@ -0,0 +1 @@
+naughty-script usr/bin
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/manpages b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/manpages
new file mode 100644
index 0000000..36ff204
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/debian/debian/manpages
@@ -0,0 +1 @@
+naughty-script.1
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/debian/naughty-script b/t/tests/scripts-uses-perl4-libs-without-dep/debian/naughty-script
new file mode 100644
index 0000000..50f342e
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/debian/naughty-script
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+naughty-script -- uses obsolete perl4 libs
+
+=head1 SYNOPSIS
+
+ naught-script
+
+=head1 DESCRIPTION
+
+This manpage is present to avoid a "binary-without-manpage" warning. :)
+
+=cut
+
+use strict;
+use warnings;
+
+do 'newgetopt.pl';
+
+NGetOpt();
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/desc b/t/tests/scripts-uses-perl4-libs-without-dep/desc
new file mode 100644
index 0000000..3e7b957
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/desc
@@ -0,0 +1,5 @@
+Testname: scripts-uses-perl4-libs-without-dep
+Sequence: 6000
+Version: 1.0
+Description: Check that script-uses-perl4-libs-without-dep works (positive)
+Test-For: script-uses-perl4-libs-without-dep
diff --git a/t/tests/scripts-uses-perl4-libs-without-dep/tags b/t/tests/scripts-uses-perl4-libs-without-dep/tags
new file mode 100644
index 0000000..1e94f40
--- /dev/null
+++ b/t/tests/scripts-uses-perl4-libs-without-dep/tags
@@ -0,0 +1 @@
+W: scripts-uses-perl4-libs-without-dep: script-uses-perl4-libs-without-dep usr/bin/naughty-script:20 newgetopt.pl
--
Debian package checker
Reply to: