diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2011-05-23 14:44:55 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-05-24 10:07:07 -0400 |
commit | de7b0b4110795be914e6cafdfec4276b2618cc78 (patch) | |
tree | 7800d8bc7778229004a95e1599a334095d8c4d43 /scripts | |
parent | 2ee2d29289951b4cb7578d75f199e4aa4084fe6f (diff) |
export_report: do collectcfiles work in perl itself
Avoid spawning a shell pipeline doing cat, grep, sed, and do it all
inside perl. The <*.c> globbing construct works at least as far back
as 5.8.9
Note that this is not just an optimization; the sed command
in the pipeline was unterminated, due to lack of escape on the
end-of-line (\$) in the regex, resulting in this:
$ perl ../linux-2.6/scripts/export_report.pl > /dev/null
sed: -e expression #1, char 5: unterminated `s' command
sh: .mod.c/: not found
Comments on an earlier patch sought an all-perl implementation.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
cc: Michal Marek <mmarek@suse.cz>,
cc: linux-kbuild@vger.kernel.org
cc: Arnaud Lacombe lacombar@gmail.com
cc: Stephen Hemminger shemminger@vyatta.com
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/export_report.pl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 04dce7c15f83..f97899c87923 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl | |||
@@ -49,8 +49,14 @@ sub usage { | |||
49 | } | 49 | } |
50 | 50 | ||
51 | sub collectcfiles { | 51 | sub collectcfiles { |
52 | my @file | 52 | my @file; |
53 | = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; | 53 | while (<.tmp_versions/*.mod>) { |
54 | open my $fh, '<', $_ or die "cannot open $_: $!\n"; | ||
55 | push (@file, | ||
56 | grep s/\.ko/.mod.c/, # change the suffix | ||
57 | grep m/.+\.ko/, # find the .ko path | ||
58 | <$fh>); # lines in opened file | ||
59 | } | ||
54 | chomp @file; | 60 | chomp @file; |
55 | return @file; | 61 | return @file; |
56 | } | 62 | } |