public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulf Magnusson <ulfalizer.lkml@gmail.com>
To: Michal Marek <mmarek@suse.cz>,
	linux-kbuild@vger.kernel.org, rdunlap@xenotime.net,
	akpm@linux-foundation.org, andrea.gelmini@gelma.net,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	Arnaud Lacombe <lacombar@gmail.com>
Subject: Re: [PATCH] [ANNOUNCE] kconfig: Kconfiglib: a flexible Python Kconfig parser
Date: Wed, 16 Feb 2011 16:20:21 +0100	[thread overview]
Message-ID: <20110216152020.GA20012@ulf> (raw)
In-Reply-To: <20110216044830.GA19364@ulf>

On Wed, Feb 16, 2011 at 05:48:32AM +0100, Ulf Magnusson wrote:
> On Fri, Feb 11, 2011 at 12:14:36AM +0100, Michal Marek wrote:
> > On 2.2.2011 00:27, Ulf Magnusson wrote:
> > > Hi,
> > > 
> > > This is the initial release of Kconfiglib: a Python library for
> > > scripting, debugging, and extracting information from Kconfig-based
> > > configuration systems.  It can be used to programmatically generate a
> > > .config when the '*conf' tools are too inflexible, to quickly find out
> > > interesting information about a Kconfig configuration such as dependency
> > > relations between symbols and where undefined symbols are referenced,
> > > and in applications that need to parse and extract information from
> > > Kconfig files.
> > > 
> > > For a much longer introduction including multiple examples, see
> > > arch/kconfig/kconfiglib.py.
> > 
> > Hi,
> > 
> > this looks like a very powerful tool, but I have a similar concern like
> > Arnaud had - being completely standalone, it reimplements most of the C
> > kconfig code. One option to reduce this duplication would be a swig
> > wrapper, another one would be to let the C code parse the Kconfig files
> > and write the required information in some digested form, that would be
> > easier to parse by scripts. Something like:
> > $ scripts/kconfig/conf_inspect --kconfig=Kconfig --eval='FOO || BAR'
> > y
> > $ scripts/kconfig/conf_inspect ... --dump-symbols
> > config FOO
> > type: bool
> > valule: m
> > visible: y
> > prompt: "zzz"
> > depends: X & Y
> > select: Z
> > ...
> > $ scripts/kconfig/conf_inspect ... --dump-symbols \
> >     --fields='depends,select,value'
> > config FOO
> > depends: X & Y
> > select: Z
> > value: m
> > 
> > config BAR
> > ...
> > 
> > etc. The idea is that for instance instead of parsing the Kconfig files,
> > the Python code could fill it's data structures by reading the flat dump
> > provided by the C kconfig. There would be still lot to do in Python,
> > e.g. parsing and evaluating expressions, but it would be a small step
> > forward already. And people wanting to write quick&dirty scripts in
> > bash/awk/perl would make use of the C code as well.
> >
> Offloading some of the parsing to a new tool would probably be doable,
> though some Kconfig subleties might complicate things. For example,
> symbols that appear within choices aren't seen as real selectable choice
> items if they depend on previous symbols in specific ways (see
> _determine_actual_items() in kconfiglib.py), and capturing this
> information in the output while at the same preserving the ordering of
> the symbols could be messy. I guess you could sort this out within
> Kconfiglib instead, though other tools might then have to reimplement
> the same (messy) rules.
> 
Then again, ordering information is retained (for example, assignments
in .config files are written out in the order symbols appear within the
Kconfig files), so you could probably just iterate over all items in
Kconfig order after parsing + implicit submenu creation (which causes
the weird choice behavior) to capture such stuff as well.

> I'm not so sure about offloading anything else this way. For dynamically
> updating symbol values in a script you would need to somehow preserve
> state between invocations (or pass huge lists of assignments back and
> forth), which could lead to an unwieldy protocol. You might need to go
> the SWIG route instead.

/Ulf

      reply	other threads:[~2011-02-16 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-01 23:27 [PATCH] [ANNOUNCE] kconfig: Kconfiglib: a flexible Python Kconfig parser Ulf Magnusson
2011-02-02  0:47 ` Arnaud Lacombe
2011-02-02  2:02   ` Ulf Magnusson
2011-02-03 21:58 ` Ulf Magnusson
2011-02-03 22:16   ` Ulf Magnusson
2011-02-04 22:35 ` Randy Dunlap
2011-02-04 23:42   ` Rob Landley
2011-02-05  0:28     ` Filip Honckiewicz
2011-02-05  1:00       ` Ulf Magnusson
2011-02-05  0:38     ` Ulf Magnusson
2011-02-05  0:28   ` Ulf Magnusson
2011-02-10 23:14 ` Michal Marek
2011-02-16  4:48   ` Ulf Magnusson
2011-02-16 15:20     ` Ulf Magnusson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110216152020.GA20012@ulf \
    --to=ulfalizer.lkml@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrea.gelmini@gelma.net \
    --cc=lacombar@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox