Package: sloccount Version: 2.26-2.1 Followup-For: Bug #281293 attached is a patch that ignores files generated by autotools
-- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.24.2 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
diff -u sloccount-2.26/break_filelist sloccount-2.26-autotool/break_filelist --- sloccount-2.26/break_filelist 2004-08-01 06:17:28.000000000 +0200 +++ sloccount-2.26-autotool/break_filelist 2008-02-20 13:21:20.000000000 +0100 @@ -149,6 +149,7 @@ # .am automake input %file_extensions = ( + "am" => "makefile", "c" => "ansic", "ec" => "ansic", # Informix C. "ecp" => "ansic", # Informix C. @@ -966,6 +967,23 @@ return "auto"; } + # Skip files generated by auto-* tools. These can be identified by a + # matching file with an ".in" or ".am" extension. + if (-s "${file_to_examine}.in") { + print "Note: Auto-generated file $file_to_examine\n" + if $noisy; + return "auto"; + } + if ($file_to_examine =~ m/\.in$/) { + $possible_auto = $file_to_examine; + $possible_auto =~ s/\.in$/\.am/; + if (-s "$possible_auto") { + print "Note: Auto-generated file $file_to_examine\n" + if $noisy; + return "auto"; + } + } + if (($basename eq "lex.yy.c") || # Flex/Lex output! ($basename eq "lex.yy.cc") || # Flex/Lex output - C++ scanner. ($basename eq "y.code.c") || # yacc/bison output. @@ -1013,6 +1031,8 @@ if (($file_to_examine =~ m/\bmakefile$/i) || ($file_to_examine =~ m/\bmakefile\.txt$/i) || ($file_to_examine =~ m/\bmakefile\.pc$/i) || + ($file_to_examine =~ m/\bmakefile\.in$/i) || + ($file_to_examine =~ m/\bmakefile\.am$/i) || ($file_to_examine =~ m/\bdebian\/rules$/i)) { # "debian/rules" too. return "makefile"; }