Commit 4503379c authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

localmodconfig: Add debug environment variable LOCALMODCONFIG_DEBUG

If the environment variable LOCALMODCONFIG_DEBUG is set, then debug output
will appear in the make localmodconfig. This will simplify debugging what
people get with their output, as I can just tell people to do:

  LOCALMODCONFIG_DEBUG=1 make localmodconfig 2>out.txt

and have them send me the out.txt. I'll be able to see why things are not
working as they think it should be.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent d4bb58b5
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
use strict; use strict;
use Getopt::Long; use Getopt::Long;
# set the environment variable LOCALMODCONFIG_DEBUG to get
# debug output.
my $debugprint = 0;
$debugprint = 1 if (defined($ENV{LOCALMODCONFIG_DEBUG}));
sub dprint {
return if (!$debugprint);
print STDERR @_;
}
my $config = ".config"; my $config = ".config";
my $uname = `uname -r`; my $uname = `uname -r`;
...@@ -389,6 +399,7 @@ foreach my $module (keys(%modules)) { ...@@ -389,6 +399,7 @@ foreach my $module (keys(%modules)) {
my @arr = @{$objects{$module}}; my @arr = @{$objects{$module}};
foreach my $conf (@arr) { foreach my $conf (@arr) {
$configs{$conf} = $module; $configs{$conf} = $module;
dprint "$conf added by direct ($module)\n";
} }
} else { } else {
# Most likely, someone has a custom (binary?) module loaded. # Most likely, someone has a custom (binary?) module loaded.
...@@ -412,6 +423,8 @@ foreach my $line (@config_file) { ...@@ -412,6 +423,8 @@ foreach my $line (@config_file) {
my $repeat = 1; my $repeat = 1;
my $depconfig;
# #
# Note, we do not care about operands (like: &&, ||, !) we want to add any # Note, we do not care about operands (like: &&, ||, !) we want to add any
# config that is in the depend list of another config. This script does # config that is in the depend list of another config. This script does
...@@ -440,6 +453,7 @@ sub parse_config_depends ...@@ -440,6 +453,7 @@ sub parse_config_depends
# We must make sure that this config has its # We must make sure that this config has its
# dependencies met. # dependencies met.
$repeat = 1; # do again $repeat = 1; # do again
dprint "$conf selected by depend $depconfig\n";
$configs{$conf} = 1; $configs{$conf} = 1;
} }
} else { } else {
...@@ -473,15 +487,18 @@ sub parse_config_selects ...@@ -473,15 +487,18 @@ sub parse_config_selects
# Make sure that this config exists in the current .config file # Make sure that this config exists in the current .config file
if (!defined($orig_configs{$conf})) { if (!defined($orig_configs{$conf})) {
dprint "$conf not set for $config select\n";
next; next;
} }
# Check if something other than a module selects this config # Check if something other than a module selects this config
if (defined($orig_configs{$conf}) && $orig_configs{$conf} ne "m") { if (defined($orig_configs{$conf}) && $orig_configs{$conf} ne "m") {
dprint "$conf (non module) selects config, we are good\n";
# we are good with this # we are good with this
return; return;
} }
if (defined($configs{$conf})) { if (defined($configs{$conf})) {
dprint "$conf selects $config so we are good\n";
# A set config selects this config, we are good # A set config selects this config, we are good
return; return;
} }
...@@ -506,6 +523,7 @@ sub parse_config_selects ...@@ -506,6 +523,7 @@ sub parse_config_selects
$repeat = 1; $repeat = 1;
# Make this config need to be selected # Make this config need to be selected
$configs{$next_config} = 1; $configs{$next_config} = 1;
dprint "$next_config selected by select $config\n";
} }
my %process_selects; my %process_selects;
...@@ -526,6 +544,7 @@ sub loop_depend { ...@@ -526,6 +544,7 @@ sub loop_depend {
} }
$config =~ s/^CONFIG_//; $config =~ s/^CONFIG_//;
$depconfig = $config;
if (defined($depends{$config})) { if (defined($depends{$config})) {
# This config has dependencies. Make sure they are also included # This config has dependencies. Make sure they are also included
...@@ -546,6 +565,8 @@ sub loop_select { ...@@ -546,6 +565,8 @@ sub loop_select {
foreach my $config (keys %process_selects) { foreach my $config (keys %process_selects) {
$config =~ s/^CONFIG_//; $config =~ s/^CONFIG_//;
dprint "Process select $config\n";
# config has no prompt and must be selected. # config has no prompt and must be selected.
parse_config_selects $config, $selects{$config}; parse_config_selects $config, $selects{$config};
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment