Bug#709365: lintian: check for standard license short names
On Sat, May 25, 2013 at 11:07:28PM +0200, Jakub Wilk wrote:
> FWIW, "BSD (2 clause)", "BSD License" and "GPL (v2 or later)" are
> not even syntactically correct, because spaces are not allowed in
> short license names.
This helps a lot. The new patch checks for the space problem
and also some incorrect strings.
>From 1ca11e44e695ae45dcd222f20cbada0a3010661f Mon Sep 17 00:00:00 2001
From: Clint Adams <clint@softwarefreedom.org>
Date: Tue, 28 May 2013 11:24:44 -0400
Subject: [PATCH] Add checks and tests for short names containing spaces and
short names that are probably meant to be standard values
but are misspelled or misformatted.
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 | 16 ++++++++++++++++
checks/source-copyright.desc | 14 ++++++++++++++
t/tests/source-copyright-dep5-general/desc | 1 +
t/tests/source-copyright-dep5-general/tags | 2 ++
4 files changed, 33 insertions(+)
diff --git a/checks/source-copyright b/checks/source-copyright
index 275c228..78c1801 100644
--- a/checks/source-copyright
+++ b/checks/source-copyright
@@ -225,6 +225,22 @@ if (@dep5) {
tag 'unused-license-paragraph-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
}
}
+ while ((my $license, $i) = each %standalone_licenses) {
+ if ($license =~ / /) {
+ tag 'space-in-std-shortname-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+ }
+ if ($license =~ /^(?:3bsd-like|agpl|apache|apache-license-1\.1|apgl-3|artistic|asl-2\.0|aslv2|bsd|bsd[_-][0-9]|bsd-2-cluase|bsdl|cc-3|cc-zero|cc-sa-by-3\.0|creative-commons-cc0-1\.0-universal|freebsd|generic-bsd|gfdl|gpl|gpl2\/gpl3|gplv[23]|gplv[23]\+|gpl-v[23]|lgpl|lgpl[0-9]\+?|lgplv.*|mpl|mit|mit[^a-z].*|modified-bsd|mpl-and-gpl-2|pd|zlib[\/-]libpng)$/) {
+ tag 'bad-shortname-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+ }
+ }
+ while ((my $license, $i) = each %required_standalone_licenses) {
+ if ($license =~ / /) {
+ tag 'space-in-std-shortname-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+ }
+ if ($license =~ /^(?:3bsd-like|agpl|apache|apache-license-1\.1|apgl-3|artistic|asl-2\.0|aslv2|bsd|bsd[_-][0-9]|bsd-2-cluase|bsdl|cc-3|cc-zero|cc-sa-by-3\.0|creative-commons-cc0-1.0-universal|freebsd|generic-bsd|gfdl|gpl|gpl2\/gpl3|gplv[23]|gplv[23]\+|gpl-v[23]|lgpl|lgpl[0-9]\+?|lgplv.*|mpl|mit|mit[^a-z].*|modified-bsd|mpl-and-gpl-2|pd|zlib[\/-]libpng)$/) {
+ tag 'bad-shortname-in-dep5-copyright', $license, "(paragraph at line $lines[$i])";
+ }
+ }
}
}
diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 3276a57..b27dd10 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -168,3 +168,17 @@ 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: space-in-std-shortname-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 with a space, which
+ does not conform to the specification.
+
+Tag: bad-shortname-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.
diff --git a/t/tests/source-copyright-dep5-general/desc b/t/tests/source-copyright-dep5-general/desc
index abcd52f..52d4372 100644
--- a/t/tests/source-copyright-dep5-general/desc
+++ b/t/tests/source-copyright-dep5-general/desc
@@ -4,6 +4,7 @@ Version: 1.0
Description: Test for various errors in DEP-5 copyright files
Test-For:
ambiguous-paragraph-in-dep5-copyright
+ bad-shortname-in-dep5-copyright
comma-separated-files-in-dep5-copyright
missing-field-in-dep5-copyright
missing-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..e3c101c 100644
--- a/t/tests/source-copyright-dep5-general/tags
+++ b/t/tests/source-copyright-dep5-general/tags
@@ -1,6 +1,8 @@
I: source-copyright-dep5-general source: unused-license-paragraph-in-dep5-copyright bsd-3 (paragraph at line 22)
I: source-copyright-dep5-general source: unused-license-paragraph-in-dep5-copyright expat (paragraph at line 44)
W: source-copyright-dep5-general source: ambiguous-paragraph-in-dep5-copyright paragraph at line 22
+W: source-copyright-dep5-general source: bad-shortname-in-dep5-copyright bsd-3 (paragraph at line 22)
+W: source-copyright-dep5-general source: bad-shortname-in-dep5-copyright mit (paragraph at line 18)
W: source-copyright-dep5-general source: comma-separated-files-in-dep5-copyright paragraph at line 8
W: source-copyright-dep5-general source: missing-field-in-dep5-copyright copyright (paragraph at line 15)
W: source-copyright-dep5-general source: missing-field-in-dep5-copyright license (paragraph at line 12)
--
1.7.10.4
Reply to: