kernel generate-config.pl: Be more verbose on errors

This commit is contained in:
Tuomas Tynkkynen 2016-09-13 03:18:07 +03:00
parent 15fa31d33e
commit 246bd302ec

View File

@ -91,17 +91,17 @@ sub runConfig {
print STDERR "CHOICE: $1, ANSWER: $answer\n" if $debug; print STDERR "CHOICE: $1, ANSWER: $answer\n" if $debug;
print OUT "$answer\n" if $1 =~ /-/; print OUT "$answer\n" if $1 =~ /-/;
} }
# Some questions lack the option name ("bla bla [Y/n/m/...] "). # Some questions lack the option name ("bla bla [Y/n/m/...] ").
elsif ($line =~ /(.*) \[(.*)\] ###$/) { elsif ($line =~ /(.*) \[(.*)\] ###$/) {
print OUT "\n"; print OUT "\n";
} }
else { else {
warn "don't know how to answer this question: $line\n"; warn "don't know how to answer this question: $line\n";
print OUT "\n"; print OUT "\n";
} }
$line = ""; $line = "";
%choices = (); %choices = ();
} }
@ -136,6 +136,6 @@ foreach my $name (sort (keys %answers)) {
my $f = $requiredAnswers{$name} && $ENV{'ignoreConfigErrors'} ne "1" my $f = $requiredAnswers{$name} && $ENV{'ignoreConfigErrors'} ne "1"
? sub { die "error: " . $_[0]; } : sub { warn "warning: " . $_[0]; }; ? sub { die "error: " . $_[0]; } : sub { warn "warning: " . $_[0]; };
&$f("unused option: $name\n") unless defined $config{$name}; &$f("unused option: $name\n") unless defined $config{$name};
&$f("option not set correctly: $name\n") &$f("option not set correctly: $name (wanted '$answers{$name}', got '$config{$name}')\n")
if $config{$name} && $config{$name} ne $answers{$name}; if $config{$name} && $config{$name} ne $answers{$name};
} }