-
Notifications
You must be signed in to change notification settings - Fork 701
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
Look for transitive setup dependency on Cabal when choosing Cabal spec version. #5170
Conversation
…c version. Fixes haskell#4288. Previously, new-build only looked for a direct dependency on Cabal when choosing the spec version to use for running the setup script. When the setup script only had a transitive dependency on Cabal, cabal used the package's cabal-version field, which could easily differ from the actual Cabal dependency's version. Then cabal could pass flags to the setup script that weren't recognized by the Cabal dependency. This commit considers any setup dependency on Cabal when choosing the Cabal spec version.
This is a bit of a coincidence... I'll use this opportunity to ask something... :-) Yesterday I was looking into how I could inject a qualified per-package constraint on the lower bound matching the declared |
@@ -1687,10 +1684,9 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB | |||
elabRegisterPackageDBStack = buildAndRegisterDbs | |||
|
|||
elabSetupScriptStyle = packageSetupScriptStyle elabPkgDescription | |||
-- Computing the deps here is a little awful | |||
deps = fmap (concatMap (elaborateLibSolverId mapDep)) deps0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not completely sure I calculated the closure of the setup dependencies correctly, since I skipped calling elaborateLibSolverId mapDep
. I called CD.setupDeps
on deps0
directly, because all setup dependencies are library dependencies.
sounds good, but the name through me off haha. We are looking at |
@hvr I think that extending PInfo with the cabal-version makes sense. I'm not sure of the best way to enforce the constraint, though. I think it would need to somehow hook into the validation phase, in https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Solver/Modular/Validate.hs. In that case, it might be better to add the constraint to the FlaggedDeps in the PInfo (using the Dep type), similar to a setup dependency. Dep is currently defined as: -- | A dependency (constraint) associates a package name with a constrained
-- instance. It can also represent other types of dependencies, such as
-- dependencies on language extensions.
data Dep qpn = Dep (Maybe UnqualComponentName) qpn CI -- ^ dependency on a package (possibly for executable)
| Ext Extension -- ^ dependency on a language extension
| Lang Language -- ^ dependency on a language version
| Pkg PkgconfigName VR -- ^ dependency on a pkg-config package
deriving Functor I think that the Cabal constraint would need to be handled slightly differently than the existing Dep data constructor, since it would constrain but not require Cabal (and it would need a different error message when it can't be satisfied). One way to handle the constraint would be to add a Constraint data constructor to Dep that is ignored in the tree building phase (https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Solver/Modular/Builder.hs) but is treated like a Dep in the validation phase. @Ericson2314 I'm not sure I understand. What is cabal/cabal-install/Distribution/Client/ProjectPlanning/Types.hs Lines 282 to 285 in d504388
|
That is relation notation. We are looking at the reflexive-transitive closure of build-inputs joined with setup depends, not reflexive-transitive closure of setup depends. |
@Ericson2314 Yes, it isn't following multiple levels of setup-depends. |
Thanks! |
Per the README & haskell/cabal#5170 it is only necessary for Cabal < 2.4 ( 2018 ).
Per the README & haskell/cabal#5170 it is only necessary for Cabal < 2.4 ( 2018 ).
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
Fixes #4288.
Previously, new-build only looked for a direct dependency on Cabal when choosing
the spec version to use for running the setup script. When the setup script
only had a transitive dependency on Cabal, cabal used the package's
cabal-version field, which could easily differ from the actual Cabal
dependency's version. Then cabal could pass flags to the setup script that
weren't recognized by the Cabal dependency.
This commit considers any setup dependency on Cabal when choosing the Cabal spec
version.
/cc @ezyang