Subject: [PATCH] Try to detect typos when determining whether to emit copyright-refers-to-versionless-license-file, to avoid false positives

From: Raphael Geissert <[email-masked]>
Date: Thu, 12 Feb 2009 23:23:26 -0600

---
 checks/copyright-file      |    7 +++++--
 checks/copyright-file.desc |    6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/checks/copyright-file b/checks/copyright-file
index d9e47aa..d6e4e98 100644
--- a/checks/copyright-file
+++ b/checks/copyright-file
@@ -152,11 +152,14 @@ if (m,usr/share/common-licenses/(GPL|LGPL|BSD|Artistic)\.gz,) {
 # Allow generic GPL references for packages licensed under the same terms as
 # Perl for now.  Perl references GPL version 1, which isn't in
 # common-licenses.
-if (m,(usr/share/common-licenses/(L?GPL|GFDL))[^-],i && !m,as Perl itself,i
+if (m,(usr/share/common-licenses/(L?GPL|GFDL))([^-]),i && !m,as Perl itself,i
     && !m,License-Alias:\s+Perl,) {
     my $ref = $1;
     my $license = $2;
-    if (m,\b(any|or)\s+later(\s+version)?\b,i || m,License: $license-[\d\.]+\+,i) {
+    my $separator = $3;
+    if ($separator =~ m/[\d\w]/) {
+	tag 'copyright-refers-to-non-existent-license-file', $1.$3;
+    } elsif (m,\b(any|or)\s+later(\s+version)?\b,i || m,License: $license-[\d\.]+\+,i) {
 	tag "copyright-refers-to-symlink-license", $ref;
     } else {
 	tag "copyright-refers-to-versionless-license-file", $ref;
diff --git a/checks/copyright-file.desc b/checks/copyright-file.desc
index 221a110..9d6c6b7 100644
--- a/checks/copyright-file.desc
+++ b/checks/copyright-file.desc
@@ -357,3 +357,9 @@ Info: The copyright file refers to the versionless symlink in
  published by the Free Software Foundation; version 2 dated June, 1991,"
  the <tt>debian/copyright</tt> file should refer to
  <tt>/usr/share/common-licenses/GPL-2</tt>, not <tt>/GPL</tt>.
+
+Tag: copyright-refers-to-non-existent-license-file
+Severity: minor
+Certainty: possible
+Info: The copyright file refers to a license file that doesn't exist.  This is
+ usually caused by a typo.