Skip to content

Solver feature: soft prefs for enabling testsuites/benchmarks #3092

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

Merged
merged 2 commits into from
Jan 29, 2016

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented Jan 29, 2016

See the long description in the patch

@23Skidoo
Copy link
Member

LGTM.

The solver has the concept of hard constraints and soft preferences.
For versions we have both constraints and preferences. We also have
soft preferences available for whether we'd like installed instanes
or not.

We also have hard constraints for enabling "optional stanzas" (ie test
suites or benchmarks). This patch adds soft preferences for the same.
That is it lets us express the desire to please try enabling test suites
and/or benchmarks, but allow them to be disabled if a solution cannot
easily be found with them enabled.

The implementation is very straightforward and not at all scary. :-)
The original design was discussed with kosmikus and it has seen
extensive testing in the nix-local-build branch.

Optional stanzas in the solver are treated very much like flags, and so
we can follow the pattern of a similar feature for flags for this
feature for optional stanzas. For both flags and optional stanzas the
solver has a node with up to two choices: True & False, corresponding to
enable and disable. Various policies can be expressed by reordering
these two choices or replacing one or other branch with failure. For
example we can force enabling by replacing the False choice with
failure. Flag default values are implemented by reordering the True and
False branches (since the solver will try the first branch first).

So this preference is implemented simply by reordering to put the True
branch first (keeping both branches). That way the solver will try the
enable branch first and backtrack to the False branch (which imposes no
constraints). It integrates smoothly with stanza constraints, which
adjusts the False branch to be a failure, thereby forcing the True
branch (or further failure).

The top down solver is simply adjusted for the types, the feature is not
implemented there.

The feature is not yet used. It's not intended to have any command line
flag, but to express future policies.
@dcoutts
Copy link
Contributor Author

dcoutts commented Jan 29, 2016

Thanks! (Added the comment requested, but left the nub)

dcoutts added a commit that referenced this pull request Jan 29, 2016
Solver feature: soft prefs for enabling testsuites/benchmarks
@dcoutts dcoutts merged commit da8caf4 into haskell:master Jan 29, 2016
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

Successfully merging this pull request may close these issues.

2 participants