infra/pkg-virtual: validate only one provider provides an implementation
Currently, it is possible that more than one provider of a virtual package
is selected in the menuconfig.
This leads to autobuild failures, and we do not protect the user from
making a mistake in the configuration. The failure is then hard to
troubleshoot in any case.
We can't use kconfig constructs to prevent this, since kconfig does not
tell how many options did a select on another option.
This change introduces a new variable a provider *must* define to include
all the virtual packages it is an implementation of. Then, when evaluating
the package's rules, we check that the provider is indeed the declared one
for each virtual package it claims to be an implementation of.
This works by taking advantage that when more than one provider is
selected, only one of them will 'win' in setting the _PROVIDES_FOO
option. Thus any provider just has to check it is indeed the declared
provider. If not, it means that one or more other provider is selected.
This gives the opportunity to the user to change its configuration, and
we can match the error message in the autobuilders to skip those failures
(we can skip them instead of reporting them, since they are obviously
configuration errors that should not happen in the first place.)
[Note: kudos to Arnout for suggesting this actual implementation. :-)]
Fixes:
http://autobuild.buildroot.org/results/285/
2851069d6964aa46d26b4aabe7d84e8c0c6c72ce
http://autobuild.buildroot.net/results/9b7/
9b7870354d70e27e42d3d9c1f131ab54706bf20e
[...]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>