Description
The setup component should be solved independently of the other components, so the decisions about constraints taken in the setup component should not be influenced by decisions taken in other components.
This is witnessed by the following test where the setup and library depend on different versions of base
.
-- Works without the base-shimness, choosing different versions of base
db12s2 :: ExampleDb
db12s2 =
let base3 = exInst "base" 3 "base-3-inst" []
base4 = exInst "base" 4 "base-4-inst" []
in [ Left base3
, Left base4
, Right $ exAv "A" 1 [ExFix "base" 4]
`withSetupDeps` [ExFix "base" 3]
]
targets: A
constraints:
any.base installed (non-reinstallable package)
any.ghc-bignum installed (non-reinstallable package)
any.ghc-prim installed (non-reinstallable package)
any.ghc installed (non-reinstallable package)
any.integer-gmp installed (non-reinstallable package)
any.integer-simple installed (non-reinstallable package)
any.template-haskell installed (non-reinstallable package)
preferences:
strategy: PreferLatestForSelected
reorder goals: False
count conflicts: True
fine grained conflicts: True
minimize conflict set: False
independent goals: False
avoid reinstalls: False
shadow packages: False
strong flags: False
allow boot library installs: False
only constrained packages: OnlyConstrainedNone
max backjumps: infinite
[__0] trying: A-1.0.0 (user goal)
[__1] trying: base-4.0.0/installed-inst (dependency of A)
[__2] next goal: A:setup.base (dependency of A)
[__2] rejecting: A:setup.base~>base-4.0.0/installed-inst (conflict: A => A:setup.base==3.0.0)
[__2] skipping: A:setup.base-4.0.0/installed-inst (has the same characteristics that caused the previous version to fail: excluded by constraint '==3.0.0' from 'A')
[__2] trying: A:setup.base-3.0.0/installed-inst
[__3] done
However, if the situation is slightly more complicated, and we have the situation where base-3
is a shim for base-4
then things quickly go wrong:
-- | A version of db11 where the dependency on base happens via a setup dependency
--
-- * The setup dependency is solved in it's own qualified scope, so should be solved
-- independently of the rest of the build plan.
--
-- * The setup dependency depends on `base-3`
--
-- * A depends on `base-4`, should be fine as the setup stanza should
-- be solved independently.
db11s :: ExampleDb
db11s =
let base3 = exInst "base" 3 "base-3-inst" [base4]
base4 = exInst "base" 4 "base-4-inst" []
in [ Left base3
, Left base4
, Right $ exAv "A" 1 [ExFix "base" 4]
`withSetupDeps` [ExFix "base" 3]
]
Unexpected solver log:
targets: A
constraints:
any.base installed (non-reinstallable package)
any.ghc-bignum installed (non-reinstallable package)
any.ghc-prim installed (non-reinstallable package)
any.ghc installed (non-reinstallable package)
any.integer-gmp installed (non-reinstallable package)
any.integer-simple installed (non-reinstallable package)
any.template-haskell installed (non-reinstallable package)
preferences:
strategy: PreferLatestForSelected
reorder goals: False
count conflicts: True
fine grained conflicts: True
minimize conflict set: False
independent goals: False
avoid reinstalls: False
shadow packages: False
strong flags: False
allow boot library installs: False
only constrained packages: OnlyConstrainedNone
max backjumps: infinite
[__0] trying: A-1.0.0 (user goal)
[__1] next goal: A.bb.base (dependency of A)
[__1] rejecting: A.bb.base-4.0.0/installed-inst (conflict: A => A.bb.base==3.0.0)
[__1] rejecting: A.bb.base-3.0.0/installed-inst (conflict: A => A.bb.base==4.0.0)
[__1] fail (backjumping, conflict set: A, A.bb.base)
[__0] fail (backjumping, conflict set: A, A.bb.base)
The issue is that with the current structure of qualified goals, the qualified goal introduced by the base shim obliterates the qualified goal introduced by the setup dependency and therefore the base
dependency in the main package and setup stanza is solved under the same qualifier (and hence fails).
I uncovered this issue when working on extending the qualified goals mechanism, so on it's own it can be filled into the niche but it highlights a more general problem with how the code around qualified goals is structured.
Activity