scripts/kconfig.pl: allow regex syntax in filtering out config entries

This will be used to filter out some autogenerated config values from
the kernel config files

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2020-10-20 18:54:49 +02:00
parent f307684ab2
commit 184d735707

View File

@ -102,8 +102,15 @@ sub config_sub($$) {
my $cfg1 = shift;
my $cfg2 = shift;
my %config = %{$cfg1};
foreach my $config (keys %$cfg2) {
my @keys = map {
my $expr = $_;
$expr =~ /[?.*]/ ?
map {
/^$expr$/ ? $_ : ()
} keys %config : $expr;
} keys %$cfg2;
foreach my $config (@keys) {
delete $config{$config};
}
return \%config;