Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QualifiersManager: accept qualifiers depending on other qualifiers value #631

Open
JulienBortolussiAda opened this issue Sep 14, 2023 · 1 comment
Assignees

Comments

@JulienBortolussiAda
Copy link
Contributor

Example:

A spec my_spec accept two qualifiers "arch" and "version". The default value of "version" depends on the value of "arch". It is not possible to set the default value of "version" because the value of "arch" cannot be accessed in declare_qualifiers_and_components.

A work around is to set the default value of "version" to "default". In the spec, you create a property "version" which take into account the default.

Let's say the default "version" when "arch" is "my_arch" is "1". If you want to declare a component "my_spec_1" when "version" is "1" and "arch" is "my_arch" then you have a issue. In fact the qualifier configuration {"arch": "my_arch", "version": "1"} and {"arch": "my_arch", "version": "default"} denote the same component. Unfortunately, I don't think it is possible to get around this issue.


A solution would be to accept functions as default for qualifiers. This functions would be called later on to get the proper value of the default. This require to order the qualifiers to make sure the value of a qualifier is available when we try to access it. I see to ways to get this order:
1- the order of declaration
2- add a "depends_on" parameters in qualifiers declaration

1 is by far the simpler from the implementation point of view. 2 make the spec more explicit which is always nice.

I prefer 2 because I don't really like implicit behavior. However, I think we should go for 1 because the implementation is way simpler (and thus less bug prone)

@JulienBortolussiAda JulienBortolussiAda self-assigned this Sep 14, 2023
@JulienBortolussiAda
Copy link
Contributor Author

@Nikokrock @liaiss, what do you think ?

@liaiss liaiss changed the title QualifiersManafer: accept qualifiers depending on other qualifiers value QualifiersManager: accept qualifiers depending on other qualifiers value Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant