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

[lintian] 01/02: Tag some invalid short name



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

broucaries-guest pushed a commit to branch master
in repository lintian.

commit 434cd9d41f14e1e371bbcd1e159825b18d5717d2
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date:   Mon Aug 25 23:46:52 2014 +0200

    Tag some invalid short name
    
    Tag some typos and invalid short name in dpe5 copyright.
    
    Thanks to Johannes Schauer
    
    Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
 checks/source-copyright.desc                        |  7 +++++++
 checks/source-copyright.pm                          |  2 ++
 data/source-copyright/bad-short-licenses            | 21 ++++++++++++++-------
 debian/changelog                                    |  2 ++
 t/scripts/implemented-tags.t                        |  1 +
 .../source-copyright-bad-short-name/debian/README   |  1 +
 .../debian/debian/copyright                         | 15 +++++++++++++++
 t/tests/source-copyright-bad-short-name/desc        |  6 ++++++
 t/tests/source-copyright-bad-short-name/tags        |  2 ++
 9 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 1060cf0..bafe795 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -144,6 +144,13 @@ Info: Your copyright file references a license that is not defined.
  remember to also notify snapshot.debian.org about this
  package containing a non-distributable file.
 
+Tag: invalid-short-name-in-dep5-copyright
+Severity: minor
+Certainty: certain
+Ref: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: The license header contains a short name observed to be a
+ misspelling of one of the standard short names.
+
 Tag: missing-license-paragraph-in-dep5-copyright
 Severity: normal
 Certainty: possible
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 793df89..61df1e7 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -397,6 +397,7 @@ sub _parse_dep5 {
               "(paragraph at line $lines[$i]{'START-OF-PARAGRAPH'})";
         }
     }
+  LICENSE:
     while ((my $license, $i) = each %short_licenses_seen) {
         foreach my $bad_short_license ($BAD_SHORT_LICENSES->all) {
             my $value = $BAD_SHORT_LICENSES->value($bad_short_license);
@@ -404,6 +405,7 @@ sub _parse_dep5 {
             if ($license =~ m/$regex/x) {
                 tag $value->{'tag'}, $license,
                   "(paragraph at line $lines[$i]{'START-OF-PARAGRAPH'})";
+                next LICENSE;
             }
         }
     }
diff --git a/data/source-copyright/bad-short-licenses b/data/source-copyright/bad-short-licenses
index 1ed8350..306fee4 100644
--- a/data/source-copyright/bad-short-licenses
+++ b/data/source-copyright/bad-short-licenses
@@ -1,9 +1,16 @@
 # regex ~~ tag
 # please alpha short by tag then regex
-# note license is alway lower case
-\b-\b             ~~ license-problem-undefined-license
-\bfixme\b         ~~ license-problem-undefined-license
-\btodos?\b        ~~ license-problem-undefined-license
-\bundefined\b     ~~ license-problem-undefined-license
-\bunknown?\b      ~~ license-problem-undefined-license
-\bunspecified\b   ~~ license-problem-undefined-license
+# note license is always lower case
+
+# some licenses are misspelled by not putting
+# a dash in front of the version
+^(?:agpl|gpl|lgpl)[^-]?\d(?:\.\d)?\+?$    ~~ invalid-short-name-in-dep5-copyright
+# some misspellings of BSD licenses
+^bsd$                                     ~~ invalid-short-name-in-dep5-copyright
+^bsd[^-]?[234][^-]?(?:clause|cluase)$     ~~ invalid-short-name-in-dep5-copyright
+(^|\s)-(\s|$)                                     ~~ license-problem-undefined-license
+\bfixme\b                                 ~~ license-problem-undefined-license
+\btodos?\b                                ~~ license-problem-undefined-license
+\bundefined\b                             ~~ license-problem-undefined-license
+\bunknown?\b                              ~~ license-problem-undefined-license
+\bunspecified\b                           ~~ license-problem-undefined-license
diff --git a/debian/changelog b/debian/changelog
index 66d8d9b..6c5c8db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -103,6 +103,8 @@ lintian (2.5.26) UNRELEASED; urgency=medium
     + [BR] Detect pledgie.com as a donation website.
   * data/source-copyright/bad-short-licenses:
     + [BR] Add unspecified and - as bad license.
+    + [BR] Detect some invalid short name. Thanks to 
+       Johannes Schauer.
 
   * doc/tutorial/Lintian/Tutorial/WritingChecks.pod:
     + [NT] Correct tutorial now that the "index" collection
diff --git a/t/scripts/implemented-tags.t b/t/scripts/implemented-tags.t
index d711bbb..631dea8 100755
--- a/t/scripts/implemented-tags.t
+++ b/t/scripts/implemented-tags.t
@@ -60,6 +60,7 @@ our $EXCLUDE =join(
       ^debian-rules-should-not-.*$
       ^source-contains-prebuilt-.*$
       ^source-contains-autogenerated-.*$
+      ^invalid-short-name-in-dep5-copyright$
       ));
 
 # Exclude "lintian.desc" as it does not have a perl module like other
diff --git a/t/tests/source-copyright-bad-short-name/debian/README b/t/tests/source-copyright-bad-short-name/debian/README
new file mode 100644
index 0000000..1a9d2ad
--- /dev/null
+++ b/t/tests/source-copyright-bad-short-name/debian/README
@@ -0,0 +1 @@
+trivial
diff --git a/t/tests/source-copyright-bad-short-name/debian/debian/copyright b/t/tests/source-copyright-bad-short-name/debian/debian/copyright
new file mode 100644
index 0000000..c5ea681
--- /dev/null
+++ b/t/tests/source-copyright-bad-short-name/debian/debian/copyright
@@ -0,0 +1,15 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2014, somebody1
+License: gplv1
+ something
+
+Files: debian/*
+Copyright: 2014, somebody1
+License: bsd
+ this is a valid license short name
+
diff --git a/t/tests/source-copyright-bad-short-name/desc b/t/tests/source-copyright-bad-short-name/desc
new file mode 100644
index 0000000..f6ff3f8
--- /dev/null
+++ b/t/tests/source-copyright-bad-short-name/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-bad-short-name
+Sequence: 6000
+Version: 1.0
+Description: Test for bad short name
+Test-For:
+ invalid-short-name-in-dep5-copyright
diff --git a/t/tests/source-copyright-bad-short-name/tags b/t/tests/source-copyright-bad-short-name/tags
new file mode 100644
index 0000000..ea500d0
--- /dev/null
+++ b/t/tests/source-copyright-bad-short-name/tags
@@ -0,0 +1,2 @@
+W: source-copyright-bad-short-name source: invalid-short-name-in-dep5-copyright bsd (paragraph at line 11)
+W: source-copyright-bad-short-name source: invalid-short-name-in-dep5-copyright gplv1 (paragraph at line 6)

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


Reply to: