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

Bug#709365: lintian: check for standard license short names



Package: lintian
Version: 2.4.3+squeeze1
Tags: patch

http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ defines
a list of short names, but nothing warns people when they are not used.

The attached patch could help with this problem.
>From 19058ad4f96aa91d18f1b0633192b96ac7a5d284 Mon Sep 17 00:00:00 2001
From: Clint Adams <clint@softwarefreedom.org>
Date: Wed, 22 May 2013 15:09:45 -0400
Subject: [PATCH] Add check and test for nonstandard short names.

Currently lintian gives no feedback about choice of short name
in debian/copyright, and this leads to use of strings like
"MIT" and "BSD3", which are unhelpful when correlating to SPDX.
---
 checks/source-copyright                    |   10 ++++++++++
 checks/source-copyright.desc               |    7 +++++++
 t/tests/source-copyright-dep5-general/desc |    1 +
 t/tests/source-copyright-dep5-general/tags |    2 ++
 4 files changed, 20 insertions(+)

diff --git a/checks/source-copyright b/checks/source-copyright
index 275c228..a171541 100644
--- a/checks/source-copyright
+++ b/checks/source-copyright
@@ -225,6 +225,16 @@ if (@dep5) {
             tag 'unused-license-paragraph-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
         }
     }
+    while ((my $license, $i) = each %standalone_licenses) {
+        if ($license !~ /^(?:public-domain|apache|artistic|bsd-[234]-clause|isc|cc-by(?:-(?:sa|nd|nc|nc-sa|nc-nd))?|cc0|cddl|cpl|efl|expat|gpl|lgpl|gfdl|gfdl-niv|lppl|mpl|perl|python|qpl|w3c|zlib|zope)(?:-[0-9][0-9\.]*)?$/) {
+            tag 'nonstandard-license-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+        }
+    }
+    while ((my $license, $i) = each %required_standalone_licenses) {
+        if ($license !~ /^(?:public-domain|apache|artistic|bsd-[234]-clause|isc|cc-by(?:-(?:sa|nd|nc|nc-sa|nc-nd))?|cc0|cddl|cpl|efl|expat|gpl|lgpl|gfdl|gfdl-niv|lppl|mpl|perl|python|qpl|w3c|zlib|zope)(?:-[0-9][0-9\.]*)?$/) {
+            tag 'nonstandard-license-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+        }
+    }
 }
 
 }
diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 3276a57..2bd552b 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -168,3 +168,10 @@ Info: The paragraph has a "License" and a "Copyright" field, but no
  Lintian will attempt to guess what you intended and continue based on
  its guess.  If the guess is wrong, you may see spurious tags related
  to this paragraph.
+
+Tag: nonstandard-license-in-dep5-copyright
+Severity: minor
+Certainty: certain
+Ref: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: The license header does contains a short name not enumerated by
+ the copyright format definition.
diff --git a/t/tests/source-copyright-dep5-general/desc b/t/tests/source-copyright-dep5-general/desc
index abcd52f..bc8d57f 100644
--- a/t/tests/source-copyright-dep5-general/desc
+++ b/t/tests/source-copyright-dep5-general/desc
@@ -8,6 +8,7 @@ Test-For:
  missing-field-in-dep5-copyright
  missing-license-paragraph-in-dep5-copyright
  missing-license-text-in-dep5-copyright
+ nonstandard-license-in-dep5-copyright
  obsolete-field-in-dep5-copyright
  unknown-paragraph-in-dep5-copyright
  unused-license-paragraph-in-dep5-copyright
diff --git a/t/tests/source-copyright-dep5-general/tags b/t/tests/source-copyright-dep5-general/tags
index 1b4962e..83e752a 100644
--- a/t/tests/source-copyright-dep5-general/tags
+++ b/t/tests/source-copyright-dep5-general/tags
@@ -7,5 +7,7 @@ W: source-copyright-dep5-general source: missing-field-in-dep5-copyright license
 W: source-copyright-dep5-general source: missing-license-paragraph-in-dep5-copyright mit (paragraph at line 18)
 W: source-copyright-dep5-general source: missing-license-text-in-dep5-copyright bsd-3 (paragraph at line 22)
 W: source-copyright-dep5-general source: missing-license-text-in-dep5-copyright gpl-3 (paragraph at line 42)
+W: source-copyright-dep5-general source: nonstandard-license-in-dep5-copyright bsd-3 (paragraph at line 22)
+W: source-copyright-dep5-general source: nonstandard-license-in-dep5-copyright mit (paragraph at line 18)
 W: source-copyright-dep5-general source: obsolete-field-in-dep5-copyright upstream-maintainer upstream-contact (paragraph at line 1)
 W: source-copyright-dep5-general source: unknown-paragraph-in-dep5-copyright paragraph at line 6
-- 
1.7.10.4


Reply to: