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

[SCM] Debian package checker branch, master, updated. 2.5.13-24-g5a0d5b1



The following commit has been merged in the master branch:
commit 5a0d5b14df6b7ca13c42cae28d159d0502b5cf3e
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Jun 13 14:56:35 2013 +0200

    checks: Rename all checks to include a ".pm" extension
    
    Extensionless checks will still be loaded but will cause a deprecation
    warning.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/apache2 b/checks/apache2.pm
similarity index 100%
rename from checks/apache2
rename to checks/apache2.pm
diff --git a/checks/binaries b/checks/binaries.pm
similarity index 100%
rename from checks/binaries
rename to checks/binaries.pm
diff --git a/checks/changelog-file b/checks/changelog-file.pm
similarity index 100%
rename from checks/changelog-file
rename to checks/changelog-file.pm
diff --git a/checks/changes-file b/checks/changes-file.pm
similarity index 100%
rename from checks/changes-file
rename to checks/changes-file.pm
diff --git a/checks/conffiles b/checks/conffiles.pm
similarity index 100%
rename from checks/conffiles
rename to checks/conffiles.pm
diff --git a/checks/control-file b/checks/control-file.pm
similarity index 100%
rename from checks/control-file
rename to checks/control-file.pm
diff --git a/checks/control-files b/checks/control-files.pm
similarity index 100%
rename from checks/control-files
rename to checks/control-files.pm
diff --git a/checks/copyright-file b/checks/copyright-file.pm
similarity index 100%
rename from checks/copyright-file
rename to checks/copyright-file.pm
diff --git a/checks/cruft b/checks/cruft.pm
similarity index 100%
rename from checks/cruft
rename to checks/cruft.pm
diff --git a/checks/deb-format b/checks/deb-format.pm
similarity index 100%
rename from checks/deb-format
rename to checks/deb-format.pm
diff --git a/checks/debconf b/checks/debconf.pm
similarity index 100%
rename from checks/debconf
rename to checks/debconf.pm
diff --git a/checks/debhelper b/checks/debhelper.pm
similarity index 100%
rename from checks/debhelper
rename to checks/debhelper.pm
diff --git a/checks/debian-readme b/checks/debian-readme.pm
similarity index 100%
rename from checks/debian-readme
rename to checks/debian-readme.pm
diff --git a/checks/debian-source-dir b/checks/debian-source-dir.pm
similarity index 100%
rename from checks/debian-source-dir
rename to checks/debian-source-dir.pm
diff --git a/checks/description b/checks/description.pm
similarity index 100%
rename from checks/description
rename to checks/description.pm
diff --git a/checks/duplicate-files b/checks/duplicate-files.pm
similarity index 100%
rename from checks/duplicate-files
rename to checks/duplicate-files.pm
diff --git a/checks/fields b/checks/fields.pm
similarity index 100%
rename from checks/fields
rename to checks/fields.pm
diff --git a/checks/filename-length b/checks/filename-length.pm
similarity index 100%
rename from checks/filename-length
rename to checks/filename-length.pm
diff --git a/checks/files b/checks/files.pm
similarity index 100%
rename from checks/files
rename to checks/files.pm
diff --git a/checks/group-checks b/checks/group-checks.pm
similarity index 100%
rename from checks/group-checks
rename to checks/group-checks.pm
diff --git a/checks/huge-usr-share b/checks/huge-usr-share.pm
similarity index 100%
rename from checks/huge-usr-share
rename to checks/huge-usr-share.pm
diff --git a/checks/infofiles b/checks/infofiles.pm
similarity index 100%
rename from checks/infofiles
rename to checks/infofiles.pm
diff --git a/checks/init.d b/checks/init.d.pm
similarity index 100%
rename from checks/init.d
rename to checks/init.d.pm
diff --git a/checks/java b/checks/java.pm
similarity index 100%
rename from checks/java
rename to checks/java.pm
diff --git a/checks/manpages b/checks/manpages.pm
similarity index 100%
rename from checks/manpages
rename to checks/manpages.pm
diff --git a/checks/md5sums b/checks/md5sums.pm
similarity index 100%
rename from checks/md5sums
rename to checks/md5sums.pm
diff --git a/checks/menu-format b/checks/menu-format.pm
similarity index 100%
rename from checks/menu-format
rename to checks/menu-format.pm
diff --git a/checks/menus b/checks/menus.pm
similarity index 100%
rename from checks/menus
rename to checks/menus.pm
diff --git a/checks/nmu b/checks/nmu.pm
similarity index 100%
rename from checks/nmu
rename to checks/nmu.pm
diff --git a/checks/ocaml b/checks/ocaml.pm
similarity index 100%
rename from checks/ocaml
rename to checks/ocaml.pm
diff --git a/checks/patch-systems b/checks/patch-systems.pm
similarity index 100%
rename from checks/patch-systems
rename to checks/patch-systems.pm
diff --git a/checks/po-debconf b/checks/po-debconf.pm
similarity index 100%
rename from checks/po-debconf
rename to checks/po-debconf.pm
diff --git a/checks/rules b/checks/rules.pm
similarity index 100%
rename from checks/rules
rename to checks/rules.pm
diff --git a/checks/scripts b/checks/scripts.pm
similarity index 100%
rename from checks/scripts
rename to checks/scripts.pm
diff --git a/checks/shared-libs b/checks/shared-libs.pm
similarity index 100%
rename from checks/shared-libs
rename to checks/shared-libs.pm
diff --git a/checks/source-copyright b/checks/source-copyright.pm
similarity index 100%
rename from checks/source-copyright
rename to checks/source-copyright.pm
diff --git a/checks/standards-version b/checks/standards-version.pm
similarity index 100%
rename from checks/standards-version
rename to checks/standards-version.pm
diff --git a/checks/symlinks b/checks/symlinks.pm
similarity index 100%
rename from checks/symlinks
rename to checks/symlinks.pm
diff --git a/checks/testsuite b/checks/testsuite.pm
similarity index 100%
rename from checks/testsuite
rename to checks/testsuite.pm
diff --git a/checks/version-substvars b/checks/version-substvars.pm
similarity index 100%
rename from checks/version-substvars
rename to checks/version-substvars.pm
diff --git a/checks/watch-file b/checks/watch-file.pm
similarity index 100%
rename from checks/watch-file
rename to checks/watch-file.pm
diff --git a/debian/changelog b/debian/changelog
index 8fd40ac..47139a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 lintian (2.5.14) UNRELEASED; urgency=low
 
-  * checks/cruft:
+  * checks/*:
+    + [NT] Rename all checks to include the extension ".pm".
+      (Closes: #710405)
+  * checks/cruft.pm:
     + [NT] Revise a few tests that relied on file(1) on text files.
     + [NT] Apply patches from Bastien Roucariès to fix some false
       positives in the GDFL related checks.  (Closes: #711119)
@@ -21,6 +24,9 @@ lintian (2.5.14) UNRELEASED; urgency=low
   * coll/hardening-info:
     + [NT] Skip files in usr/lib/debug/.
 
+  * lib/Lintian/CheckScript.pm:
+    + [NT] Prefer loading checks with ".pm", but fall back to loading
+      checks without the extension (with a deprecation warning).
   * lib/Lintian/{Path,Util}.pm:
     + [NT] Remove deprecated methods.
 
diff --git a/doc/lintian.xml b/doc/lintian.xml
index e8bff48..7fc6ffd 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -1219,7 +1219,7 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
       </para>
       <para>
         Checks in Lintian consist of a description file (.desc) and a
-        Perl module implementing the actual check (no extension).  The
+        Perl module implementing the actual check (.pm).  The
         names of these checks must consist entirely of the lower case
         characters ([a-z]), digits ([0-9]), underscore (_), dash (-),
         period (.) and forward slashes (/).
diff --git a/doc/tutorial/Lintian/Tutorial/WritingChecks.pod b/doc/tutorial/Lintian/Tutorial/WritingChecks.pod
index 79767ef..685c082 100644
--- a/doc/tutorial/Lintian/Tutorial/WritingChecks.pod
+++ b/doc/tutorial/Lintian/Tutorial/WritingChecks.pod
@@ -9,7 +9,7 @@ Lintian::Tutorial::WritingChecks -- Writing checks for Lintian
 This guide will quickly guide you through the basics of writing a
 Lintian check.  Most of the work is in writing the two files:
 
-  checks/<my-check>
+  checks/<my-check>.pm
   checks/<my-check>.desc
 
 And then either adding a Lintian profile or extending an existing
diff --git a/lib/Lintian/CheckScript.pm b/lib/Lintian/CheckScript.pm
index a2028ce..2891329 100644
--- a/lib/Lintian/CheckScript.pm
+++ b/lib/Lintian/CheckScript.pm
@@ -92,7 +92,7 @@ sub new {
     $self->{'script_pkg'} =~ s,/,::,go;
     $self->{'script_pkg'} =~ s,[-.],_,go;
 
-    $self->{'script_path'} = $dir . '/' . $self->{'name'};
+    $self->{'script_path'} = $dir . '/' . $self->{'name'} . '.pm';
 
     $self->{'script_run'} = undef; # init'ed with $self->load_check later
 
@@ -209,6 +209,19 @@ sub load_check {
     my $cs_pkg = $self->{'script_pkg'};
     my $run;
 
+    if (! -f $cs_path) {
+        # Try the "old" extensionless path (i.e. strip ".pm")
+        # - This can go away in 2.5.15 or later
+        my $alt_path = substr($cs_path, 0, -3);
+        if ( -f $alt_path ) {
+            my $name = $self->name;
+            warnings::warnif('deprecated',
+                             "[deprecated] Check module for $name missing \".pm\" extension"
+                             . " (should be: $cs_path)");
+            $self->{'script_path'} = $cs_path = $alt_path;
+        }
+    }
+
     require $cs_path;
 
     {
diff --git a/t/scripts/ancient-sv-date.t b/t/scripts/ancient-sv-date.t
index 0b43ca2..043db21 100755
--- a/t/scripts/ancient-sv-date.t
+++ b/t/scripts/ancient-sv-date.t
@@ -31,7 +31,7 @@ plan tests => 2;
 
 $ENV{'LINTIAN_ROOT'} //= '.';
 
-my $check = "$ENV{'LINTIAN_ROOT'}/checks/standards-version";
+my $check = "$ENV{'LINTIAN_ROOT'}/checks/standards-version.pm";
 my $found = 0;
 open(my $fd, '<', $check);
 while ( my $line = <$fd> ) {
diff --git a/t/scripts/critic.t b/t/scripts/critic.t
index 7fe8009..50a6ada 100755
--- a/t/scripts/critic.t
+++ b/t/scripts/critic.t
@@ -23,19 +23,17 @@ diag('libppix-regexp-perl is needed to enable some checks') if $@;
 
 Test::Perl::Critic->import( -profile => '.perlcriticrc' );
 
+my @DIRS = (qw(t/runtests checks collection frontend lib private reporting t/scripts t/helpers));
 
-our @CHECKS = glob ('checks/*[!.]*[!c]');
-plan tests => scalar(@CHECKS)+2;
-
-for my $check (@CHECKS) {
-    critic_ok($check);
-}
+plan tests => scalar(@DIRS) + 1;
 
 critic_ok('t/runtests');
 
-subtest 'All scripts with correct shebang or extension' => sub {
-    all_critic_ok(qw(collection frontend lib private reporting t/scripts t/helpers));
-};
+for my $dir (@DIRS) {
+    subtest 'All scripts with correct shebang or extension' => sub {
+        all_critic_ok($dir);
+    };
+}
 
 sub should_skip {
     my $skip = 1;
diff --git a/t/scripts/needs-info-missing.t b/t/scripts/needs-info-missing.t
index 172ef92..989a60f 100755
--- a/t/scripts/needs-info-missing.t
+++ b/t/scripts/needs-info-missing.t
@@ -123,14 +123,18 @@ for my $module (@MODULES) {
 for my $desc (@DESCS) {
     my ($header) = read_dpkg_control($desc);
     my %needs = map { $_ => 1 } split(/\s*,\s*/, $header->{'needs-info'} || '');
+    my $codefile = substr($desc, 0, -5); # Strip ".desc"
 
     if ($desc =~ m/lintian\.desc$/) {
 	pass('lintian.desc has all required needs-info for Lintian::Collect');
 	next;
     }
 
-    my ($check) = split(/\.desc$/, $desc);
-    my $code =slurp_entire_file($check);
+    if ($codefile !~ m{ /collection/ }xsm) {
+        $codefile .= '.pm';
+    }
+
+    my $code =slurp_entire_file($codefile);
     my %subs;
     while ($code =~ s/\$info\s*->\s*(\w+)//) {
 	$subs{$1} = 1;
diff --git a/t/scripts/strict.t b/t/scripts/strict.t
index 8125e60..623a256 100755
--- a/t/scripts/strict.t
+++ b/t/scripts/strict.t
@@ -15,17 +15,9 @@ plan skip_all => 'Test::Strict required to run this test' if $@;
 
 $ENV{'LINTIAN_ROOT'} //= '.';
 
-my @DIRS = map { "$ENV{'LINTIAN_ROOT'}/$_" } qw(lib private frontend collection);
-my @CHECKS = glob("$ENV{'LINTIAN_ROOT'}/checks/*[!.]*[!c]");
+my @DIRS = map { "$ENV{'LINTIAN_ROOT'}/$_" } qw(lib private frontend collection checks);
 all_perl_files_ok(@DIRS);
 
-for my $check (@CHECKS) {
-    # syntax_ok does not like our checks.  However, those are covered
-    # by check-load.t, so it is not a huge problem.
-    strict_ok($check);
-    warnings_ok($check);
-}
-
 # html_reports loads ./config, so we have do chdir before checking it.
 chdir("$ENV{'LINTIAN_ROOT'}/reporting");
 all_perl_files_ok('.');
diff --git a/t/scripts/unpack-level.t b/t/scripts/unpack-level.t
index 2216693..83b80e2 100755
--- a/t/scripts/unpack-level.t
+++ b/t/scripts/unpack-level.t
@@ -45,6 +45,7 @@ my @l2refs = (
 for my $desc (@DESCS) {
     my ($header) = read_dpkg_control($desc);
     my @needs;
+    my $codefile = substr($desc, 0, -5); # Strip ".desc"
     if ($header->{'collector-script'}) {
         my $coll = Lintian::CollScript->new ($desc);
         @needs = $coll->needs_info;
@@ -57,9 +58,12 @@ for my $desc (@DESCS) {
 	next;
     }
 
+    if ($codefile !~ m{ /collection/ }xsm) {
+        $codefile .= '.pm';
+    }
+
     my %ninfo = map {$_ => 1} @needs;
-    my ($file) = split(/\.desc$/, $desc);
-    my $code = slurp_entire_file($file);
+    my $code = slurp_entire_file($codefile);
     my $requires_unpacked = 0;
 
     for my $l2ref (@l2refs) {

-- 
Debian package checker


Reply to: