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

Bug#588873: lintian: [new check] Warn if using 3.0 (quilt) and there is a debian-changes-xxx patch



tags 588873 + patch
thanks

Hiya,

On Sun, Jul 25, 2010 at 06:29:06PM -0700, Russ Allbery wrote:
Iain Lane <laney@ubuntu.com> writes:

I'd dlike to propose a new check which is analogous to
patch-system-but-direct-changes-in-diff but for 3.0 (quilt).

[...]

What do you think? If the consensus is that this is a good idea then
I'll have a go at implementing.

Most of my packages intentionally have only that patch.  Maybe only
trigger it if debian/source/patch-header doesn't exist and mention that if
this is intentional, creating that file allows adding a custom header to
the generated patch explaining why this is done?  That could avoid the
numerous false positives of patch-system-but-direct-changes-in-diff and
make it less wild-guessy.

Otherwise, seems like a good idea to me.

Thanks. This was easier than I thought it would be to cook up: attached.

My first Lintian patch; please review for code style.

It might be worth checking for single-debian-patch and no patch-header too, but that would be something else.

Cheers,
Iain
From ea3aba29cb49a861ab7bc97f91b294e1d3ad7ebb Mon Sep 17 00:00:00 2001
From: Iain Lane <laney@ubuntu.com>
Date: Mon, 26 Jul 2010 22:43:28 +0100
Subject: [PATCH] Add check for direct changes in 3.0 (quilt) packages

---
 checks/patch-systems      |    9 +++++++++
 checks/patch-systems.desc |   13 +++++++++++++
 debian/changelog          |   11 +++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/checks/patch-systems b/checks/patch-systems
index 9934d46..4943751 100644
--- a/checks/patch-systems
+++ b/checks/patch-systems
@@ -46,6 +46,8 @@ sub run {
 	}
 	my $quilt_format = ($format =~ /3\.\d+ \(quilt\)/) ? 1 : 0;
 
+	my $version = $info->field("version");
+
 	my $cwd = realpath('.');
 
 	#----- dpatch
@@ -170,6 +172,13 @@ sub run {
 				}
 			}
 		}
+		if ($quilt_format) { # 3.0 (quilt) specific checks
+		    # Format 3.0 packages may generate a debian-changes-$version patch
+		    if (-f "debfiles/patches/debian-changes-$version" && 
+			! -f "debfiles/debian/source/patch-header") {
+			tag "format-3.0-but-debian-changes-patch";
+		    }
+		}
 	} else {
 		if (-r "debfiles/patches/series" and
 		    -f "debfiles/patches/series") {
diff --git a/checks/patch-systems.desc b/checks/patch-systems.desc
index d77749b..ca3d355 100644
--- a/checks/patch-systems.desc
+++ b/checks/patch-systems.desc
@@ -123,6 +123,19 @@ Info: The package uses a patch system, but the Debian diff.gz contains
  possible future source package formats if all changes outside the
  <tt>debian</tt> directory are stored as patches.
 
+Tag: format-3.0-but-debian-changes-patch
+Severity: minor
+Certainty: certain
+Info: This package declares source format 3.0 (quilt), but the Debian
+ .debian.tar.gz file contains a debian-changes-VERSION patch, which represents
+ direct changes to files outside of the <tt>debian</tt> directory. This often
+ indicates accidental changes that weren't meant to be in the package or changes
+ that were supposed to be separated out into a patch.
+ .
+ If this is intentional, you may wish to consider adding
+ <tt>single-debian-patch</tt> to <tt>debian/source/options</tt>, and/or a patch
+ header to <tt>debian/source/patch-header</tt> explaining why this is done.
+
 Tag: more-than-one-patch-system
 Severity: minor
 Certainty: certain
diff --git a/debian/changelog b/debian/changelog
index 25709f9..df90bfc 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+lintian (2.4.4) UNRELEASED; urgency=low
+
+  * Summary of tag changes:
+    + Added:
+      - format-3.0-but-debian-changes-patch
+  * checks/patch-systems{,.desc}
+    + [IL] Detect when 3.0 (quilt) packages have a debian-changes-VERSION
+      patch without a patch header.
+
+ -- Iain Lane <laney@ubuntu.com>  Mon, 26 Jul 2010 22:43:56 +0100
+
 lintian (2.4.3) unstable; urgency=low
 
   The "Policy 3.9.1" release.
-- 
1.7.1

Attachment: signature.asc
Description: Digital signature


Reply to: