platforms: enable preferring softeners and defaulting to built-in if softener not available#216
Draft
artiepoole wants to merge 9 commits into
Draft
platforms: enable preferring softeners and defaulting to built-in if softener not available#216artiepoole wants to merge 9 commits into
artiepoole wants to merge 9 commits into
Conversation
… platforms Signed-off-by: Artie Poole <stuart.poole@canonical.com>
this is possible by returning the macro-generated platform object's compat string in platform_compat_string method Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…irst Signed-off-by: Artie Poole <stuart.poole@canonical.com>
Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…forms Signed-off-by: Artie Poole <stuart.poole@canonical.com>
- docstrings in platform.rs to describe the algorithm - readme updates for adding a softener Signed-off-by: Artie Poole <stuart.poole@canonical.com>
due to needing available to return true for dfx-mgr softener Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…ilar Signed-off-by: Artie Poole <stuart.poole@canonical.com>
changes: - platform selection now prefers softeners and allows choice over preference behaviour Signed-off-by: Artie Poole <stuart.poole@canonical.com>
5f12d11 to
6486d2d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user does not specifically select a softener or platform compat string, the
softenerkey being present in the registered platform compat string means that it will be preferred. To avoid constructing a platform which will always fail (e.g. if not installed) the "available" function is also part of the registration part of the platform and returns true for all built-in platforms and does a check for all softeners platforms.For dfx-mgr platform, the finding the client binary code, that is already used before trying to running dfx-mgr-client, is re-used to check if the platform is available.
If the user tries to use the softener when it is not available (by using
dfx-mgrorsoftenerparts of the platform string) then the return is still a FpgadError type due to the softener not being available and there being no other platforms matching.If the built-in is specified, e.g.using
platformorxlnx-sys, then the softener will not be used.While I was there, I also changed the registration process to store the registered platform string for re-use in the getter for Platform trait. This stops the user from having to define the compat string in two places like it used to be.