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

[lintian] 01/01: c/nmu: Create separate tag for whitespace around name



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

nthykier pushed a commit to branch master
in repository lintian.

commit db15a8f9f1e4516b15a4823d9da12e92457358cd
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Apr 9 12:36:25 2016 +0000

    c/nmu: Create separate tag for whitespace around name
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/nmu.desc                                               | 11 +++++++++++
 checks/nmu.pm                                                 |  8 +++++++-
 debian/changelog                                              |  4 ++++
 .../nmu-space-around-maintainer/debian/debian/changelog.in    |  8 ++++++++
 t/tests/nmu-space-around-maintainer/desc                      |  5 +++++
 t/tests/nmu-space-around-maintainer/tags                      |  1 +
 6 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/checks/nmu.desc b/checks/nmu.desc
index 88cb56e..70f4d40 100644
--- a/checks/nmu.desc
+++ b/checks/nmu.desc
@@ -95,3 +95,14 @@ Info: The file <tt>debian/changelog</tt> is a symlink instead of a regular
  .
  This problem may have prevented lintian from performing other checks,
  leading to undetected changelog errors.
+
+Tag: extra-whitespace-around-name-in-changelog-footer
+Severity: normal
+Certainty: certain
+Info: There is too much whitespace around the name in debian/changelog.
+ .
+ The format is:
+   -- NAME &lt;EMAIL&gt;  DATE
+ .
+ Note that there must be exactly 1 space after the "--" and exactly
+ 2 spaces before the "DATE".
diff --git a/checks/nmu.pm b/checks/nmu.pm
index cd74403..1b42434 100644
--- a/checks/nmu.pm
+++ b/checks/nmu.pm
@@ -27,6 +27,7 @@ use List::MoreUtils qw(any);
 use List::Util qw(first);
 
 use Lintian::Tags qw(tag);
+use Lintian::Util qw(strip);
 
 sub run {
     my (undef, undef, $info) = @_;
@@ -79,6 +80,11 @@ sub run {
     my $version_nmuness = 0;
     my $version_local = 0;
 
+    if ($uploader =~ m/^\s|\s$/) {
+        tag 'extra-whitespace-around-name-in-changelog-footer';
+        strip($uploader);
+    }
+
     if ($version =~ /-[^.-]+(\.[^.-]+)?(\.[^.-]+)?$/) {
         $version_nmuness = 1 if defined $1;
         $version_nmuness = 2 if defined $2;
@@ -96,7 +102,7 @@ sub run {
     my $upload_is_nmu = $uploader ne $maintainer;
     if (defined $uploaders) {
         my @uploaders = map { canonicalize($_) } split />\K\s*,\s*/,$uploaders;
-        $upload_is_nmu = 0 if any { /^\s*\Q$uploader\E\s*$/ } @uploaders;
+        $upload_is_nmu = 0 if any { $_ eq $uploader } @uploaders;
     }
 
     if ($maintainer =~ /packages\@qa.debian.org/) {
diff --git a/debian/changelog b/debian/changelog
index 430200e..ac73de0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,10 @@ lintian (2.5.44) UNRELEASED; urgency=medium
     + [JW] Relax build profile dependency checks to allow versions with
       trailing tilde.  (Closes: #819509)  Thanks to Felix Geyer for the bug
       report.
+  * checks/nmu.{desc,pm}:
+    + [NT] Create a separate tag for extra whitespace around uploader name
+      in the changelog.  Thanks to Ben Wiederhake for the suggestion.
+      (Closes: #801647)
 
   * commands/info.pm:
     + [NT] Accept "--tag" as an alias of "--tags".  Thanks to Robert
diff --git a/t/tests/nmu-space-around-maintainer/debian/debian/changelog.in b/t/tests/nmu-space-around-maintainer/debian/debian/changelog.in
new file mode 100644
index 0000000..108d1f3
--- /dev/null
+++ b/t/tests/nmu-space-around-maintainer/debian/debian/changelog.in
@@ -0,0 +1,8 @@
+{$source} ({$version}) unstable; urgency=low
+
+  * Lintian Test Suite.
+  * Test: {$testname}
+
+  * Suppress "should close ITP bug" messages.  (Closes: #123456)
+
+ --  {$author}  {$date}
diff --git a/t/tests/nmu-space-around-maintainer/desc b/t/tests/nmu-space-around-maintainer/desc
new file mode 100644
index 0000000..8510ecd
--- /dev/null
+++ b/t/tests/nmu-space-around-maintainer/desc
@@ -0,0 +1,5 @@
+Testname: nmu-space-around-maintainer
+Sequence: 6000
+Version: 1.0
+Description: Test for space around maintainer
+Test-For: extra-whitespace-around-name-in-changelog-footer
diff --git a/t/tests/nmu-space-around-maintainer/tags b/t/tests/nmu-space-around-maintainer/tags
new file mode 100644
index 0000000..53bcfe6
--- /dev/null
+++ b/t/tests/nmu-space-around-maintainer/tags
@@ -0,0 +1 @@
+W: nmu-space-around-maintainer source: extra-whitespace-around-name-in-changelog-footer

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


Reply to: