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

LEDE Commits lede-commits at lists.infradead.org
Fri Nov 13 07:21:21 EST 2020


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/184d7357077e4dd4807e647a402c974931172924

commit 184d7357077e4dd4807e647a402c974931172924
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Oct 20 18:54:49 2020 +0200

    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 at nbd.name>
---
 scripts/kconfig.pl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

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;



More information about the lede-commits mailing list