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

[SCM] Debian package checker branch, master, updated. 2.5.11-81-g29bd97f



The following commit has been merged in the master branch:
commit 29bd97f6e86f795c97f33747691fcf4a2c6e1060
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jan 18 19:36:45 2013 +0100

    c/source-copyright: add ambiguous-paragraph-in-dep5-copyright
    
    Flag DEP-5 paragraphs a License, a Copyright and no Files field.
    While strictly speaking it is allowed (as a "stand-alone license
    paragraph" with an extra "Copyright" field), it is almost certainly
    not what people intended it to be.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/source-copyright b/checks/source-copyright
index e087e71..6bb6ba9 100644
--- a/checks/source-copyright
+++ b/checks/source-copyright
@@ -171,6 +171,15 @@ if (@dep5) {
         $i++;
         my $license = get_field ($para, 'license');
         my $files = get_field ($para, 'files');
+        my $copyright = get_field ($para, 'copyright');
+
+        if (not defined $files and defined $license and defined $copyright) {
+            tag 'ambiguous-paragraph-in-dep5-copyright', "paragraph at line $lines[$i]";
+            # If it is the first paragraph, it might be an instance of
+            # the (no-longer) optional "first Files-field".
+            $files = '*' if $i == 1;
+        }
+
         if (defined $license and not defined $files) {
             # Standalone license paragraph
             if (not $license =~ m/\n/) {
@@ -192,7 +201,7 @@ if (@dep5) {
             else {
                 tag 'missing-field-in-dep5-copyright', "license (paragraph at line $lines[$i])";
             }
-            if (not defined get_field ($para, 'copyright')) {
+            if (not defined $copyright) {
                 tag 'missing-field-in-dep5-copyright', "copyright (paragraph at line $lines[$i])";
             }
         }
diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 92535af..228ac95 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -148,3 +148,23 @@ Info: The listed field name is a likely misspelling of one of the documented
  Implementation detail: The typo is detected by using "Levenshtein
  edit distance".  Therefore, if the typo involve several characters,
  Lintian may not detect it.
+
+Tag: ambiguous-paragraph-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: #652380, http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: The paragraph has a "License" and a "Copyright" field, but no
+ "Files" field.  Technically, this is a valid paragraph per the DEP-5
+ specification.  However, it is mostly likely a mistake.
+ .
+ If it is a <tt>stand-alone license paragraph</tt>, the "Copyright"
+ field is not needed and should be removed.  On the other hand, if it
+ is a <tt>files paragraph</tt>, it is missing the "Files" field.
+ .
+ Please note that while the "Files" field was optional in some cases
+ in some of the earlier draft versions, it is mandatory in <i>all</i>
+ <tt>files paragraphs</tt> in the current specification.
+ .
+ Lintian will attempt to guess what you intended and continue based on
+ its guess.  It the guess is wrong, you may see spurious tags related
+ to this paragraph.
diff --git a/debian/changelog b/debian/changelog
index 7449319..0788d9a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ lintian (2.5.12) UNRELEASED; urgency=low
 
   * Summary of tag changes:
     + Added:
+      - ambiguous-paragraph-in-dep5-copyright
       - debug-file-with-no-debug-symbols
       - desktop-entry-lacks-keywords-entry
       - dir-or-file-in-build-tree
@@ -55,6 +56,10 @@ lintian (2.5.12) UNRELEASED; urgency=low
   * checks/shared-libs:
     + [NT] Special case gcc packages when looking for dev symlinks.
       gcc stores its dev symlinks in some special directories.
+  * checks/source-copyright{,.desc}:
+    + [JW,NT] Add a separate tag for ambiguous DEP-5 paragraphs,
+      where Lintian cannot reliably figure out what is intended.
+      Thanks to Julian Taylor for the report.  (Closes: #652380)
   * checks/symlinks{,.desc}:
     + [NT] Warn about broken symlinks that contains a literal "*"
       in their target.  This is usually a sign that a wildcard did
diff --git a/t/tests/source-copyright-dep5-general/debian/debian/copyright b/t/tests/source-copyright-dep5-general/debian/debian/copyright
index 9be2c7e..7d2a3dd 100644
--- a/t/tests/source-copyright-dep5-general/debian/debian/copyright
+++ b/t/tests/source-copyright-dep5-general/debian/debian/copyright
@@ -19,6 +19,10 @@ Files: 5
 License: MIT
 Copyright: 2010 J. Random Hacker <j.r.hacker@example.com>
 
+Comment: Oops, missing a Files for this paragraph.
+License: BSD-3
+Copyright: 2010 J. Random Hacker <j.r.hacker@example.com>
+
 License: GPL-2
  This package is free software; you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free Software
diff --git a/t/tests/source-copyright-dep5-general/desc b/t/tests/source-copyright-dep5-general/desc
index 8e4a576..abcd52f 100644
--- a/t/tests/source-copyright-dep5-general/desc
+++ b/t/tests/source-copyright-dep5-general/desc
@@ -3,6 +3,7 @@ Sequence: 6000
 Version: 1.0
 Description: Test for various errors in DEP-5 copyright files
 Test-For:
+ ambiguous-paragraph-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 76aa920..1b4962e 100644
--- a/t/tests/source-copyright-dep5-general/tags
+++ b/t/tests/source-copyright-dep5-general/tags
@@ -1,8 +1,11 @@
-I: source-copyright-dep5-general source: unused-license-paragraph-in-dep5-copyright expat (paragraph at line 40)
+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: 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)
 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 gpl-3 (paragraph at line 38)
+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: 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

-- 
Debian package checker


Reply to: