[LEDE-DEV] [PATCH] metadata: compile dependencies only when the package is selected

Felix Fietkau nbd at nbd.name
Wed Feb 28 02:58:44 PST 2018


On 2018-02-28 11:48, Yousong Zhou wrote:
> On 28 February 2018 at 16:13, Felix Fietkau <nbd at nbd.name> wrote:
>> On 2018-02-28 06:07, Yousong Zhou wrote:
>>> This is intended to reduce build time for situations like the following
>>> where python and python-six and their dependencies could still be built
>>> as long as any subpackage within the srcpackage was selected regardless
>>> of the selection state of openvswitch-python
>>>
>>>     define Package/openvswitch-python
>>>       ...
>>>       DEPENDS:=+python +python-six
>>>     endef
>>>
>>> Previously we work around this by specifying the dependency as
>>> +PACKAGE_openvswitch-python:python, which is unintuitive
>>>
>>> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
>> The current behavior is intentional. The idea is that many packages
>> currently do not use PKG_CONFIG_DEPENDS properly, or specify enable or
>> disable of extra library support via configure arguments.
>>
>> This means that if the dependency depends on the package selection, we
>> will get a lot of random package build failures depending on the build
>> order.
>>
> 
> Hi Felix, can you describe a concrete example where failure can
> happen?  PKG_CONFIG_DEPENDS and the change here seems orthogonal to
> each other.
Let's take the openvswitch package as an example. If you modify it to
remove the PKG_CONFIG_DEPENDS and PKG_BUILD_DEPENDS, theoretically the
following scenario could happen:

You make a clean build with openvswitch-python and python itself not
selected. Since python doesn't get built, openvswitch detects that
python is not available and can't build its language binding.
Now you decide that you want python support after all, so you select
openvswitch-python and run make again.
It won't rebuild anything in openvswitch, since no stampfiles are
affected, it will just try to package openvswitch-python.
This will now fail, because the openvswitch-python package bindings
could not be built the first time around.

There are several other packages that have support for plugins that
depend on various libraries. If the maintainers of those packages are
not careful about either handling reconfiguration, or specifying
everything as build dependencies, you can get spurious rebuild bugs like
this.

The conditional dependency is a way to tell the build system which
dependencies are properly vetted for making the build dependency
conditional as well.

- Felix



More information about the Lede-dev mailing list