Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC] "select" vs. "depends on" : a proposal for a workaround
Date: Thu, 9 Aug 2012 11:40:01 +0200	[thread overview]
Message-ID: <20120809114001.6e9d2a10@skate> (raw)
In-Reply-To: <201208072252.18028.yann.morin.1998@free.fr>

Hello!

Le Tue, 7 Aug 2012 22:52:17 +0200,
"Yann E. MORIN" <yann.morin.1998@free.fr> a ?crit :

> This is a Request For Comments about the now-infamous dilemn between
> "depends on" vs. "select", and a suggestion to work it around.
> 
> As I am adding some packages (soon to be pushed!), I stumbled upon a
> few cases where I could not select another package because it had
> dependencies my package does not have.
> 
> And as we all know, doing so is A Very Bad Idea (TM).
> 
> So I decided to depend on this package, just printing a message in
> case it's not available. Sad-and-dull life, but life nonetheless...
> 
> But as an afterthought, I thought about a /solution/ to this issue.
> It's best explained with a little bit of code, so consider the
> following:
> 
>   config PKG_LIBFOO_AVAILABLE
>     def_bool y
>     depends on ARM && THREADS && !LFS
> 
>   config PKG_LIBFOO
>     bool "libfoo"
>     depends on PKG_LIBFOO_AVAILABLE
> 
>   comments "libfoo requires ARM and threads, but not Large files"
>     depends on !PKG_LIBFOO_AVAILABLE
> 
> That is, move all the package's dependencies to their own symbol, and
> have the package depends on this symbol.
> 
> Although the gain is not explicit for the package libfoo by itself, it
> becomes much more evident when another package depends on libfoo:
> 
>   config PKG_BAR
>     bool "bar"
>     depends on PKG_LIBFOO_AVAILABLE
>     select PKG_LIBFOO
> 
> This way, it becomes extremely easy to inherit the dependencies of
> libfoo in bar, and still we can select it. If the dependencies of
> libfoo were to change, there would be a single place where to update
> them.
> 
> (And yes, we could/should also have a PKG_BAR_AVAILABLE.)
> 
> This also allows for more involved constructs (which is the actual
> use-case I'm in need for my package):
> 
>   config PKG_BAR
>     bool "bar"
> 
>   config PKG_BAR_OPT
>     bool "bar option"
>     depends on PKG_BAR
>     depends on PKG_LIBFOO_AVAILABLE
>     select PKG_LIBFOO
> 
> (I have tested both constructs with the current kconfig from 3.6-rc1,
> and it behaves as expected.)

Thanks a lot for thinking about this. So, the idea is that every time
there is a "select", we add a corresponding "depends on", and that
since there is inheritance of "depends on", we will not have to
recursively add all the "depends on" on toolchain options on all the
reverse dependencies of a package that need such toolchain options.

Am I understanding your proposal correctly?

> *And* it has no impact whatsoever on the package build infrastructure.
> 
> Of course, this does not have a zero-impact on how to write packages'
> Config.in files, and there is no easy way to convert existing
> packages. But, as for the package infrastructure, this could be a
> step-by-step process by which packages would be converted (enhanced!)
> one after the other.
> 
> Another disadvantage is that it wanders a bit away from the current
> simplicity of writing a single package; complexity that is regained
> later-on when new packages will use it.
> 
> What are your thoughts on this?
> Where's the flaw in my reasoning? ;-)
> Am I rambling on incoherently? ;-)

On my side, I would need to experiment a bit with this on some
real-world example, but it sounds like a nice path to investigate, for
sure.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2012-08-09  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 20:52 [Buildroot] [RFC] "select" vs. "depends on" : a proposal for a workaround Yann E. MORIN
2012-08-09  9:40 ` Thomas Petazzoni [this message]
2012-08-09  9:58   ` Yann E. MORIN
2012-08-09 11:30     ` Thomas Petazzoni
2012-08-09 11:57       ` Alex Bradbury
2012-08-09 12:06         ` Yann E. MORIN
2012-08-10 21:30         ` Thomas Petazzoni

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=20120809114001.6e9d2a10@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.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