Subject: [PATCH] Implement direct-changes-in-diff-but-no-patch-system as a pedantic tag

From: Raphael Geissert <[email-masked]>
Date: Sun, 11 Jan 2009 12:23:11 -0600

Signed-off-by: Raphael Geissert <[email-masked]>
---
 checks/patch-systems      |   33 +++++++++++++++++----------------
 checks/patch-systems.desc |   10 ++++++++++
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/checks/patch-systems b/checks/patch-systems
index 2a79452..62dd8e0 100644
--- a/checks/patch-systems
+++ b/checks/patch-systems
@@ -178,23 +178,24 @@ sub run {

 	#----- general cruft checking:
-	if ($uses_patch_system) {
-		if ($uses_patch_system > 1) {
-			tag "more-than-one-patch-system";
-		}
+	if ($uses_patch_system > 1) {
+		tag "more-than-one-patch-system";
+	}
+	my @direct;
+	open(STAT, '<', "diffstat") or fail("cannot open diffstat file: $!");
+	while (<STAT>) {
+		my ($file) = (m,^\s+(.*?)\s+\|,)
+		     or fail("syntax error in diffstat file: $_");
+		push (@direct, $file) if ($file !~ m,^debian/,);
+	}
+	close (STAT) or fail("error reading diffstat file: $!");
+	if (@direct) {
+		my $files = (@direct > 1) ? "$direct[0] and $#direct more" : $direct[0];
 
-		my @direct;
-		open(STAT, '<', "diffstat") or fail("cannot open diffstat file: $!");
-		while (<STAT>) {
-			my ($file) = (m,^\s+(.*?)\s+\|,)
-			     or fail("syntax error in diffstat file: $_");
-			push (@direct, $file) if ($file !~ m,^debian/,);
-		}
-		close (STAT) or fail("error reading diffstat file: $!");
-		if (@direct) {
-			my $files = (@direct > 1) ? "$direct[0] and $#direct more" : $direct[0];
-			tag "patch-system-but-direct-changes-in-diff", $files;
-		}
+		tag "patch-system-but-direct-changes-in-diff", $files
+			if ($uses_patch_system);
+		tag "direct-changes-in-diff-but-no-patch-system", $files
+			if (not $uses_patch_system);
 	}
 }
 
diff --git a/checks/patch-systems.desc b/checks/patch-systems.desc
index cee7c93..54174d3 100644
--- a/checks/patch-systems.desc
+++ b/checks/patch-systems.desc
@@ -108,3 +108,13 @@ Info: The build-dependencies list more than one patch system and it's
  unlikely that you need both at the same time.
  .
  Currently lintian knows only dpatch and quilt.
+
+Tag: direct-changes-in-diff-but-no-patch-system
+Severity: pedantic
+Certainty: certain
+Info: The Debian diff.gz contains changes to files or creation of additional
+ files outside the <tt>debian</tt> directory.  Keeping the changes as separate
+ patches under the control of a patch system allows for more fine grained
+ control over them.  The package will also more easily support  possible
+ future source package formats if all changes outside the <tt>debian</tt>
+ directory are stored as patches.