From 579eca9aa7c9323df72cb3f5649eed5636ca38f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Thu, 24 Jan 2013 09:59:46 +0100
Subject: [PATCH 2/6] Detect empty gfdl statement about invariant sections.

gfdl requests to explicitly mark that you have not invariant section by writing
text like this:
"with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts."

Some author instead use empty text. Detect this usage.
---
 checks/cruft                                           |    9 +++++++++
 checks/cruft.desc                                      |   12 ++++++++++++
 t/tests/cruft-gfdl-invariants/debian/src/empty.texi    |    5 +++++
 t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi |    7 +++++++
 t/tests/cruft-gfdl-invariants/desc                     |    1 +
 t/tests/cruft-gfdl-invariants/tags                     |    2 ++
 6 files changed, 36 insertions(+)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/empty.texi
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi

diff --git a/checks/cruft b/checks/cruft
index e4ee299..8368c1b 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -471,6 +471,15 @@ sub find_cruft {
                                         \s+ and \s+ with \s+ the \s+ Back-Cover \s+ Texts \s+ being
                                         \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)?/xis) {
                                 # verbatim text of license is ok
+                            } 
+                            when(m/\A \s* (?:(?:\,|\.|;)\s*)? version \s+ \d+(?:\.\d+)? \s+ 
+                                   (?:or \s+ any \s+ later \s+ version\s+)?
+                                   published \s+ by \s+ the \s+ Free \s+ Software \s+ Foundation \s*
+                                   (?:(?:\,|\.|;)\s*)? \z
+                                   /xis) {
+                                # empty text is ambiguous
+                                tag 'license-problem-gfdl-invariants-empty', $name;
+                                $licenseproblemhash{'gfdl-invariants'} = 1;
                             }
                             default {
                                 tag 'license-problem-gfdl-invariants', $name;
diff --git a/checks/cruft.desc b/checks/cruft.desc
index b184f9f..58daae8 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -497,3 +497,15 @@ Info: The given source file is licensed under GFDL with invariant
  suitable for main.
 Ref: http://wiki.debian.org/qa.debian.org/gfdlinvariant,
  http://www.debian.org/vote/2006/vote_001
+
+Tag: license-problem-gfdl-invariants-empty
+Severity: minor
+Certainty: possible
+Info: The given source file is licensed under GFDL, but without any 
+ precision about the presence of invariant sections, front-cover or 
+ back-cover text.
+ .
+ GFDL license explicitly requests you to document this non presence.
+ .
+Ref: http://wiki.debian.org/qa.debian.org/gfdlinvariant,
+ http://www.debian.org/vote/2006/vote_001
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/empty.texi b/t/tests/cruft-gfdl-invariants/debian/src/empty.texi
new file mode 100644
index 0000000..8e87b5f
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/empty.texi
@@ -0,0 +1,5 @@
+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. A copy of the license is included in the
+section entitled "GNU Free Documentation License".
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi b/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi
new file mode 100644
index 0000000..7ad0640
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi
@@ -0,0 +1,7 @@
+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.
+
+A copy of the license is included in the
+section entitled "GNU Free Documentation License".
diff --git a/t/tests/cruft-gfdl-invariants/desc b/t/tests/cruft-gfdl-invariants/desc
index 104ce2a..fcb9078 100644
--- a/t/tests/cruft-gfdl-invariants/desc
+++ b/t/tests/cruft-gfdl-invariants/desc
@@ -3,3 +3,4 @@ Sequence: 6000
 Version: 1.0
 Description: Check for GFDL invariants sections
 Test-For: license-problem-gfdl-invariants
+ license-problem-gfdl-invariants-empty
diff --git a/t/tests/cruft-gfdl-invariants/tags b/t/tests/cruft-gfdl-invariants/tags
index dc071c3..51fa592 100644
--- a/t/tests/cruft-gfdl-invariants/tags
+++ b/t/tests/cruft-gfdl-invariants/tags
@@ -1,3 +1,5 @@
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/frontback.html
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/frontback.texi
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/invariant.txt
+I: cruft-gfdl-invariants source: license-problem-gfdl-invariants-empty src/empty.texi
+I: cruft-gfdl-invariants source: license-problem-gfdl-invariants-empty src/emptybis.texi
-- 
1.7.10.4

