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

[SCM] Debian package checker branch, master, updated. 2.2.5-47-ga0b70fe



The following commit has been merged in the master branch:
commit a0b70fe04df4b141c337aabc37791d997a632ce8
Author: Russ Allbery <rra@debian.org>
Date:   Sat Feb 21 17:31:37 2009 -0800

    Ignore cruft in upstream test directories
    
    * checks/cruft:
      + [RA] Ignore cruft in the upstream source in directories that look
        like part of a test suite.  The files may be part of the test
        cases.  (Closes: #515137)

diff --git a/checks/cruft b/checks/cruft
index 2dcf01c..209e22d 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -123,9 +123,11 @@ if ($format =~ /^\s*2\.0\s*\z/ or $format =~ /^\s*3\.0\s*\(quilt\)/) {
 my $wanted = sub { find_cruft($pkg, $info, \%warned, $atdinbd) };
 find($wanted, 'unpacked');
 
-# Look for cruft based on file's results
+# Look for cruft based on file's results, but allow cruft in test directories
+# where it may be part of a test suite.
 my $file_info = $info->file_info;
 for my $file (keys(%$file_info)) {
+    next if ($file =~ m,(?:^|/)t(?:est(?:s(?:et)?)?)?/,);
     if ($file_info->{$file} =~ m/\bELF\b/) {
 	tag "source-contains-prebuilt-binary", $file;
     } elsif ($file_info->{$file} =~ m/\bPE(32|64)\b/) {
@@ -240,7 +242,12 @@ sub check_debfiles {
 sub find_cruft {
     my ($pkg, $info, $warned, $atdinbd) = @_;
     (my $name = $File::Find::name) =~ s,^(\./)?unpacked/,,;
-    return if $name =~ m,^t(?:estset)?/, and $pkg eq 'lintian';
+
+    # Ignore files in test suites.  They may be part of the test.
+    if (-d and m,^t(?:est(?:s(?:et)?)?)?\z,) {
+        $File::Find::prune = 1;
+        return;
+    }
 
     my $prefix = ($info->native ? "diff-contains" : "source-contains");
     if (-d and not $warned->{$name}) {
diff --git a/debian/changelog b/debian/changelog
index 4acaed9..6d70e8a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,9 @@ lintian (2.2.6) UNRELEASED; urgency=low
     + [RA] For Format: 2.0 and Format: 3.0 (quilt) packages, check
       the *.debian.tar.(gz|bz2|lzma) contents instead of expecting
       diffstat output.  (Closes: #515069)
+    + [RA] Ignore cruft in the upstream source in directories that look
+      like part of a test suite.  The files may be part of the test
+      cases.  (Closes: #515137)
   * checks/deb-format{,.desc}:
     + [RA] Recognize data.tar.lzma binary package components and use a
       different tag than malformed-deb-archive.
diff --git a/t/tests/cruft-general-upstream/desc b/t/tests/cruft-general-test-suite/desc
similarity index 80%
copy from t/tests/cruft-general-upstream/desc
copy to t/tests/cruft-general-test-suite/desc
index 58bfaea..8d8a0d6 100644
--- a/t/tests/cruft-general-upstream/desc
+++ b/t/tests/cruft-general-test-suite/desc
@@ -1,11 +1,11 @@
-Testname: cruft-general-upstream
+Testname: cruft-general-test-suite
 Sequence: 6000
 Version: 1.0-1
 Type: non-native
 Skeleton: pedantic
 Options: --pedantic -I -E
-Description: Check for cruft in the upstream source
-Test-For:
+Description: Check that cruft in test suites is okay
+Test-Against:
  configure-generated-file-in-source
  source-contains-arch-control-dir
  source-contains-arch-inventory-file
@@ -16,6 +16,7 @@ Test-For:
  source-contains-git-control-dir
  source-contains-hg-control-dir
  source-contains-hg-tags-file
+ source-contains-prebuilt-binary
  source-contains-svk-commit-file
  source-contains-svn-commit-file
  source-contains-svn-conflict-file
diff --git a/t/tests/cruft-general-test-suite/pre_upstream b/t/tests/cruft-general-test-suite/pre_upstream
new file mode 100755
index 0000000..8665c92
--- /dev/null
+++ b/t/tests/cruft-general-test-suite/pre_upstream
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Create all the various junk that shouldn't exist upstream.  We do much of it
+# here rather than in the template so that Lintian itself can be imported into
+# revision control systems.
+
+set -e
+dir="$1"
+
+mkdir -p "${dir}/t/CVS"
+echo 'source-contains-cvs-control-dir' > "${dir}/t/CVS/Entries"
+mkdir -p "${dir}/foo/t/.svn"
+echo 'source-contains-svn-control-dir' > "${dir}/foo/t/.svn/format"
+mkdir -p "${dir}/test/.bzr"
+echo 'source-contains-bzr-control-dir' > "${dir}/test/.bzr/foo"
+mkdir -p "${dir}/bar/test/{arch}"
+echo 'source-contains-arch-control-dir' > "${dir}/bar/test/{arch}/foo"
+mkdir -p "${dir}/tests/.git"
+echo 'source-contains-git-control-dir' > "${dir}/tests/.git/foo"
+mkdir -p "${dir}/baz/foo/tests/.hg"
+echo 'source-contains-hg-control-dir' > "${dir}/baz/foo/tests/.hg/foo"
+mkdir -p "${dir}/testset/.be"
+echo 'source-contains-bts-control-dir' > "${dir}/testset/.be/foo"
+
+echo 'source-contains-svn-commit-file' > "${dir}/t/svn-commit.tmp"
+echo 'source-contains-svk-commit-file' > "${dir}/t/svk-commit444.tmp"
+echo 'source-contains-arch-inventory-file' > "${dir}/t/.arch-inventory"
+echo 'source-contains-hg-tags-file' > "${dir}/t/.hgtags"
+echo 'source-contains-cvs-conflict-copy' > "${dir}/t/.#foo.1.1"
+echo 'source-contains-svn-conflict-file' > "${dir}/t/foo.r1352"
+
+echo 'configure-generated-file-in-source' > "${dir}/tests/config.cache"
+
+cd "$1"
+gcc -o t/hello hello.c
diff --git a/t/source/unpack-srcpkg-dot-dir/tags b/t/tests/cruft-general-test-suite/tags
similarity index 100%
copy from t/source/unpack-srcpkg-dot-dir/tags
copy to t/tests/cruft-general-test-suite/tags
diff --git a/t/tests/cruft-upstream-binaries/upstream/hello.c b/t/tests/cruft-general-test-suite/upstream/hello.c
similarity index 100%
copy from t/tests/cruft-upstream-binaries/upstream/hello.c
copy to t/tests/cruft-general-test-suite/upstream/hello.c

-- 
Debian package checker


Reply to: