🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.kernel
Article #521

Re: [PATCH v1 04/10] kconfig: Introduce checkconfig target

#521
From: Ahmed S. Darwish
Date: Mon, 09 Nov 2026 20:30
71 lines
5183 bytes
On Sat, 07 Nov 2026, sashiko-bot@kernel.org wrote:
> >
> > +checkconfig := $(PYTHON3) -B $(srctree)/tools/kconfig-checker/check.py
> > +list_checkconfig_rules =						\
> > +	echo -n >&2 "Available RULES: ";				\
> > +	$(checkconfig) list-rules >&2;					\
> > +	echo >&2
> > +
> > +PHONY += checkconfig
> > +checkconfig:
> > +	$(Q)if [ -z "$(RULES)" ]; then					\
> > +		echo >&2 "Usage: make RULES=<profile> checkconfig";	\
> > +		$(list_checkconfig_rules);				\
> > +		exit 2;							\
> > +	fi
> > +	$(Q)if ! $(checkconfig) list-rules | grep -qw "$(RULES)"; then	\
> > +		echo >&2 "Unknown RULES profile = $(RULES)";		\
> > +		$(list_checkconfig_rules);				\
> > +		exit 2;							\
> > +	fi
> > +	$(Q)$(checkconfig) check -r "$(RULES)" -c "$(KCONFIG_CONFIG)"
>
...
>
> When either module is missing, check.py writes the error to stderr,
> produces no stdout, and exits with os.EX_UNAVAILABLE.  Because the POSIX
> shell pipeline ignores the exit status of $(checkconfig) list-rules,
> grep -qw exits 1 on the empty stdout and the negated condition enters the
> branch.  That reports a valid setting such as RULES=preempt_rt as an
> unknown profile and runs $(list_checkconfig_rules), which invokes check.py
> a second time and prints a duplicate module error on the same line after
> "Available RULES: ".

It works, so there is no reason to complicate things.

For example, invoking the make target from a container with old Python:

   $ make checkconfig
   Usage: make RULES=<profile> [OVERLAY=<overlay>] checkconfig
   Available RULES: Error: Python 3.9 or later is required

   make[2]: *** [scripts/kconfig/Makefile:138: checkconfig] Error 2
   make[1]: *** [/home/darwi/linux/Makefile:772: checkconfig] Error 2
   make: *** [Makefile:248: __sub-make] Error 2

and:

   $ make RULES=nonExistent checkconfig
   Error: Python 3.9 or later is required
   Unknown RULES profile = nonExistent
   Available RULES: Error: Python 3.9 or later is required

   make[2]: *** [scripts/kconfig/Makefile:139: checkconfig] Error 2
   make[1]: *** [/home/darwi/linux/Makefile:772: checkconfig] Error 2
   make: *** [Makefile:248: __sub-make] Error 2

The duplicate error, which is a single line, is no big deal. IMO, it's
better than complicating the Makefile for that single edge case.

>
> In addition, grep -qw treats $(RULES) as a regular expression with word
> boundaries against the comma-separated output of list-rules rather than
> matching an exact profile name, and spawns Python twice on every valid
> invocation even though check.py check -r already validates the profile
> name.
>

That's good catch; will fix.

Thanks,
Ahmed
Technical Details
Message-ID: <NXEa5-aSuJ-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.nntp4.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <NWoK5-aaez-7@gated-at.bofh.it> <NWoK5-aaez-5@gated-at.bofh.it> <NWLdD-amPt-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.nntp4.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: "Ahmed S. Darwish" <darwi@linutronix.de>
Newsgroups: linux.debian.kernel,linux.kernel
Subject: Re: [PATCH v1 04/10] kconfig: Introduce checkconfig target
Date: Mon, 09 Nov 2026 21:30:01 +0100
Message-ID: <NXEa5-aSuJ-7@gated-at.bofh.it>
References: <NWoK5-aaez-7@gated-at.bofh.it> <NWoK5-aaez-5@gated-at.bofh.it> <NWLdD-amPt-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-kernel-request@lists.debian.org  Mon Nov  9 20:24:09 2026
Old-Return-Path: <darwi@linutronix.de>
X-Amavis-Spam-Status: No, score=-4.4 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
 DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate:hard: -4.6
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158175
List-ID: <debian-kernel.lists.debian.org>
List-URL: <https://lists.debian.org/debian-kernel/>
List-Archive: https://lists.debian.org/msgid-search/avIn71Md3LtNaYje@lx-t490
Approved: robomod@news.nic.it
Lines: 71
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	John Ogness <john.ogness@linutronix.de>,
	Derek Barbosa <debarbos@redhat.com>,
	Zbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>,
	Daan De Meyer <daan.j.demeyer@gmail.com>,
	Luca Boccassi <luca.boccassi@gmail.com>,
	linux-rt-devel@lists.linux.dev, debian-kernel@lists.debian.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date: Mon, 9 Nov 2026 21:07:11 +0100
X-Original-Message-ID: <avIn71Md3LtNaYje@lx-t490>
X-Original-References: <20261106091922.7560-1-darwi@linutronix.de>
 <20261106091922.7560-5-darwi@linutronix.de>
 <sashiko-outbox-202759@kernel.org>