-
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
Fix #2066: buildDepends is just an accessor function, not a field #4383
Fix #2066: buildDepends is just an accessor function, not a field #4383
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @ezyang and @23Skidoo to be potential reviewers. |
I'd like to see other opinions on the approach taken here, which is to replace the Some prior discussion on the subject is here: #3466 (comment) where @kosmikus comments on the fact that allow-older operates by modifying the package description to change the version bounds. In the end we accepted the modification code, because (a) we needed it somehow in the Setup support for allow-older, and (b) it wasn't convenient to modify the solver to do it otherwise. But in the case of |
d540a69
to
fc7657a
Compare
fc7657a
to
26b1593
Compare
What's all this "quick brown fix" stuff in the test. We're not a font renderer! |
It's testing that we don't deadlock when the test executable emits a lot of output. |
26b1593
to
36eb3ef
Compare
@ezyang this is passing except for some appveyor thing which looks unrelated. I agree this is not the most elegant fix, but might be expedient for 2.0, insofar that it enables |
AppVeyor failure doesn't looks spurious to me. Restarted the AppVeyor build. |
@23Skidoo indeed it doesn't look spurious, but I didn't touch that file or anything related either? More spooky CI! |
Maybe a dependency changed or some CPP'ed code bitrotted. |
Build failure looks triggered by release of optparse-applicative-0.13.2.0, which appears to be BC breaking. If you add an upper bound that should solve the problem. As for whether to merge, I think I'd prefer this to be a package deal with LibDependency changes |
Sounds good |
@ezyang pcapriotti/optparse-applicative@0.13.1...0.13.2 looks back-compat to me, you sure about that? |
Yeah, looks like I'm wrong and the actual problem is a missing Data.Semigroup import... |
@ezyang I feel like the right solution would be |
What I find really perplexing is that I can't repro your bug. :/ |
To double check, you tried on 7.4? Yeah I'm confused why master and other PRs don't break with this. |
36eb3ef
to
bbc583a
Compare
Perhaps waiting for #4265 was not the right approach as I (with @kmicklas's help) are only getting back to it a year later. I'd like to fix #4203 too, but I don't think this digs that hole much deeper. As soon as there as any mechanism to add/override extra constraints, I'd hope it can easily be used for all such things. |
@@ -62,6 +63,14 @@ componentBuildInfo :: Component -> BuildInfo | |||
componentBuildInfo = | |||
foldComponent libBuildInfo foreignLibBuildInfo buildInfo testBuildInfo benchmarkBuildInfo | |||
|
|||
lensBuildInfo :: (BuildInfo -> BuildInfo) -> (Component -> Component) |
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.
We now depend on some Lenz stuff so maybe this can go elsewhere / use type synonym in the type?
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.
Yes, we already have:
instance L.HasBuildInfo Component where |
redoBD bd_lens = bd_lens $ \bi -> bi { targetBuildDepends = fromDepMap depMap } | ||
|
||
lensLibBD :: (BuildInfo -> BuildInfo) -> (Library -> Library) | ||
lensLibBD f = \l -> l { libBuildInfo = f $ libBuildInfo l } |
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.
we have that lens. it's over L.buildInfo
. We also have targetBuildDepends
(which can apply directly on Library
):
targetBuildDepends :: Lens' a [Dependency] |
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.
BTW, lensLibBD
is not Lens
, it's Setter
;)
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.
😲😆
d9cd6dc
to
a36ef41
Compare
I can't figure out why the parsing tests would fail for one GHC but not another. But maybe its just spurious? 8.2.2 certainly worked fine locally. |
Ah, its cause I need to rebase |
- Post flag-solving, replace buildDepends with solved dependencies. - In most cases, just collect the build-depends of *enabled* components. B4ut in a few, we have no enable spec on hand and must collect them all
Eventually, configuring will be rewritten so extra constraints do note pollute the checks. When that happens this commit should be reverted.
a36ef41
to
73713ef
Compare
@@ -1369,7 +1369,7 @@ checkCabalVersion pkg = | |||
_ -> False | |||
|
|||
versionRangeExpressions = | |||
[ dep | dep@(Dependency _ vr) <- buildDepends pkg | |||
[ dep | dep@(Dependency _ vr) <- allBuildDepends pkg |
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.
This makes my BC senses tingle. What's the BC story for custom setups that call buildDepends
. Can we preserve the old semantics under the old name?
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.
https://github.com/23Skidoo/all-custom-setups says buildDepends
it isn't really used anywhere, pandoc-1.6
is from 2010
~/all-custom-setups$ git grep -e buildDepends origin/all-custom-setups
origin/all-custom-setups:open-pandoc-1.5.1.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.0.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.1.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.6.0.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.6/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
ogre@bigtest:~/all-custom-setups$ git grep -e buildDepends origin/all-custom-setups
origin/all-custom-setups:open-pandoc-1.5.1.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.0.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.1.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.5/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.6.0.1/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
origin/all-custom-setups:pandoc-1.6/Setup.hs: let highlightingSupport = any isHighlightingKate $ buildDepends pkg
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.
Yeah per the big comment at https://github.com/haskell/cabal/pull/4383/files#diff-d02dbf8d6911c6afb8c8cb25ebc6ea9cL127, anything that uses it seems bound to be incorrect anyways.
@@ -398,6 +389,13 @@ enabledBuildInfos pkg enabled = | |||
-- * Utils | |||
-- ------------------------------------------------------------ | |||
|
|||
allBuildDepends :: PackageDescription -> [Dependency] |
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.
Need docs, same with the other function below.
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.
FYI, in other PR I made allBuildInfo
return all BuildInfo
, also non-buildable. I don't know if they should be filtered out here.
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.
enabledBuildDepends
below does that.
flattenTst (n, t) = testFillInDefaults $ (fst $ ignoreConditions t) | ||
{ testName = n } | ||
flattenBm (n, t) = benchFillInDefaults $ (fst $ ignoreConditions t) | ||
{ benchmarkName = n } |
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.
What happened in this diff?
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 removed the accumulation of deps and just did the flattening of components. Because of the removal of https://github.com/haskell/cabal/pull/4383/files#diff-12c8f4f2a1b901f8cbc37a619afafcb7L520, we no longer need that accumulation.
(PDNull, x) -> x -- actually this should not happen, but let's be liberal | ||
where | ||
redoBD :: L.HasBuildInfo a => a -> a | ||
redoBD = set L.targetBuildDepends $ fromDepMap depMap |
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.
What does this do?
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.
It's been a while, but pretty sure this is the problematic bit via your choice a year ago. The difference between the new version and the old version is now we updated the components' targetBuildDepends
with the depMaps
of each target, whereas before those just updated the top-level build depends at https://github.com/haskell/cabal/pull/4383/files#diff-12c8f4f2a1b901f8cbc37a619afafcb7L450.
Well, I guess it looks plausible; we'll see how the tests go. Are you planning to fix the spurious warnings? What's the game plan there? |
Forgot to do this in #4383 [skip ci]
Forgot to do this in #4383 [skip ci]
Forgot to do this in #4383 [skip ci]
Forgot to do this in #4383 [skip ci]
Revert "Merge pull request #4383 from Ericson2314/no-legacy-build-dep…
Prerequisite for #4265