-
Notifications
You must be signed in to change notification settings - Fork 696
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
Force Cabal >= 1.24 dep when there's no custom-setup stanza. #3337
Conversation
I considered adding a test case, but it's a bit difficult given that you need to have a pre-1.24 version of Cabal installed for the bug to manifest. |
GHC 8 failure is due to GHC 8 RC having an old snapshot of Cabal 1.24. Ugh, wish we could ignore it somehow. |
In principle, cabal-install should know what version of Cabal it was built with, so it can demand that from the package database. But this won't work if you're distributing a statically linked Cabal binary, in that case you can't assume the Cabal 1.24 library is installed. |
Yep. Some people also like to build |
I don't understand the approach this patch takes. Wasn't the original plan to only levy this implicit dependency if there was a |
I think we want a test, if only to tell if the patch actually fixes the problem. I think the easiest way to do this is to make the integration test GHC < 8.0 only. In these cases, we can assume GHC was distributed with an older version of Cabal. This will be sufficient for Travis. |
Sure, I can do that, just wanted to get some comments first. Though I think that forcing custom setup scripts to use the same Cabal version that cabal-install was compiled with is a good idea in general (provided that the user can force a different version manually via |
-- 'useDependencies'. This is turned on (in conjunction with | ||
-- useDependenciesExclusive = False) when a default setup dependencies | ||
-- stanza is added by cabal-install itself. See #3199. | ||
noDefaultCabalDep :: Bool, |
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.
So, is useDependenciesExclusive == True, noDefaultCabalDep == True an impossible state?
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.
useDependenciesExclusive == True
In that case noDefaultCabalDep
is ignored.
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 hope we can simplify the setup wrapper in future, the logic is getting really rather hairy. Fortunately the new-build code path only needs a fraction of the functionality, since it knows exactly what deps to use in advance, so doesn't need any of the guesswork that the setupWrapper currently does.
CC @dcoutts I know Duncan has stated we want the logic for compiling custom setups to be as simple as possible, so other tools (like Stack) can also handle them; I don't know how far the wrong way this goes. |
Re the Travis failure, a minor version bump should do the trick, right? |
Actually I think I can get rid of
Yes, I just didn't want the first 1.24 release to have a version number other than 1.24.0.0. Next time we create a release branch we should bump the version only just before the release. |
@23Skidoo Unfortunately the first patch would break the use case in new-build. Have a look at: cabal/cabal-install/Distribution/Client/ProjectPlanning.hs Lines 1624 to 1668 in 1223a39
There we apply our own deps for two cases, build-type custom with no explicit deps, but also non-custom when we need to build an external setup anyway. So rather than changing how |
@@ -308,18 +308,22 @@ instance Text BuildType where | |||
-- options authors can specify to just Haskell package dependencies. | |||
|
|||
data SetupBuildInfo = SetupBuildInfo { | |||
setupDepends :: [Dependency] | |||
setupDepends :: [Dependency], | |||
defaultSetupDepends :: Bool |
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.
Ah, cunning. I went to some lengths in the new-build code to do this without changing the underlying type, but yes it is rather easier if we can just stash the info here. I might switch the new-build code over to use that, rather than keeping an extra Set around.
So this fixes things for packages without custom setup deps, of course we still have the problem for packages that do specify an upper bound we would still have trouble communicating to them. But it's ok as a quick hack before the release I'd say (modulo the fixes I've suggested above), but it'd be good to try and make it possible to use older Cabal versions, since we do want to be able to have packages explicitly specify versions they work with (especially since we do want to start breaking the Cabal lib API to let us make bigger improvements). So we may need a proper fix to this in master at some point, and perhaps also consider making releases off of older branches that work with newer compiler versions. I'll have a think about what a fix that did allow us to talk to the older ones here would look like, for the new-build code path, where we know a bit more up front about what we want to do with the setup. I take @grayjay's point about this being tricky in the solver since we need to know both what version of Cabal will be used for Setup, and based on that decide if we include the "unnecessary" deps of non-buildable components. |
That's no different than a package specifying an upper bound on e.g.
...but then cabal would also need a way to know that, for instance, the preinstalled
that would cause problems for GHC dev (we request a bump-early-in-git policy especially for major ver bumps from bundled libraries, see https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/EagerVersionBump) and mask problems during RCs and/or cause annoying upper-bound-change-waves if last-minute upper bound changes occur :-/ |
|
PR updated:
Our versioning scheme (odd numbers == development, even == official releases) worked fine for GHC snapshots so far, I just want to extend it for release branches. So e.g. the 1.24 branch would continue to have the 1.23.x.y version right until the release. If reverse dependencies will specify the Cabal dep as The invariant I want to enforce is "version of Cabal in the repo" > "version of Cabal that came with GHC we're compiling with". |
alwaysTrue (PD.Lit True) = True | ||
alwaysTrue _ = False | ||
|
||
-- copied from D.PackageDescription.Configuration.extractCondition |
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.
Blugh, copypasta!!
The test case could be improved: right now we always install Cabal 1.24 before running the |
What if we tell Cabal to not use the user database for these tests? |
Something like that should work. |
Will fix the remaining issues tomorrow. |
Updated the test case. |
657cb23
to
c224110
Compare
Moved copy-pasted utilities into the Cabal library, improved the test case. I think that this is now ready to go in, will merge once the build bots are green. |
cOr x (Lit False) = x | ||
cOr c (CNot d) | ||
| c == d = Lit True | ||
cOr x y = COr x y |
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 forgot to mention that I added a case to my snippet:
cor (CNot c) d
| c == d = Lit True
Without it, the function testing whether #3199 applies doesn't ignore this use of buildable:
executable exe
if !flag(build-exe)
buildable: False
else
build-depends: package
[...]
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.
indeed, it's kinda odd that symmetry was broken for the "x or (not x)" case...
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.
@grayjay Updated.
2824494
to
ccbe9f2
Compare
Probably just temporary, required to make Travis green.
Fixes #3199.
To minimise the impact we should probably add default setup dependencies only to packages affected by #3199 (see @grayjay's snippet). Note, however, that the setup wrapper will pick Cabal >= 1.24 anyway if it is installed, since it prefers new Cabal versions.
Note also that
cabal configure
will still fail (unlikecabal install
), though the error message will be more helpful than it currently is:/cc @dcoutts