tag 679124 + patch thanks Bernd Zeimetz <b...@debian.org> writes:
> Package: lintian > Version: 2.5.8 > Severity: important > > Filing as important to avoid wasting time by uploading packages which > are rejected by the ftp masters: > > To cite a mail I just got: > > * d/rules: > > dh_make template comments in there. Not amused.REJECT > > > d/rules was obviously not the original template anymore but it still had > the headers, which mainly state the origin of the file. Stating the origin is nice and all, I agree, but having unmodified comments like the dh-make template is a bit confusing (especially when I see 100+ line d/rules files with the very same comment. In those cases, I continue being not amused :P). 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. If it sees the 'Sample debian/rules that uses debhelper' line, it will emit a warning. It does check for the rest, but those are currently ignored. If so need be, increase the >= 1 in the patch to >= 4, and then it will only warn if all lines are caught. The check is fairly strict at the moment, so may miss a few cases. If that happens, and I see a package that does not trigger the warning, even when it should, I'll post an update. Also, I'm not entirely happy with the tag description.. ideally, I'd love if it would give more suggestions as to *how* to alter the template properly. Unfortunately, the time I could allocate for this patch ran out :( -- |8]
>From e7a8f198b8a93e59cc7a8cb9e294f7a2193c4537 Mon Sep 17 00:00:00 2001 From: Gergely Nagy <alger...@balabit.hu> Date: Wed, 18 Jul 2012 12:53:17 +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 <alger...@balabit.hu> --- checks/rules | 18 ++++++++++++++++++ checks/rules.desc | 9 +++++++++ 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, 42 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..8d3f99c 100644 --- a/checks/rules +++ b/checks/rules @@ -154,10 +154,24 @@ my %debhelper_group; my $maybe_skipping; my $uses_makefile_pl = 0; my %variables; +my $sample_template = 0; while (<RULES>) { while (s,\\$,, and defined (my $cont = <RULES>)) { $_ .= $cont; } + if (/^\# Sample debian\/rules that uses debhelper.\s*$/) { + $sample_template = 1; + next; + } + if ($sample_template) { + if (/^\# 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./) { + $sample_template++; + next; + } + } next if /^\s*\#/; if (m/^\s*[s-]?include\s+(\S++)/o){ my $makefile = $1; @@ -363,6 +377,10 @@ while (<RULES>) { } close RULES; +if ($sample_template >= 1) { + tag 'debian-rules-unmodified-dh-make-comments' +} + unless ($includes) { my $rec = 0; # Make sure all the required rules were seen. diff --git a/checks/rules.desc b/checks/rules.desc index 5a9dfe7..04b1325 100644 --- a/checks/rules.desc +++ b/checks/rules.desc @@ -222,3 +222,12 @@ 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. 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