From b08b225e44bedf99d2ef16819753d73900ed791a Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Thu, 9 Aug 2012 09:23:22 -0400 Subject: [PATCH] --- yaml --- r: 323498 b: refs/heads/master c: e0d28694d33dc7f37832b4fe4fe229655a64f991 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/scripts/kconfig/streamline_config.pl | 30 ++++++++++------------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 877528c80cf3..26327bf62f08 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3f0c54131679889d64e8b1831bac40c0d64cf511 +refs/heads/master: e0d28694d33dc7f37832b4fe4fe229655a64f991 diff --git a/trunk/scripts/kconfig/streamline_config.pl b/trunk/scripts/kconfig/streamline_config.pl index 62d64ce5c581..22b66cada779 100644 --- a/trunk/scripts/kconfig/streamline_config.pl +++ b/trunk/scripts/kconfig/streamline_config.pl @@ -171,8 +171,8 @@ sub read_kconfig { $source =~ s/\$$env/$ENV{$env}/; } - open(KIN, "$source") || die "Can't open $kconfig"; - while () { + open(my $kinfile, '<', $source) || die "Can't open $kconfig"; + while (<$kinfile>) { chomp; # Make sure that lines ending with \ continue @@ -249,7 +249,7 @@ sub read_kconfig { $state = "NONE"; } } - close(KIN); + close($kinfile); # read in any configs that were found. foreach $kconfig (@kconfigs) { @@ -293,8 +293,8 @@ sub convert_vars { my $line = ""; my %make_vars; - open(MIN,$makefile) || die "Can't open $makefile"; - while () { + open(my $infile, '<', $makefile) || die "Can't open $makefile"; + while (<$infile>) { # if this line ends with a backslash, continue chomp; if (/^(.*)\\$/) { @@ -341,10 +341,11 @@ sub convert_vars { } } } - close(MIN); + close($infile); } my %modules; +my $linfile; if (defined($lsmod_file)) { if ( ! -f $lsmod_file) { @@ -354,13 +355,10 @@ sub convert_vars { die "$lsmod_file not found"; } } - if ( -x $lsmod_file) { - # the file is executable, run it - open(LIN, "$lsmod_file|"); - } else { - # Just read the contents - open(LIN, "$lsmod_file"); - } + + my $otype = ( -x $lsmod_file) ? '-|' : '<'; + open($linfile, $otype, $lsmod_file); + } else { # see what modules are loaded on this system @@ -377,16 +375,16 @@ sub convert_vars { $lsmod = "lsmod"; } - open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod"; + open($linfile, '-|', $lsmod) || die "Can not call lsmod with $lsmod"; } -while () { +while (<$linfile>) { next if (/^Module/); # Skip the first line. if (/^(\S+)/) { $modules{$1} = 1; } } -close (LIN); +close ($linfile); # add to the configs hash all configs that are needed to enable # a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o