[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



Hi,

On Fri, Apr 22, 2011 at 08:48:19AM +0200, Niels Thykier wrote:
On 2011-04-21 17:04, Iain Lane wrote:
Hi,

On Tue, Jul 27, 2010 at 12:42:08AM +0100, Iain Lane wrote:
tags 588873 + patch
thanks

Hiya,

[...]

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.

Ping — any chance of a review/merge?

Iain

Hey,

Sorry for the long wait.

Personally I am okay with the patch; would it be possible to convince
you to write a test case for this tag (see t/tests/README for howto/hints)?
 Feel free to submit the test in a separate patch.

Yep, here you go. I rebased the original patch too to resolve the
changelog conflict.

Good to see Lintian active :-)

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

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

diff --git a/checks/patch-systems b/checks/patch-systems
index 082ad22..4122928 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
@@ -173,6 +175,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 d3723c0..b709e15 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 8a2ce92..7b7f461 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
 lintian (2.5.0~rc4) 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.
   * checks/copyright-file.desc:
     + [ADB] Correct a spelling mistake ("coypright" -> "copyright") in the
       description of copyright-refers-to-deprecated-bsd-license-file; thanks,
-- 
1.7.4.1

From 12f699fb41c1f7905da532e0484b68a39f378a38 Mon Sep 17 00:00:00 2001
From: Iain Lane <laney@ubuntu.com>
Date: Sun, 24 Apr 2011 17:50:06 +0100
Subject: [PATCH 2/2] Add test for format-3.0-but-debian-changes-patch

---
 .../debian/debian/changelog                        |    8 ++++++++
 .../debian/debian/patches/debian-changes-1.0-1     |    7 +++++++
 .../debian/debian/patches/series                   |    1 +
 .../debian/debian/source/format                    |    1 +
 t/tests/patch-systems-quilt-debian-changes/desc    |    7 +++++++
 t/tests/patch-systems-quilt-debian-changes/tags    |    1 +
 .../patch-systems-quilt-debian-changes/upstream/a  |    1 +
 7 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/debian/debian/changelog
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/debian-changes-1.0-1
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/series
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/debian/debian/source/format
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/desc
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/tags
 create mode 100644 t/tests/patch-systems-quilt-debian-changes/upstream/a

diff --git a/t/tests/patch-systems-quilt-debian-changes/debian/debian/changelog b/t/tests/patch-systems-quilt-debian-changes/debian/debian/changelog
new file mode 100644
index 0000000..0ee9644
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/debian/debian/changelog
@@ -0,0 +1,8 @@
+patch-systems-quilt-debian-changes (1.0-1) unstable; urgency=low
+
+  * Lintian Test Suite.
+  * Test: basic
+
+  * Suppress "should close ITP bug" messages.  (Closes: #123456)
+
+ -- Debian Lintian Maintainers <lintian-maint@debian.org>  Sun, 24 Apr 2011 17:47:32 +0100
diff --git a/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/debian-changes-1.0-1 b/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/debian-changes-1.0-1
new file mode 100644
index 0000000..7d0132f
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/debian-changes-1.0-1
@@ -0,0 +1,7 @@
+This is a description of the patch
+
+--- a/a	2008-11-11 19:38:12.000000000 +0000
++++ a/a	2008-11-11 19:38:26.000000000 +0000
+@@ -1 +1,2 @@
+ sample text
++and some more sample text
diff --git a/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/series b/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/series
new file mode 100644
index 0000000..9ca2b60
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/debian/debian/patches/series
@@ -0,0 +1 @@
+debian-changes-1.0-1
diff --git a/t/tests/patch-systems-quilt-debian-changes/debian/debian/source/format b/t/tests/patch-systems-quilt-debian-changes/debian/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/debian/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/t/tests/patch-systems-quilt-debian-changes/desc b/t/tests/patch-systems-quilt-debian-changes/desc
new file mode 100644
index 0000000..bac7756
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/desc
@@ -0,0 +1,7 @@
+Testname: patch-systems-quilt-debian-changes
+Sequence: 6000
+Version: 1.0
+Description: Test a 3.0 (quilt) package which has a debian-changes-XXX patch
+Type: non-native
+Test-For:
+ format-3.0-but-debian-changes-patch
diff --git a/t/tests/patch-systems-quilt-debian-changes/tags b/t/tests/patch-systems-quilt-debian-changes/tags
new file mode 100644
index 0000000..a1c46dd
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/tags
@@ -0,0 +1 @@
+W: patch-systems-quilt-debian-changes source: format-3.0-but-debian-changes-patch
diff --git a/t/tests/patch-systems-quilt-debian-changes/upstream/a b/t/tests/patch-systems-quilt-debian-changes/upstream/a
new file mode 100644
index 0000000..c0acc64
--- /dev/null
+++ b/t/tests/patch-systems-quilt-debian-changes/upstream/a
@@ -0,0 +1 @@
+sample text
-- 
1.7.4.1

Attachment: signature.asc
Description: Digital signature


Reply to: