Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig:
  kconfig: Have streamline_config process menuconfigs too
  kconfig: Fix streamline_config to read multi line deps in Kconfig files
  kconfig: Fix missing declaration of variable $dir in streamline_config.pl
  kconfig: Fix variable name typo %prompts in streamline_config.pl
  kconfig: Make localmodconfig handle environment variables
This commit is contained in:
Linus Torvalds 2010-10-29 14:43:30 -07:00
commit b7bdcc4711

View file

@ -42,6 +42,8 @@
# mv config_strip .config # mv config_strip .config
# make oldconfig # make oldconfig
# #
use strict;
my $config = ".config"; my $config = ".config";
my $uname = `uname -r`; my $uname = `uname -r`;
@ -123,7 +125,6 @@ my %selects;
my %prompts; my %prompts;
my %objects; my %objects;
my $var; my $var;
my $cont = 0;
my $iflevel = 0; my $iflevel = 0;
my @ifdeps; my @ifdeps;
@ -137,19 +138,45 @@ sub read_kconfig {
my $config; my $config;
my @kconfigs; my @kconfigs;
open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; my $cont = 0;
my $line;
my $source = "$ksource/$kconfig";
my $last_source = "";
# Check for any environment variables used
while ($source =~ /\$(\w+)/ && $last_source ne $source) {
my $env = $1;
$last_source = $source;
$source =~ s/\$$env/$ENV{$env}/;
}
open(KIN, "$source") || die "Can't open $kconfig";
while (<KIN>) { while (<KIN>) {
chomp; chomp;
# Make sure that lines ending with \ continue
if ($cont) {
$_ = $line . " " . $_;
}
if (s/\\$//) {
$cont = 1;
$line = $_;
next;
}
$cont = 0;
# collect any Kconfig sources # collect any Kconfig sources
if (/^source\s*"(.*)"/) { if (/^source\s*"(.*)"/) {
$kconfigs[$#kconfigs+1] = $1; $kconfigs[$#kconfigs+1] = $1;
} }
# configs found # configs found
if (/^\s*config\s+(\S+)\s*$/) { if (/^\s*(menu)?config\s+(\S+)\s*$/) {
$state = "NEW"; $state = "NEW";
$config = $1; $config = $2;
for (my $i = 0; $i < $iflevel; $i++) { for (my $i = 0; $i < $iflevel; $i++) {
if ($i) { if ($i) {
@ -178,7 +205,7 @@ sub read_kconfig {
# configs without prompts must be selected # configs without prompts must be selected
} elsif ($state ne "NONE" && /^\s*tristate\s\S/) { } elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
# note if the config has a prompt # note if the config has a prompt
$prompt{$config} = 1; $prompts{$config} = 1;
# Check for if statements # Check for if statements
} elsif (/^if\s+(.*\S)\s*$/) { } elsif (/^if\s+(.*\S)\s*$/) {
@ -218,6 +245,8 @@ if ($kconfig) {
# Read all Makefiles to map the configs to the objects # Read all Makefiles to map the configs to the objects
foreach my $makefile (@makefiles) { foreach my $makefile (@makefiles) {
my $cont = 0;
open(MIN,$makefile) || die "Can't open $makefile"; open(MIN,$makefile) || die "Can't open $makefile";
while (<MIN>) { while (<MIN>) {
my $objs; my $objs;
@ -281,7 +310,7 @@ if (defined($lsmod_file)) {
# see what modules are loaded on this system # see what modules are loaded on this system
my $lsmod; my $lsmod;
foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
if ( -x "$dir/lsmod" ) { if ( -x "$dir/lsmod" ) {
$lsmod = "$dir/lsmod"; $lsmod = "$dir/lsmod";
last; last;
@ -363,7 +392,7 @@ while ($repeat) {
parse_config_dep_select $depends{$config}; parse_config_dep_select $depends{$config};
} }
if (defined($prompt{$config}) || !defined($selects{$config})) { if (defined($prompts{$config}) || !defined($selects{$config})) {
next; next;
} }