You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a property that we would quite like the solver to have:
given any solver result/solution we should be able to construct a set of solver input constraints that uniquely determine the same result (in any environment in which that solution exists)
Or to put it another way, we should be able to freeze the result of the solver and feed it back into the solver later to get the same result. The solver almost has this property but not quite. In particular the introduction of setup deps and qualified goals means that simple "pkg == version" constraints are no longer expressive enough to describe all the solutions the solver can produce. If the solver picks two versions of package foo (e.g. one a "main" lib package and another as a setup dep) then we cannot just constrain "foo == 1.0", we would need to specify the scope of the constraint. Notice also that "primary" vs "setup" dep scope is not enough, since we could pick two versions of foo both as setup deps. Probably what is required to express all the solutions is something corresponding to the internal goal qualifications.
@GrayJay I'm not sure I totally understand the question. Want to grab me on IRC in #hackage for a discussion? Or ask again with more details.
The new freeze command (in PR #3503) takes the current solution (having made sure that was up to date) and translates it into a set of constraints and then writes it out. The new build/repl/configure/freeze all will re-run the solver if the solver inputs would change, so this includes changes in the set of installed packages in the global package db (but not in the user or store dbs) and changes in the set of source pakages from hackage. In the new scheme we never tell the solver about installed packages in the store, just source packages and the global installed packages. I'm not sure if that answers the question.
@dcoutts I was wondering what should happen when a user runs new-freeze, removes a globally installed package, and then runs new-configure again. Should new-freeze just freeze the version numbers, so that cabal can try to rebuild the previously installed package? Or does it need to ensure that the dependencies are exactly the same, including the flag assignments? I joined #hackage, if you want to discuss it there.
Ah ok. So if at the point when we ran new-freeze the solution involved an installed package from the global db, (e.g. the copy of containers that is bundled with ghc) then yes we only know the version and not flags, so we can only generate version constraints, not flag constraints. For all packages outside of the global db we do know all the flags and do produce flag constraints with new-freeze.
So you're right to point out that this is a slight hole, however it's not one I'm really worried about. While at the moment we use the whole global package db, our assumption is that these days it only really includes a small set. We can make that assumption properly true by using a "core" package db that really only contains the core packages. Also, of the existing packages typically in the global db, I'm not aware of any with automatic flags that significantly affect things.
@dcoutts Thanks for explaining. I'm still not very familiar with the overall design for new-build, but I think that using goal qualifiers in freeze constraints makes sense. The only problem that I can think of is that we might add flags to modify goal qualification, such as --independent-goals. It's probably not a big deal, though, since we could just specify the goal qualification scheme in the freeze file.
@dcoutts In principle, I agree. But for the use case in question, wouldn't it be even better if we'd have a dedicated new solver (we could call it --explicit-solver or --trivial-solver) that won't solve at all, but simply deserialize an install plan that is passed via some mechanism. The sanity check would still run, of course.
Or are there particular reasons why you want to have this feature in connection with being able to make some modifications, and need the actual solver machinery in the background?
We actually already have something like --trivial-solver in Cabal, it's called --explicit-configuration. Perhaps we only need to port this feature to cabal-install?
@dcoutts Ok, I get it. The only thing that worries me is that I still don't consider the whole setup dependency / qualified goals stuff to be extremely stable. If we allow constraint syntax for these kinds of constraints, we may expose rather fragile solver internals to the end user.
Activity
dcoutts commentedon Jun 20, 2016
@kosmikus @GrayJay @edsko opinions? ideas?
Add a new-freeze command
Add a new-freeze command
sebright commentedon Jun 21, 2016
Does freeze need to handle changes in the set of installed packages?
dcoutts commentedon Jun 25, 2016
@GrayJay I'm not sure I totally understand the question. Want to grab me on IRC in #hackage for a discussion? Or ask again with more details.
The new freeze command (in PR #3503) takes the current solution (having made sure that was up to date) and translates it into a set of constraints and then writes it out. The new build/repl/configure/freeze all will re-run the solver if the solver inputs would change, so this includes changes in the set of installed packages in the global package db (but not in the user or store dbs) and changes in the set of source pakages from hackage. In the new scheme we never tell the solver about installed packages in the store, just source packages and the global installed packages. I'm not sure if that answers the question.
sebright commentedon Jun 25, 2016
@dcoutts I was wondering what should happen when a user runs new-freeze, removes a globally installed package, and then runs new-configure again. Should new-freeze just freeze the version numbers, so that cabal can try to rebuild the previously installed package? Or does it need to ensure that the dependencies are exactly the same, including the flag assignments? I joined #hackage, if you want to discuss it there.
Add a new-freeze command
dcoutts commentedon Jun 26, 2016
Ah ok. So if at the point when we ran
new-freezethe solution involved an installed package from the global db, (e.g. the copy ofcontainersthat is bundled with ghc) then yes we only know the version and not flags, so we can only generate version constraints, not flag constraints. For all packages outside of the global db we do know all the flags and do produce flag constraints withnew-freeze.So you're right to point out that this is a slight hole, however it's not one I'm really worried about. While at the moment we use the whole global package db, our assumption is that these days it only really includes a small set. We can make that assumption properly true by using a "core" package db that really only contains the core packages. Also, of the existing packages typically in the global db, I'm not aware of any with automatic flags that significantly affect things.
sebright commentedon Jun 29, 2016
@dcoutts Thanks for explaining. I'm still not very familiar with the overall design for new-build, but I think that using goal qualifiers in freeze constraints makes sense. The only problem that I can think of is that we might add flags to modify goal qualification, such as --independent-goals. It's probably not a big deal, though, since we could just specify the goal qualification scheme in the freeze file.
kosmikus commentedon Jun 29, 2016
@dcoutts In principle, I agree. But for the use case in question, wouldn't it be even better if we'd have a dedicated new solver (we could call it
--explicit-solveror--trivial-solver) that won't solve at all, but simply deserialize an install plan that is passed via some mechanism. The sanity check would still run, of course.Or are there particular reasons why you want to have this feature in connection with being able to make some modifications, and need the actual solver machinery in the background?
23Skidoo commentedon Jun 29, 2016
We actually already have something like
--trivial-solverin Cabal, it's called--explicit-configuration. Perhaps we only need to port this feature tocabal-install?dcoutts commentedon Jul 1, 2016
@GrayJay I'm not too worried about things like
--independent-goalssince we're not going to turn those on by default.@kosmikus yes, the purpose is the same as the current
cabal freeze, to give you a starting point but that you can manually tweak later.kosmikus commentedon Jul 1, 2016
@dcoutts Ok, I get it. The only thing that worries me is that I still don't consider the whole setup dependency / qualified goals stuff to be extremely stable. If we allow constraint syntax for these kinds of constraints, we may expose rather fragile solver internals to the end user.
So, syntax proposals welcome.
49 remaining items
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: add the build: prefix for stage-scoped constrai…
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: add the build: prefix for stage-scoped constrai…
cabal-install/solver: make constraint scopes stage-aware
cabal-install/solver: add the build: prefix for stage-scoped constraints