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

[lintian] 02/02: Fix a false positive for missing-license-paragraph-in-dep5-copyright tag.



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

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

commit 75d1b7cfc5e61091b695f25e53efea6ba744ecf6
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date:   Sun Nov 16 19:11:52 2014 +0100

    Fix a false positive for missing-license-paragraph-in-dep5-copyright tag.
    
    Closes: #766118
    
    Do not allow:
    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/
    License: public-domain
     some public-domain
    
    Files: *
    Comment: An false positive ? see #766118
    Copyright: 2014, somebody
    License: public-domain
    
    Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
 checks/source-copyright.desc                            | 12 ++++++++++++
 checks/source-copyright.pm                              | 12 +++++++++++-
 debian/changelog                                        |  6 ++++++
 t/tests/source-copyright-license-header/debian/README   |  1 +
 .../debian/debian/copyright                             | 17 +++++++++++++++++
 t/tests/source-copyright-license-header/desc            |  6 ++++++
 t/tests/source-copyright-license-header/tags            |  1 +
 7 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index d010f6d..59c4459 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -240,6 +240,18 @@ Info: In contrast to package dependencies, the pipe symbol or vertical
  between two license short names. Instead, the keyword "or" between
  two license names indicates the dual licensing.
 
+Tag: dep5-file-paragraph-reference-header
+Severity: normal
+Certainty: possible
+Ref: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: One of the file paragraph reference in the
+ license field a standalone license defined in the header
+ paragraph.
+ .
+ According to specification all of the short names license
+ or short names followed by license exceptions making up
+ the first line must be described in stand-alone License paragraphs.
+
 Tag: invalid-escape-sequence-in-dep5-copyright
 Severity: normal
 Certainty: possible
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 9d5987f..5e60197 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -245,12 +245,18 @@ sub _parse_dep5 {
           "(line $lines[0]{'format'})";
     }
 
-    my ($found_license_header, undef, undef, @short_licenses_header)
+    my ($found_license_header, $full_license_header, undef,
+        @short_licenses_header)
       =parse_license($first_para->{'license'}, 1);
     for my $short_license (@short_licenses_header) {
         $required_standalone_licenses{$short_license} = 1;
         $short_licenses_seen{$short_license}          = 1;
     }
+    if(defined($full_license_header)) {
+        for (@short_licenses_header) {
+            $standalone_licenses{$_} = 1;
+        }
+    }
 
     my (@commas_in_files, %file_para_coverage);
     my %file_coverage = map { $_ => 0 } get_all_files($info);
@@ -422,7 +428,11 @@ sub _parse_dep5 {
         if (not defined $standalone_licenses{$license}) {
             tag 'missing-license-paragraph-in-dep5-copyright', $license,
               "(paragraph at line $lines[$i]{'START-OF-PARAGRAPH'})";
+        } elsif ($standalone_licenses{$license} == 1) {
+            tag 'dep5-file-paragraph-reference-header', $license,
+              "(paragraph at line $lines[$i]{'START-OF-PARAGRAPH'})";
         }
+
     }
     while ((my $license, $i) = each %standalone_licenses) {
         if (not defined $required_standalone_licenses{$license}) {
diff --git a/debian/changelog b/debian/changelog
index 11fee83..f5b3067 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,12 @@ lintian (2.5.31) UNRELEASED; urgency=medium
   * checks/fields.desc:
     + [BR] Add reference to build-depends-on-metapackage
       (Closes: #767107).
+  * checks/source-copyright.pm:
+    + [BR] Fix a false positive for
+      missing-license-paragraph-in-dep5-copyright tag.
+      Do not allow to reference header paragraph,
+      emit a specific tag.
+      (Closes: #766118).
 
   * collection/strings:
     + [NT] Pass "-a" to strings to avoid possible security
diff --git a/t/tests/source-copyright-license-header/debian/README b/t/tests/source-copyright-license-header/debian/README
new file mode 100644
index 0000000..1a9d2ad
--- /dev/null
+++ b/t/tests/source-copyright-license-header/debian/README
@@ -0,0 +1 @@
+trivial
diff --git a/t/tests/source-copyright-license-header/debian/debian/copyright b/t/tests/source-copyright-license-header/debian/debian/copyright
new file mode 100644
index 0000000..f191cbf
--- /dev/null
+++ b/t/tests/source-copyright-license-header/debian/debian/copyright
@@ -0,0 +1,17 @@
+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/
+License: public-domain
+ some public-domain
+
+Files: *
+Comment: An old false positive see #766118
+Copyright: 2014, somebody
+License: public-domain
+
+Files: debian/*
+Copyright: 2014, somebody1
+License: this
+ this is a valid license short name
+
diff --git a/t/tests/source-copyright-license-header/desc b/t/tests/source-copyright-license-header/desc
new file mode 100644
index 0000000..373505d
--- /dev/null
+++ b/t/tests/source-copyright-license-header/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-license-header
+Sequence: 6000
+Version: 1.0
+Description: Test for license field referencing header
+Test-For:
+ dep5-file-paragraph-reference-header
diff --git a/t/tests/source-copyright-license-header/tags b/t/tests/source-copyright-license-header/tags
new file mode 100644
index 0000000..36dc1a2
--- /dev/null
+++ b/t/tests/source-copyright-license-header/tags
@@ -0,0 +1 @@
+W: source-copyright-license-header source: dep5-file-paragraph-reference-header public-domain (paragraph at line 8)

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


Reply to: