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

Bug#679124: lintian: error on d/rules having dh_make templates



Gergely Nagy <algernon@balabit.hu> writes:

> I also agree that it would be very neat if Lintian would have a check
> that caught this, if for nothing else, it would make me less grumpy. For
> that reason, find a patch attached that does just that.

Updated patch follows. It was trimmed down to only check for the "Sample
debian/rules that uses debhelper." line, dropping $sample_template
altogether.

I also improved the tag description to be more helpful.

-- 
|8]

>From cb2f7c6b15fc271be30ed9e1f9ccf6005dd3c6ff Mon Sep 17 00:00:00 2001
From: Gergely Nagy <algernon@balabit.hu>
Date: Thu, 19 Jul 2012 14:43:31 +0200
Subject: [PATCH] c/rules: Check for unmodified dh-make copyright comments

dh-make adds a "Sample debian/rules that uses debhelper" line,
followed by a few others to short-form dh templates. This is all fine,
but seeing real packages, with far more complex d/rules than the
original sample call themselves sample is a little bit confusing.

This patch introduces a new check, that will notify the maintainer
about an unchanged boilerplate, and advise changing it.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
---
 checks/rules                                       |    3 +++
 checks/rules.desc                                  |   11 +++++++++++
 t/tests/rules-dh-make-comments/debian/debian/rules |    9 +++++++++
 t/tests/rules-dh-make-comments/desc                |    5 +++++
 t/tests/rules-dh-make-comments/tags                |    1 +
 5 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100755 t/tests/rules-dh-make-comments/debian/debian/rules
 create mode 100644 t/tests/rules-dh-make-comments/desc
 create mode 100644 t/tests/rules-dh-make-comments/tags

diff --git a/checks/rules b/checks/rules
index e02d7a6..8602d57 100644
--- a/checks/rules
+++ b/checks/rules
@@ -158,6 +158,9 @@ while (<RULES>) {
     while (s,\\$,, and defined (my $cont = <RULES>)) {
         $_ .= $cont;
     }
+    if (/^\# Sample debian\/rules that uses debhelper./) {
+        tag 'debian-rules-unmodified-dh-make-comments'
+    }
     next if /^\s*\#/;
     if (m/^\s*[s-]?include\s+(\S++)/o){
         my $makefile = $1;
diff --git a/checks/rules.desc b/checks/rules.desc
index 5a9dfe7..78c0090 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -222,3 +222,14 @@ Info: The source package does not have both a build-arch and a build-indep
  .
  Please consider adding both the build-arch and build-indep targets.
 
+Tag: debian-rules-unmodified-dh-make-comments
+Severity: wishlist
+Certainty: possible
+Ref: #679124
+Info: The rules file says it is a sample debian/rules that uses
+ debhelper, while in reality, it isn't. At most, it is based on the
+ sample provided by dh-make.
+ .
+ Please consider adjusting the comments accordingly, for example by
+ changing the "Sample debian/rules that uses debhelper" line into
+ someting like "Based on the sample debian/rules that uses debhelper".
diff --git a/t/tests/rules-dh-make-comments/debian/debian/rules b/t/tests/rules-dh-make-comments/debian/debian/rules
new file mode 100755
index 0000000..d7074ba
--- /dev/null
+++ b/t/tests/rules-dh-make-comments/debian/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+%:
+	dh $@
diff --git a/t/tests/rules-dh-make-comments/desc b/t/tests/rules-dh-make-comments/desc
new file mode 100644
index 0000000..e685c75
--- /dev/null
+++ b/t/tests/rules-dh-make-comments/desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-make-comments
+Sequence: 6000
+Version: 1.0
+Description: Tests for unmodified dh-make comments in rules files
+Test-For: debian-rules-unmodified-dh-make-comments
diff --git a/t/tests/rules-dh-make-comments/tags b/t/tests/rules-dh-make-comments/tags
new file mode 100644
index 0000000..d01fcd7
--- /dev/null
+++ b/t/tests/rules-dh-make-comments/tags
@@ -0,0 +1 @@
+I: rules-dh-make-comments source: debian-rules-unmodified-dh-make-comments
-- 
1.7.9


Reply to: