From: Felix Fietkau Date: Tue, 20 Oct 2020 16:54:49 +0000 (+0200) Subject: scripts/kconfig.pl: allow regex syntax in filtering out config entries X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=184d7357077e4dd4807e647a402c974931172924;p=openwrt%2Fstaging%2Frobimarko.git 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 --- diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl index 6a6bbd2747..392f1d5841 100755 --- a/scripts/kconfig.pl +++ b/scripts/kconfig.pl @@ -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;