[SCM] Debian package checker branch, master, updated. 2.5.13-20-g7fbbd8a
The following commit has been merged in the master branch:
commit d6122984a04c8cc4029beec7c4a07a4ecefa8d52
Author: Niels Thykier <niels@thykier.net>
Date: Thu Jun 13 11:24:08 2013 +0200
c/cruft: Merge a loop into find_cruft
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/cruft b/checks/cruft
index 71d04c5..8a3c6d3 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -150,34 +150,6 @@ my $abs = Cwd::abs_path ("$uroot/") or fail "abs_path $uroot: $!";
$abs =~ s,/$,,; # remove the trailing slash if any
find_cruft($info, \%warned, $atdinbd, $ltinbd);
-# Look for cruft based on file's results, but allow cruft in test directories
-# where it may be part of a test suite.
-for my $file ($info->sorted_index) {
- next if ($file =~ m,(?:^|/)t(?:est(?:s(?:et)?)?)?/,);
- my $file_info = $info->file_info ($file);
- if ($file_info =~ m/\bELF\b/) {
- tag 'source-contains-prebuilt-binary', $file;
- } elsif ($file_info =~ m/\b(?:PE(?:32|64)|(?:MS-DOS|COFF) executable)\b/) {
- tag 'source-contains-prebuilt-windows-binary', $file;
- } elsif ($file =~ /\bwaf$/) {
- my $path = $info->unpacked($file);
- my $marker = 0;
- next unless -f $path and is_ancestor_of($uroot, $path);
- open(my $fd, '<', $path);
- while ( my $line = <$fd> ) {
- next unless $line =~ m/^#/o;
- if ($marker && $line =~ m/^#BZ[h0][0-9]/o) {
- tag 'source-contains-waf-binary', $file;
- last;
- }
- $marker = 1 if $line =~ m/^#==>/o;
- # We could probably stop here, but just in case
- $marker = 0 if $line =~ m/^#<==/o;
- }
- close($fd);
- }
-}
-
for my $file (@EOL_TERMINATORS_FILES) {
my $path = $info->debfiles($file);
next if not -f $path or not is_ancestor_of($droot, $path);
@@ -333,6 +305,7 @@ sub find_cruft {
my $name = $entry->name;
my $basename = $entry->basename;
my $path;
+ my $file_info;
if ($entry->is_dir) {
# Remove the trailing slash (historically we never included the slash
@@ -376,6 +349,30 @@ sub find_cruft {
# we just need normal files for the rest
next ENTRY unless $entry->is_file;
+ $file_info = $info->file_info($name);
+
+ if ($file_info =~ m/\bELF\b/) {
+ tag 'source-contains-prebuilt-binary', $name;
+ } elsif ($file_info =~ m/\b(?:PE(?:32|64)|(?:MS-DOS|COFF) executable)\b/) {
+ tag 'source-contains-prebuilt-windows-binary', $name;
+ } elsif ($basename =~ /\bwaf$/) {
+ my $path = $info->unpacked($entry);
+ my $marker = 0;
+ open(my $fd, '<', $path);
+ while ( my $line = <$fd> ) {
+ next unless $line =~ m/^#/o;
+ if ($marker && $line =~ m/^#BZ[h0][0-9]/o) {
+ tag 'source-contains-waf-binary', $name;
+ last;
+ }
+ $marker = 1 if $line =~ m/^#==>/o;
+ # We could probably stop here, but just in case
+ $marker = 0 if $line =~ m/^#<==/o;
+ }
+ close($fd);
+ }
+
+
unless ($warned->{$name}) {
for my $rule (@file_checks) {
next if ($rule->[2] and not $info->native);
--
Debian package checker
Reply to: