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

[lintian] 01/02: description check: Add new tag perl-module-name-not-mentioned-in-description



This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch ppt-lc-mover
in repository lintian.

commit cdc2b859111dbfc7bd6021ab8c675719cc93a6d9
Author: Axel Beckert <abe@deuxchevaux.org>
Date:   Tue Aug 11 17:30:36 2015 +0200

    description check: Add new tag perl-module-name-not-mentioned-in-description
    
    The binary check for this tag is based upon pkg-perl-tools' source
    check module-name which emitted a no-module-name-in-description tag
    and was mostly written by Damyan Ivanov.
---
 checks/description.desc                            |  8 ++++++++
 checks/description.pm                              | 23 ++++++++++++++++++++++
 debian/changelog                                   |  3 +++
 t/tests/description-perl/debian/debian/control.in  | 16 +++++++++++++++
 t/tests/description-perl/debian/debian/install     |  1 +
 .../debian/lib/Deb/Long/Description.pm             |  5 +++++
 t/tests/description-perl/desc                      |  5 +++++
 t/tests/description-perl/tags                      |  1 +
 8 files changed, 62 insertions(+)

diff --git a/checks/description.desc b/checks/description.desc
index c61d5f9..cbee30d 100644
--- a/checks/description.desc
+++ b/checks/description.desc
@@ -240,3 +240,11 @@ Info: This package has no Homepage field but has a URL in the description
  and wording that might indicate this is the package Homepage.  If it is,
  add a Homepage control field containing it rather than mentioning it in
  the package description.
+
+Tag: perl-module-name-not-mentioned-in-description
+Severity: minor
+Certainty: certain
+Experimental: yes
+Info: Debian users are likely to look for perl modules by their name, e.g.
+ Foo::Bar, not by package name (libfoo-bar-perl). To make this easier, the main
+ module name should be present in the long package description.
diff --git a/checks/description.pm b/checks/description.pm
index cade0d0..acd678c 100644
--- a/checks/description.pm
+++ b/checks/description.pm
@@ -250,6 +250,29 @@ sub run {
             $PICKY_SPELLING_ERROR_IN_DESCRIPTION);
     }
 
+    if ($pkg =~ /^lib(.+)-perl$/) {
+        my $mod = $1;
+        my @mod_path_elements = split(/-/, $mod);
+        $mod = join('::', map {ucfirst} @mod_path_elements);
+        my $mod_lc = lc($mod);
+        my $d = $info->field('description');
+        $d =~ s/[^\n]+\n//; # strip long description
+
+        my $pm_found = 0;
+        my $pmpath = join('/', @mod_path_elements).'.pm';
+        my $pm     = $mod_path_elements[-1].'.pm';
+
+        foreach my $filepath ($info->sorted_index) {
+            if ($filepath =~ m(\Q$pmpath\E\z|/\Q$pm\E\z)i) {
+                $pm_found = 1;
+                last;
+            }
+        }
+
+        tag('perl-module-name-not-mentioned-in-description', $mod)
+          if (lc($d) !~ /\Q$mod_lc\E/ and $pm_found);
+    }
+
     return;
 }
 
diff --git a/debian/changelog b/debian/changelog
index f4b602a..cb805c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ lintian (2.5.36) UNRELEASED; urgency=medium
       Remove line number before running the detection.
     + [BR] Avoid another gfdl false positive in oidentd, sdlbasic,
       smbc package.
+  * checks/description.*:
+    + [AB] Add new tag perl-module-name-not-mentioned-in-description based
+      on pkg-perl-tools' no-module-name-in-description by Damyan Ivanov.
   * checks/files.desc:
     + [BR] Correct a few typos.  (Closes: #794953).
     + [BR] Rename files-privacybreach-may-use-debian-package
diff --git a/t/tests/description-perl/debian/debian/control.in b/t/tests/description-perl/debian/debian/control.in
new file mode 100644
index 0000000..cf75af0
--- /dev/null
+++ b/t/tests/description-perl/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: extra
+Section: perl
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+
+Package: libdeb-long-description-perl
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: lintian dummy package to test a module name related check
+ This package is solely meant for testing a lintian check to argue
+ about not mentioning the contained perl module.
+ .
+ For testing and length-ish purposes, with Long::Description a similar
+ name is mentioned though
diff --git a/t/tests/description-perl/debian/debian/install b/t/tests/description-perl/debian/debian/install
new file mode 100644
index 0000000..306e16a
--- /dev/null
+++ b/t/tests/description-perl/debian/debian/install
@@ -0,0 +1 @@
+lib/Deb/Long/Description.pm usr/share/perl5/Deb/Long
diff --git a/t/tests/description-perl/debian/lib/Deb/Long/Description.pm b/t/tests/description-perl/debian/lib/Deb/Long/Description.pm
new file mode 100644
index 0000000..e86bca4
--- /dev/null
+++ b/t/tests/description-perl/debian/lib/Deb/Long/Description.pm
@@ -0,0 +1,5 @@
+# Dummy Perl module for lintian testing purposes.
+
+package Deb::Long::Description;
+
+return 1;
diff --git a/t/tests/description-perl/desc b/t/tests/description-perl/desc
new file mode 100644
index 0000000..1397049
--- /dev/null
+++ b/t/tests/description-perl/desc
@@ -0,0 +1,5 @@
+Testname: description-perl
+Sequence: 6000
+Version: 1.0
+Description: Tests of perl-related description tags
+Test-For: perl-module-name-not-mentioned-in-description
diff --git a/t/tests/description-perl/tags b/t/tests/description-perl/tags
new file mode 100644
index 0000000..86c9409
--- /dev/null
+++ b/t/tests/description-perl/tags
@@ -0,0 +1 @@
+X: libdeb-long-description-perl: perl-module-name-not-mentioned-in-description Deb::Long::Description

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: