Skip to content

build system: don't optionally use conflicting features#16012

Merged
benpicco merged 2 commits intoRIOT-OS:masterfrom
maribu:fix-feature-resolution-again
Feb 24, 2021
Merged

build system: don't optionally use conflicting features#16012
benpicco merged 2 commits intoRIOT-OS:masterfrom
maribu:fix-feature-resolution-again

Conversation

@maribu
Copy link
Member

@maribu maribu commented Feb 15, 2021

Contribution description

As the title says: If a feature is optional and using it would cause a feature conflict, the expectation is that it doesn't end up being used. This adds the required testing.

An additional a unit test to cover this case was added, so that no a future regression would be detected.

Testing procedure

See #16008 (comment)

Issues/PRs references

Detected in #16008 (comment)

@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: build system Area: Build system labels Feb 15, 2021
@fjmolinas
Copy link
Contributor

Can we really avoid this? Dependency resolution is iterative. If in round one there is only FEATURES_OPTIONAL=a it will get used, but if in round n you get FEATURES_BLACKLIST=a there will still be a conflict. I don't see the harm in the change though, but I don't think it's avoidable, so we can still get this in.

@maribu
Copy link
Member Author

maribu commented Feb 15, 2021

Can we really avoid this? Dependency resolution is iterative. If in round one there is only FEATURES_OPTIONAL=a it will get used, but if in round n you get FEATURES_BLACKLIST=a there will still be a conflict. I don't see the harm in the change though, but I don't think it's avoidable, so we can still get this in.

Both blacklist and list of conflicts should do my understanding not grow. But transitive dependencies to modules might pull in a required feature too late, as an optional feature conflicting with that could be already used.

Still, best effort is likely good enough here for all but a few rare cases. And these could be addressed by tweaking the dependency resolution so that the conflicting required feature gets added in the some round as the optional feature it conflicts with. (But I hope that such occurrences won't show up soon, so that we migrate away in time.)

@fjmolinas
Copy link
Contributor

Both blacklist and list of conflicts should do my understanding not grow. But transitive dependencies to modules might pull in a required feature too late, as an optional feature conflicting with that could be already used.

I think MODULES and PKG can blacklist things...or maybe it's only TOOLCHAINS? I'm unsure.

@fjmolinas
Copy link
Contributor

Still, best effort is likely good enough here for all but a few rare cases. And these could be addressed by tweaking the dependency resolution so that the conflicting required feature gets added in the some round as the optional feature it conflicts with. (But I hope that such occurrences won't show up soon, so that we migrate away in time.)

Yes, of course, just pointing it out. I doubled checked and mostly its arch features that are blacklisted, and those are FEATURES_REQUIRED. There is a couple of cases where bootloader* and ble* are blacklisted as well.

@fjmolinas
Copy link
Contributor

Still, best effort is likely good enough here for all but a few rare cases. And these could be addressed by tweaking the dependency resolution so that the conflicting required feature gets added in the some round as the optional feature it conflicts with. (But I hope that such occurrences won't show up soon, so that we migrate away in time.)

Yes, of course, just pointing it out. I doubled checked and mostly its arch features that are blacklisted, and those are FEATURES_REQUIRED. There is a couple of cases where bootloader* and ble* are blacklisted as well.

Maybe those can be removed? Maybe just a doc comment? Or we stick with best effort? What do you think?

@maribu
Copy link
Member Author

maribu commented Feb 15, 2021

Yes, of course, just pointing it out. I doubled checked and mostly its arch features that are blacklisted, and those are FEATURES_REQUIRED. There is a couple of cases where bootloader* and ble* are blacklisted as well.

Maybe those can be removed? Maybe just a doc comment? Or we stick with best effort? What do you think?

I'm not sure if there is indeed so much to gain that it would justify the effort, having the migration to Kconfig in mind. (Just thinking about the amount of quirks in the build system that can be dropped afterwards make me smile :-))

@fjmolinas fjmolinas added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 16, 2021
@fjmolinas
Copy link
Contributor

Lets spin up the ci

@fjmolinas
Copy link
Contributor

Please squash @maribu

@maribu maribu force-pushed the fix-feature-resolution-again branch from 17b1a14 to 9f2581b Compare February 17, 2021 13:32
@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 17, 2021
Comment on lines +28 to +30
# Update to account for change in FEATURES_OPTIONAL_USED
FEATURES_USED_SO_FAR := $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unneeded now (moving it up)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved down again and squashed

If adding a provided but optional feature would result in a feature conflict,
don't use it.
Make sure that optional features that would cause conflicts don't end up being
used again.
@maribu maribu force-pushed the fix-feature-resolution-again branch from 9f2581b to 47414f8 Compare February 22, 2021 11:06
Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK!

@benpicco benpicco merged commit 7c71fb2 into RIOT-OS:master Feb 24, 2021
@maribu maribu deleted the fix-feature-resolution-again branch March 31, 2021 08:02
@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants