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

Bug#697817: [cruft] Improve gfdl test and solve some false positive



Package: lintian
Version: 2.5.10.3
Severity: normal
Tags: patch

Please apply the following patch that fixe a false positive in parted package.

Patch one is optionnal, grammar is strange....
From 406130676c07a6e277b4e654ec8da70387d996e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Wed, 9 Jan 2013 22:58:15 +0100
Subject: [PATCH 1/2] Add more variant of gfdl

Some package are particularly creative about grammar. Even if
incorrect allow it.
---
 checks/cruft                                               |    6 +++---
 t/tests/cruft-gfdl-invariants/debian/src/partedvariant.txt |    8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/partedvariant.txt

diff --git a/checks/cruft b/checks/cruft
index be04906..30f46e1 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -451,9 +451,9 @@ sub find_cruft {
                                A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
                     # GFDL license, assume it is bad unless it
                     # explicitly states it has no "bad sections".
-                    unless ($1 =~m/with \s+ no \s+ Invariant \s+ Sections,?
-                                       \s+ (?:with\s+)? no \s+ Front-Cover \s+ Texts,? \s+ and
-                                       \s+ (?:with\s+)? no \s+ Back-Cover \s+ Texts/xis) {
+                    unless ($1 =~m/with \s+ (?:the\s+)? no \s+ Invariant \s+ Sections,?
+                                       \s+ (?:with\s+)? (?:the\s+)? no \s+ Front-Cover \s+ Texts,? \s+ and
+                                       \s+ (?:with\s+)? (?:the\s+)? no \s+ Back-Cover \s+ Texts/xis) {
                         tag 'license-problem-gfdl-invariants', $name;
                         $licenseproblemhash{'gfdl-invariants'} = 1;
                     }
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/partedvariant.txt b/t/tests/cruft-gfdl-invariants/debian/src/partedvariant.txt
new file mode 100644
index 0000000..5b17014
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/partedvariant.txt
@@ -0,0 +1,8 @@
+Parted 2.13 version with strange grammar.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3
+or any later version published by the Free Software Foundation;
+with the no Invariant Sections, with the no Front-Cover Texts, and
+with no Back-Cover Texts.  A copy of the license is included in the
+file, COPYING.DOC.
\ No newline at end of file
-- 
1.7.10.4

From d58a13edeb89631a9d00f1b438291c49e4526a6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Wed, 9 Jan 2013 23:48:52 +0100
Subject: [PATCH 2/2] Add gfdl license text example

Add license text example as false positive. Do not trigger tag.
---
 checks/cruft                                            |   15 ++++++++++++---
 .../debian/src/gfdllicenseexample.html                  |   13 +++++++++++++
 .../debian/src/gfdllicenseexample.texi                  |   13 +++++++++++++
 3 files changed, 38 insertions(+), 3 deletions(-)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.html
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.texi

diff --git a/checks/cruft b/checks/cruft
index 30f46e1..25a0187 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -451,11 +451,20 @@ sub find_cruft {
                                A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
                     # GFDL license, assume it is bad unless it
                     # explicitly states it has no "bad sections".
-                    unless ($1 =~m/with \s+ (?:the\s+)? no \s+ Invariant \s+ Sections,?
+                    my $gfdlsections = $1;
+                    unless ($gfdlsections =~m/with \s+ (?:the\s+)? no \s+ Invariant \s+ Sections,?
                                        \s+ (?:with\s+)? (?:the\s+)? no \s+ Front-Cover \s+ Texts,? \s+ and
                                        \s+ (?:with\s+)? (?:the\s+)? no \s+ Back-Cover \s+ Texts/xis) {
-                        tag 'license-problem-gfdl-invariants', $name;
-                        $licenseproblemhash{'gfdl-invariants'} = 1;
+                        # license gfdl text verbatim is ok 
+                        unless ($gfdlsections =~m/with \s+ the \s+ Invariant \s+ Sections \s+ being 
+                                        \s+ (?:\@var\{|<var>)? LIST \s+ THEIR \s+TITLES (?:\}|<\/var>)? \s? ,?
+                                        \s+ with \s+ the \s+ Front-Cover \s+ Texts \s+ being 
+                                        \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)? \s? ,? 
+                                        \s+ and \s+ with \s+ the \s+ Back-Cover \s+ Texts \s+ being 
+                                        \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)?/xis) {
+                            tag 'license-problem-gfdl-invariants', $name;
+                            $licenseproblemhash{'gfdl-invariants'} = 1;
+                        }
                     }
                 }
             }
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.html b/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.html
new file mode 100644
index 0000000..0371013
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+false positive found in license text:
+<pre>
+Copyright (C)  year  your name.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3
+or any later version published by the Free Software Foundation;
+with the Invariant Sections being <var>list their titles</var>, with
+the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
+being <var>list</var>.
+A copy of the license is included in the section entitled ``GNU Free Documentation License''.
+</html>
\ No newline at end of file
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.texi b/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.texi
new file mode 100644
index 0000000..fc52ba9
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/gfdllicenseexample.texi
@@ -0,0 +1,13 @@
+false positive found in license text:
+@smallexample
+@group
+  Copyright (C)  @var{year}  @var{your name}.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.3
+  or any later version published by the Free Software Foundation;
+  with the Invariant Sections being @var{list their titles}, with the
+  Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
+  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
+@end group
+@end smallexample
-- 
1.7.10.4


Reply to: