-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow packages to set default variants in dependencies #16909
Comments
The flip side of the above is another example of where I would use For example, hpctoolkit (and dyninst) require elfutils, but we don't Again, we could require So, the better option is to let hpctoolkit say, "we prefer ~nls, but Again, IMO, it's much better to put this once in the hpctoolkit nag @tgamblin |
@mwkrentel What would be the plan when different edges have conflicting preferences? The minimal example is a diamond-like structure: graph TD;
id1[root]-->id2[a\nprefers c+foo];
id1-->id3[b\nprefers c-foo];
id2-->id4[c ?foo];
id3-->id4;
|
@alalazo In that case, since ROOT knows that it depends on both A and B, If root doesn't set any preference, then flip a coin. That is, either Remember, these are only preferences, roughly equivalent to defaults. But in this case, root should decide. |
root doesn't have any preference in the example, and there can be cases - like the above - where conflicting preferences are expressed at the same depth in the DAG.
We are not talking about correct choices, but "optimal" choices. I think there should be only one optimal choice in general, or otherwise One could object that we already do something similar in
This is not to push back on the feature, but to say that we need at least to answer questions like this before we think of letting packages control other packages defaults. |
First, let me review one of my main use cases. Hpctoolkit uses Fine, but that means that EVERY user of hpctoolkit either has to write All of this is equivalent to putting a You say that I'm imposing my choice ( But I'm not imposing it on everyone, only the users of hpctoolkit. It's impossible to settle on what is the best default. All you can In this case, "building hpctoolkit + dyninst + elfutils" is more As for the diagram with no preference at root, how about these Or, you could be more sophisticated and say: (1) if root sets a preference, I understand that all this is complicated. All I'm really trying to |
I think this can be a nice topic for the Wed. meeting, if you like to talk about that. The point I want to make, is that right now each package decide its own defaults. So, If we move to a model where a dependent can change the defaults of a dependency in I wonder if this use case, which I completely understand, could be solved by other means. |
Another possibility, somewhat more radical, is to follow the boost Many variants add some feature to a package and dependencies to But you don't build something just because some package thinks it's a good That's a huge change, but it's a cleaner model for what features to build. |
We discussed this at today's Wed meeting. To summarize what I'd like: We as hpctoolkit developers recommend a certain config (turn this on, What I want is a way to enforce our recommendations so that the
|
For reference, the minutes of the meeting: https://github.com/spack/spack/wiki/Telcon%3A-2023-03-22 |
This is a request for a new feature and discussion.
I'd like to allow packages to set the preferences (defaults) for
variants in their dependency packages and do so from their
package.py
file. Of course, this can be done now inpackages.yaml
or the command line, but allowing this in
package.py
has someadvantages.
For example, my project (hpctoolkit) depends on libunwind, and
libunwind has a variant
xz
to support xz/lzma compressed symboltables, with default False. Of course, hpctoolkit will run either
way, but normally we prefer with
xz
on. Right now, what I have is:But this is a hard constraint. You can't turn off
xz
withoutediting
package.py
. I'd rather turn this into a soft preferencewith something like:
That way, the default for libunwind remains False, but if you're
building libunwind as part of hpctoolkit, then the default is True.
Of course, I can't go around and reset the defaults for all of our
dependency packages just to suit my needs.
So why not use
packages.yaml
? We could, and in fact, we dodistribute a
packages.yaml
file, mostly as a reference point. Butthe file is long and it's tedious to review it for every new machine.
Right now, I'm confronted with a dilemma: I can leave off
+xz
andmake everyone use our
packages.yaml
file, or else they won't buildhpctoolkit the way we want. Or, I can require
+xz
which isheavy-handed and inflexible. With this feature, I can make the
one-button
spack install hpctoolkit
almost always produce the rightspec, but still allow flexibility when needed.
Theoretically, I could add an
xz
variant to hpctoolkit and set thedefault there, but that's really awkward and adds a duplicate variant,
just because the default doesn't suit my needs.
Note: the precedence of
prefer='+xz'
should be next to last. Itshould override the default in the dependency package, but you should
be able to override it from
packages.yaml
or the command line.@becker33 Is this possible? A good idea?
The text was updated successfully, but these errors were encountered: