-
Notifications
You must be signed in to change notification settings - Fork 37
Description
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)