From patchwork Thu Nov 30 05:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QFYVmNUH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmJV0fYPz1ySd for ; Tue, 5 Dec 2023 14:30:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mckYH/Qo8/VJ9yTDbUbeP0D3ba/OebCO6dAjLmaYhms=; b=QFYVmNUH830TO0 uET1QWGFUiQs5CBfJgTlX5IC7gTW3WV4B8XLrKQuA5co8/Ew28kIJLOO48TBbqDY/P29DaPrCkxX5 eBofaIXRBps4Rz4q01J9SkZZhTnlpfVJMu94nzAUcQI/RAAHlgw4N8u7utOb7WNF/nWIF1h+lHEuE BjSqxtXHorOmKlKvr5znNGdetozQFrOdaBLLId8PZAP0Kdut7PHeOVWtf/nzulb9FGUEpkHCVZIos trH4C5jWgiX4ipyUuxPmTmDRgSI3fKCsmwgk2+UB5ryWIglfUWOpog9rkq8hoklCMa+ltcmHOVlvy 4E4EmrUIo7E1U0LUwXHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM6G-0067K7-1b; Tue, 05 Dec 2023 03:27:56 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM6B-0067Ji-1E for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:27:53 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53Rhin001493 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:27:49 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53RhVX001492; Mon, 4 Dec 2023 19:27:43 -0800 (PST) (envelope-from ehem) Message-Id: <4c18693243c6485cd08ad5f8d962cf6e11ad22b0.1701746457.git.ehem+openwrt@m5p.com> In-Reply-To: References: From: Elliott Mitchell Date: Wed, 29 Nov 2023 21:34:11 -0800 Subject: [PATCH 1/5] scripts/kconfig.pl: fixup subroutine style To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=2.1 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_192751_880533_327FDA95 X-CRM114-Status: UNSURE ( 5.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Match usual Perl style to make the operation of the script easier to understand for future developers. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 27 ++++++++ 1 file changed, 8 insertions(+), 19 deletions(-) Content analysis details: (2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Match usual Perl style to make the operation of the script easier to understand for future developers. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl index 392f1d5841..f7b3814cdd 100755 --- a/scripts/kconfig.pl +++ b/scripts/kconfig.pl @@ -13,10 +13,7 @@ my @arg; my $PREFIX = "CONFIG_"; sub set_config($$$$) { - my $config = shift; - my $idx = shift; - my $newval = shift; - my $mod_plus = shift; + my ($config, $idx, $newval, $mod_plus) = @_; if (!defined($config->{$idx}) or !$mod_plus or $config->{$idx} eq '#undef' or $newval eq 'y') { @@ -25,8 +22,7 @@ sub set_config($$$$) { } sub load_config($$) { - my $file = shift; - my $mod_plus = shift; + my ($file, $mod_plus) = @_; my %config; open FILE, "$file" or die "can't open file '$file'"; @@ -48,8 +44,7 @@ sub load_config($$) { sub config_and($$) { - my $cfg1 = shift; - my $cfg2 = shift; + my ($cfg1, $cfg2) = @_; my %config; foreach my $config (keys %$cfg1) { @@ -64,9 +59,7 @@ sub config_and($$) { sub config_add($$$) { - my $cfg1 = shift; - my $cfg2 = shift; - my $mod_plus = shift; + my ($cfg1, $cfg2, $mod_plus) = @_; my %config; for ($cfg1, $cfg2) { @@ -84,9 +77,7 @@ sub config_add($$$) { } sub config_diff($$$) { - my $cfg1 = shift; - my $cfg2 = shift; - my $new_only = shift; + my ($cfg1, $cfg2, $new_only) = @_; my %config; foreach my $config (keys %$cfg2) { @@ -99,8 +90,7 @@ sub config_diff($$$) { } sub config_sub($$) { - my $cfg1 = shift; - my $cfg2 = shift; + my ($cfg1, $cfg2) = @_; my %config = %{$cfg1}; my @keys = map { my $expr = $_; @@ -117,8 +107,7 @@ sub config_sub($$) { } sub print_cfgline($$) { - my $name = shift; - my $val = shift; + my ($name, $val) = @_; if ($val eq '#undef' or $val eq 'n') { print "# $PREFIX$name is not set\n"; } else { @@ -128,7 +117,7 @@ sub print_cfgline($$) { sub dump_config($) { - my $cfg = shift; + my ($cfg) = @_; die "argument error in dump_config" unless ($cfg); my %config = %$cfg; foreach my $config (sort keys %config) { From patchwork Thu Nov 30 23:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=F5+rpQsj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmJq1dCbz1ySd for ; Tue, 5 Dec 2023 14:30:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YuoGIlFxVNhjjXa72+NA2J1ACe+BzInun6CV7JByriM=; b=F5+rpQsjv5R+Fg LZHKdLIxVLgJ4LBG4Ghj0npDkls1PmTDw24HP1R1M1Jj/e2lKp5Xz/yj0kSxDjz7W34q15pyyZsmy yEqogFjxQnedjLhS8z3haxhkqJBZnIIcBcj+AYQVafZ7gGBKCRPyZDBsmrd2a43sYWmhQ4p6hp898 f3wO/S8J1sbKEmnByx2rvghWFIdYKhvVMU5LxptDmP0rbm+PofaxruNbr9ruqtNXVDW26Xk2Zj+1h tUff+XLnb0OfIEFSUroeJKvVfTcm3SYF5r7qkJzGiG9OcqGNEnOiGFaevEvBacKh6KbLHbo8FKU+z K0b8MLUbOEi58p3V15YA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM74-0067R5-0A; Tue, 05 Dec 2023 03:28:46 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM71-0067Qb-0p for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:28:44 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53SZZV001510 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:28:41 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53SZlG001509; Mon, 4 Dec 2023 19:28:35 -0800 (PST) (envelope-from ehem) Message-Id: <1167e7b408ffb248710b64502435f53bbd5b11f9.1701746457.git.ehem+openwrt@m5p.com> In-Reply-To: References: From: Elliott Mitchell Date: Thu, 30 Nov 2023 15:23:02 -0800 Subject: [PATCH 2/5] scripts/kconfig.pl: modify config_and()/config_sub() to match other ops To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=2.1 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_192843_483117_2A1A6D5C X-CRM114-Status: UNSURE ( 5.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Having all operator-handling functions match the same prototype has advantages. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Content analysis details: (2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Having all operator-handling functions match the same prototype has advantages. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl index f7b3814cdd..dd286479b3 100755 --- a/scripts/kconfig.pl +++ b/scripts/kconfig.pl @@ -43,8 +43,8 @@ sub load_config($$) { } -sub config_and($$) { - my ($cfg1, $cfg2) = @_; +sub config_and($$$) { + my ($cfg1, $cfg2, $mod_plus_discarded) = @_; my %config; foreach my $config (keys %$cfg1) { @@ -89,8 +89,8 @@ sub config_diff($$$) { return \%config } -sub config_sub($$) { - my ($cfg1, $cfg2) = @_; +sub config_sub($$$) { + my ($cfg1, $cfg2, $mod_plus_discarded) = @_; my %config = %{$cfg1}; my @keys = map { my $expr = $_; @@ -135,7 +135,7 @@ sub parse_expr { if ($arg eq '&') { my $arg1 = parse_expr($pos); my $arg2 = parse_expr($pos); - return config_and($arg1, $arg2); + return config_and($arg1, $arg2, undef); } elsif ($arg =~ /^\+/) { my $arg1 = parse_expr($pos); my $arg2 = parse_expr($pos); @@ -155,7 +155,7 @@ sub parse_expr { } elsif ($arg eq '-') { my $arg1 = parse_expr($pos); my $arg2 = parse_expr($pos); - return config_sub($arg1, $arg2); + return config_sub($arg1, $arg2, undef); } else { return load_config($arg, $mod_plus); } From patchwork Thu Nov 30 23:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=DTUNadMg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmKX29xjz1ySd for ; Tue, 5 Dec 2023 14:31:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sBEWrQmnw5ZIjfzLuRRxQHvWMpQ0YgW+nrmtuKuw3OU=; b=DTUNadMg7zGwnE 5Iuk9SKyuUfKaC6ME8UF2hebUwDHrcBpP8Ar+IE2UXxZoC7nFMY8L6uIaIxM5WGiy085eXRCUR4hG NaB2IlcLyT7ap+rOxFG0Vi7iaTINTC27yC4MMKkgRKkgS+ubUYkvEalOcErIFdogNJyjTpMuDF17H /L+7WS5gWP7K9W9yfiPPKmgeL2WDHqMzIDAnXfDeWSxXtd8ODpQ3sMlAkf0Vg/jbJFQ/ZrGsqlMLz YcNhYzbToJ495UxBFThtYJABMNrMpSTKB1xahGu2kFYBCmkVor8gHlM8ow4yq0iUHR7NTuVzs96dx QlXn8LY9aXqP5cCB3v1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM7u-0067gw-0Y; Tue, 05 Dec 2023 03:29:38 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM7r-0067fQ-0p for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:29:36 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53TRpY001524 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:29:33 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53TRri001523; Mon, 4 Dec 2023 19:29:27 -0800 (PST) (envelope-from ehem) Message-Id: <038cf8705f41ab960d573ab96f73afecfbdae9f4.1701746457.git.ehem+openwrt@m5p.com> In-Reply-To: References: From: Elliott Mitchell Date: Thu, 30 Nov 2023 15:33:21 -0800 Subject: [PATCH 3/5] scripts/kconfig.pl: switch to using function references/hash for operators To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=2.1 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_192935_437805_494552DD X-CRM114-Status: UNSURE ( 6.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Ah, the wonders of pointers. Simplifies the configuration parsing as all these cases are otherwise identical. Signed-off-by: Elliott Mitchell --- Oy vey. I only spotted passing the second arg to parse_expr() *just* before I was initially planning to send this. That is quite the boody tr [...] Content analysis details: (2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Ah, the wonders of pointers. Simplifies the configuration parsing as all these cases are otherwise identical. Signed-off-by: Elliott Mitchell --- Oy vey. I only spotted passing the second arg to parse_expr() *just* before I was initially planning to send this. That is quite the boody trap lurking there. --- scripts/kconfig.pl | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl index dd286479b3..5a53e2154b 100755 --- a/scripts/kconfig.pl +++ b/scripts/kconfig.pl @@ -130,32 +130,21 @@ sub parse_expr { my $mod_plus = shift; my $arg = $arg[$$pos++]; + my %ops = ( + '&' => [\&config_and, undef], + '+' => [\&config_add, 0], + 'm+' => [\&config_add, 1], + '>' => [\&config_diff, 0], + '>+' => [\&config_diff, 1], + '-' => [\&config_sub, undef], + ); + die "Parse error" if (!$arg); - if ($arg eq '&') { - my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos); - return config_and($arg1, $arg2, undef); - } elsif ($arg =~ /^\+/) { - my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos); - return config_add($arg1, $arg2, 0); - } elsif ($arg =~ /^m\+/) { - my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos, 1); - return config_add($arg1, $arg2, 1); - } elsif ($arg eq '>') { - my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos); - return config_diff($arg1, $arg2, 0); - } elsif ($arg eq '>+') { - my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos); - return config_diff($arg1, $arg2, 1); - } elsif ($arg eq '-') { + if (exists($ops{$arg})) { my $arg1 = parse_expr($pos); - my $arg2 = parse_expr($pos); - return config_sub($arg1, $arg2, undef); + my $arg2 = parse_expr($pos, ($arg eq 'm+') ? 1 : 0); + return &{$ops{$arg}->[0]}($arg1, $arg2, $ops{$arg}->[1]); } else { return load_config($arg, $mod_plus); } From patchwork Fri Dec 1 16:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=F77NRcp9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmLX05rpz1ySd for ; Tue, 5 Dec 2023 14:32:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rSk2D5gHe7s9JYDrSUI6/6saKHWmaCibnH1NTVGwCfI=; b=F77NRcp9pgmFH0 S+jzEgbZu1Iw7g+xfngWtjUfywkLCf2uQS/VHyZMZ+EWyMFMp/qB4mBpjVmH7VmnEnzRn+8g/DzkA GoEHMd3e9LXBMY+LhavQlc/wgUmYOL4owNHhi6vrxnYh5YA3QP2I5nibwC+q5j5w/uX4KEJo3FG5U 8hggTYi+wYhn4V9X+S05jobCQ4DhjbyPZIFjRByi6oJLTdnHPoSW56sQBvp/Th0iH9XbY9O6zt7n3 9mFl+js2AmcKv1bTQaT3BzDf4/rKk1z2OpsVWS22xa5hk0tBVzze8aJboJk//y7RRAjFcEAzRDpDQ tLfLoQZWhULntSznwXzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM8l-0067wk-0c; Tue, 05 Dec 2023 03:30:31 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM8h-0067vb-01 for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:30:28 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53UJpQ001543 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:30:25 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53UJSm001542; Mon, 4 Dec 2023 19:30:19 -0800 (PST) (envelope-from ehem) Message-Id: <227760cf0bc5e553da607c851628a38e2147ce6a.1701746457.git.ehem+openwrt@m5p.com> In-Reply-To: References: From: Elliott Mitchell Date: Fri, 1 Dec 2023 08:03:20 -0800 Subject: [PATCH 4/5] scripts/kconfig.pl: consistently call parse_expr() with 2 args To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=0.0 required=10.0 tests=KHOP_HELO_FCRDNS autolearn=unavailable autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_193027_244136_48330720 X-CRM114-Status: UNSURE ( 7.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The inconsistent calling had already been noticed. Now the trap has been spotted, so clean this up. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The inconsistent calling had already been noticed. Now the trap has been spotted, so clean this up. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl index 5a53e2154b..5f0741ee5c 100755 --- a/scripts/kconfig.pl +++ b/scripts/kconfig.pl @@ -125,9 +125,9 @@ sub dump_config($) { } } -sub parse_expr { - my $pos = shift; - my $mod_plus = shift; +sub parse_expr($$); +sub parse_expr($$) { + my ($pos, $mod_plus) = @_; my $arg = $arg[$$pos++]; my %ops = ( @@ -142,7 +142,7 @@ sub parse_expr { die "Parse error" if (!$arg); if (exists($ops{$arg})) { - my $arg1 = parse_expr($pos); + my $arg1 = parse_expr($pos, 0); my $arg2 = parse_expr($pos, ($arg eq 'm+') ? 1 : 0); return &{$ops{$arg}->[0]}($arg1, $arg2, $ops{$arg}->[1]); } else { @@ -163,5 +163,5 @@ while (@ARGV > 0 and $ARGV[0] =~ /^-\w+$/) { @arg = @ARGV; my $pos = 0; -dump_config(parse_expr(\$pos)); +dump_config(parse_expr(\$pos, 0)); die "Parse error" if ($arg[$pos]); From patchwork Fri Dec 1 21:33:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GPzwRiFs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmMT1brWz1ySd for ; Tue, 5 Dec 2023 14:33:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3abg+PioIfSXr8n8pjvxQWZO2Ghi8AuKikYg2nrB3hI=; b=GPzwRiFsIvS764 2YD0kSzopsa2bvTbcmaWAQ5gHp9XYbH56kPrM9KkOUZ/V40aHTyA0Z9hKcOesCT/eE3XZmdoWNsbG 8dkcRfiPtOO5DWTMSEzCm0mBrgfy/JhLh5jFcb0W9VZVd7XrkIZGGOhe2vaRxnSfoUtOgBgM+5ZIo 95UoeooqDVXgwY4qaat5LeY1OAEDq2fSSsjvw5X5gcjqtovv8DqQBsSE2nDOR/sCL+3WALXD90UiN VNqkIRLdrr0UO4pAebZNDF5Y7gBPAG25fRYqzOddl3O+GaM5sUpOg2Ee1Cdm8IUsxlMMaudTOiPz5 K2yrUTmmsx/Kt3WPSqug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM9b-0068Fl-25; Tue, 05 Dec 2023 03:31:23 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM9W-0068Dj-2w for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:31:20 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53VBSX001555 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:31:16 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53VBdm001554; Mon, 4 Dec 2023 19:31:11 -0800 (PST) (envelope-from ehem) Message-Id: In-Reply-To: References: From: Elliott Mitchell Date: Fri, 1 Dec 2023 13:33:39 -0800 Subject: [PATCH 5/5] build: remove shell.sh To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=0.0 required=10.0 tests=KHOP_HELO_FCRDNS autolearn=unavailable autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_193119_272298_B0988412 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Handling common shell usage may have been valuable in the past. Yet now this is almost unused, so inline the single remaining use. Then delete the old file. Signed-off-by: Elliott Mitchell --- I've tried to test the removal. I'm unsure I actually achieved coverage, so a careful look at package/kernel/mac80211/Makefile by someone els [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Handling common shell usage may have been valuable in the past. Yet now this is almost unused, so inline the single remaining use. Then delete the old file. Signed-off-by: Elliott Mitchell --- I've tried to test the removal. I'm unsure I actually achieved coverage, so a careful look at package/kernel/mac80211/Makefile by someone else would be good. --- include/shell.sh | 15 --------------- include/unpack.mk | 4 ++-- package/kernel/mac80211/Makefile | 2 +- rules.mk | 1 - 4 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 include/shell.sh diff --git a/include/shell.sh b/include/shell.sh deleted file mode 100644 index 6ee0cf6030..0000000000 --- a/include/shell.sh +++ /dev/null @@ -1,15 +0,0 @@ -getvar() { - eval "echo \"\${$1}\"" -} - -var2file() { - local var - eval "var=\"\${$1}\"" - if [ -n "$var" ]; then echo "$var" > "$2"; fi -} - -isset() { - local var - eval "var=\"\${$1}\"" - [ -n "$var" ] -} diff --git a/include/unpack.mk b/include/unpack.mk index 5959d55f4b..a120a6093d 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -62,10 +62,10 @@ ifeq ($(strip $(UNPACK_CMD)),) endif ifdef PKG_BUILD_DIR - PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) + PKG_UNPACK ?= $(call UNPACK_CMD,$(PKG_BUILD_DIR)) endif ifdef HOST_BUILD_DIR - HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) + HOST_UNPACK ?= $(call UNPACK_CMD,$(HOST_BUILD_DIR)) endif endif # PKG_SOURCE diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 9016e2a525..8aef63d868 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -365,7 +365,7 @@ define Quilt/Refresh/Package endef define Build/Compile - $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config + [ -z "$$$${$(call shvar,mac80211_config)}" ] || echo "$$$${$(call shvar,mac80211_config)}" > "$(PKG_BUILD_DIR)/.config" $(MAKE) $(MAKE_OPTS) allnoconfig $(call Build/Compile/kmod) endef diff --git a/rules.mk b/rules.mk index 6f05047f26..f09ea1ecc4 100644 --- a/rules.mk +++ b/rules.mk @@ -234,7 +234,6 @@ endif export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(TARGET_PATH) export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG -export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh; PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config