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

Bug#598251: Suggested patch for "Warn about leftover *.debhelper.log and *.substvars"



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tags: patch

Hey,

I made a suggestion on how to implement this, although I am a bit
conflicted. On one hand I would like to add it to the cruft check (where
the substvars check is) on the other hand it is also related to
debhelper (which is where I added it).

If anyone has any strong preferences either way, please voice them.
Otherwise I will just go with this patch.

~Niels

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJNFNalAAoJEAVLu599gGRCcKAP+wX+pbb29T1y5UlwJxWwYLeL
GtM91fSo3MeQZm4bYCDwrEeb4+suRrtubilbQY6JMyMB0GNeWnvYGIKWD14CgIWP
GFPqBzjeRoOgUwiEgUbwS0CG6Jd3wSFJexLzkz+qq6nkRk2a9LL/KaYxCEWWJUqg
mV1KvxvgC37k8TvBp4Yz0WdB81YBhw2FhB0PrGLdPbom+fgcqz2CzXas3POaHtgL
0iLrDTV+bapT/1UxeUSL6fwm1M1lXIFSX51wf6iU5CE8dWm9MmC/ywzjvRylws/f
X6koDrEoxv4HVOsHsNwQvUhZcAvDUKj5N4zI0quRx2Tv4Y9UU89P6uYHgdgwund2
gZD++wQuMDLnaiALonPr6OwdfQuK9+EarERdiALNsBkj82JOiSPum0pZRZDyqXnR
g1XqEOjUGI1vcy8Va0+xMnRCJ67oXGJGIZ8Ggv7wq0HpkdMsJlKRPhUUVoos/ErE
7CBKifXzl1J2drrquQ8B9okZq05LRTsdnFUx29MU10K7eXlVQpZH34zgJnmUUw0d
C3Moi06IzmPI8+y7UCmmKbuMDWPLkKThCY/Y2PymASg6Uo5o70ViPCZltUfunhJP
9TzI5IjOv4/EfPIRGd2B00djttG8RN/RzaVgM6ulE0HtWhV6T4mQhLi6w8hT5I0B
Kef/NQEHTesSDp58DcGK
=ruxU
-----END PGP SIGNATURE-----
>From 9a0a22bc0447f56ce9781a1ab24dc5e9d327f3dc Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Fri, 24 Dec 2010 18:17:17 +0100
Subject: [PATCH] Check for leftover internal debhelper files.

---
 checks/debhelper                                   |   15 +++++++++++++++
 checks/debhelper.desc                              |   10 ++++++++++
 .../debian/debian/package.debhelper.log            |    1 +
 .../debian/debian/package.postinst.debhelper       |    1 +
 t/tests/debhelper-internal-files/desc              |    6 ++++++
 t/tests/debhelper-internal-files/tags              |    1 +
 6 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 t/tests/debhelper-internal-files/debian/debian/package.debhelper.log
 create mode 100644 t/tests/debhelper-internal-files/debian/debian/package.postinst.debhelper
 create mode 100644 t/tests/debhelper-internal-files/desc
 create mode 100644 t/tests/debhelper-internal-files/tags

diff --git a/checks/debhelper b/checks/debhelper
index 9bd089a..3b750f7 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -241,6 +241,7 @@ if ($seendhcleank and $level >= 7) {
 
 # Check the files in the debian directory for various debhelper-related
 # things.
+my @indebfiles = ();
 opendir(DEBIAN, 'debfiles')
     or fail("Can't open debfiles directory.");
 while (defined(my $file=readdir(DEBIAN))) {
@@ -303,6 +304,8 @@ while (defined(my $file=readdir(DEBIAN))) {
 	}
     } elsif ($file =~ m/^ex\.|\.ex$/i) {
         tag "dh-make-template-in-source", "debian/$file";
+    } elsif ($file =~ m/^(?:.+\.)?debhelper(?:\.log)?/){
+	push(@indebfiles, $file);
     } else {
 	my $base = $file;
 	$base =~ s/^[.]+\.//;
@@ -329,6 +332,18 @@ while (defined(my $file=readdir(DEBIAN))) {
 }
 closedir(DEBIAN);
 
+if(scalar(@indebfiles)){
+    my $f = pop(@indebfiles);
+    my $others = scalar(@indebfiles);
+    my $otext = "";
+    if($others > 1){
+	$otext = " and $others others";
+    } elsif($others == 1){
+	$otext = " and 1 other";
+    }
+    tag "temporary-debhelper-file", "$f$otext";
+}
+
 # Check for Python policy usage and the required debhelper dependency for
 # dh_python policy support.  Assume people who intentionally set pycompat to
 # something earlier than 2 know what they're doing.  Skip CDBS packages since
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 312e78b..bf163d9 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -212,3 +212,13 @@ Info: The debhelper compatibility level specified in <tt>debian/rules</tt>
  methods to generate the compatibility level, write the output into
  <tt>debian/compat</tt> instead of setting DH_COMPAT.  The latter should
  be available for a user to override temporarily.
+
+Tag: temporary-debhelper-file
+Severity: important
+Certainty: certain
+Ref: dh_clean(1)
+Info: The package contains temporary debhelper files, which are normally
+ removed by <tt>dh_clean</tt>. The most common cause for this is that a
+ binary package has been renamed or removed without cleaning the build
+ directory first.
+
diff --git a/t/tests/debhelper-internal-files/debian/debian/package.debhelper.log b/t/tests/debhelper-internal-files/debian/debian/package.debhelper.log
new file mode 100644
index 0000000..3cb1115
--- /dev/null
+++ b/t/tests/debhelper-internal-files/debian/debian/package.debhelper.log
@@ -0,0 +1 @@
+debhelper log file for package
diff --git a/t/tests/debhelper-internal-files/debian/debian/package.postinst.debhelper b/t/tests/debhelper-internal-files/debian/debian/package.postinst.debhelper
new file mode 100644
index 0000000..1cd1647
--- /dev/null
+++ b/t/tests/debhelper-internal-files/debian/debian/package.postinst.debhelper
@@ -0,0 +1 @@
+Internal debhelper file for package
diff --git a/t/tests/debhelper-internal-files/desc b/t/tests/debhelper-internal-files/desc
new file mode 100644
index 0000000..27f964f
--- /dev/null
+++ b/t/tests/debhelper-internal-files/desc
@@ -0,0 +1,6 @@
+Testname: debhelper-internal-files
+Sequence: 6000
+Version: 1.0
+Description: Test for spotting unremoved debhelper temp files
+Test-For: temporary-debhelper-file
+
diff --git a/t/tests/debhelper-internal-files/tags b/t/tests/debhelper-internal-files/tags
new file mode 100644
index 0000000..4c588be
--- /dev/null
+++ b/t/tests/debhelper-internal-files/tags
@@ -0,0 +1 @@
+E: debhelper-internal-files source: temporary-debhelper-file package.postinst.debhelper and 1 other
-- 
1.7.2.3

Attachment: 0001-Check-for-leftover-internal-debhelper-files.patch.sig
Description: Binary data


Reply to: