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

[SCM] Debian package checker branch, master, updated. 2.5.4-141-g2e7e7ae



The following commit has been merged in the master branch:
commit 2e7e7aecd9e616e5038e9e6dfa085b96d1e4f631
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Feb 4 14:14:30 2012 +0100

    cruft: Double check waf files if file(1) says ok
    
    Unfortunately file 5.04 (Squeeze) says the waf file in the Lintian
    test suite is "python" and not "data".
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/cruft b/checks/cruft
index c5e7994..bafe8fa 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -151,7 +151,30 @@ for my $file (keys(%$file_info)) {
         tag 'source-contains-prebuilt-binary', $file;
     } elsif ($file_info->{$file} =~ m/\b(?:PE(?:32|64)|COFF executable)\b/) {
         tag 'source-contains-prebuilt-windows-binary', $file;
-    } elsif ($file_info->{$file} =~ m/data/ and $file =~ /\bwaf$/) {
+    } elsif ($file =~ /\bwaf$/) {
+        my $ok = 1;
+        # If file believes this is data, then we trust that
+        $ok = 0 if $file_info->{$file} =~ m/data/;
+        if ($ok) {
+            # Unfortunately file 5.04 (Squeeze) and 5.09 does not
+            # always agree, so manually check for the bz2 entry if
+            # file does not declare it as "data".
+            my $path = $info->unpacked ($file);
+            my $marker = 0;
+            next unless -f $path;
+            open my $fd, '<', $path or fail "Opening $file: $!";
+            while ( my $line = <$fd> ) {
+                next unless $line =~ m/^#/o;
+                if ($marker && $line =~ m/^#BZ[h0][0-9]/o) {
+                    $ok = 0;
+                    last;
+                }
+                $marker = 1 if $line =~ m/^#==>/o;
+                # We could probably stop here, but just in case
+                $marker = 0 if $line =~ m/^#<==/o;
+            }
+            close $fd;
+        }
         tag 'source-contains-waf-binary', $file;
     }
 }

-- 
Debian package checker


Reply to: