Skip to content

Implement build-tool-depends - #4104

Merged
Ericson2314 merged 9 commits into
haskell:masterfrom
Ericson2314:tool-depends
Jan 7, 2017
Merged

Ericson2314 merged 9 commits into
haskell:masterfrom
Ericson2314:tool-depends

Conversation

@Ericson2314

@Ericson2314 Ericson2314 commented Nov 12, 2016 •

Copy link
Copy Markdown
Collaborator

Implements much of #3708

Note the the exe component name is currently mandatory, unlike as specified in the original issue.

@mention-bot

Copy link
Copy Markdown

@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ezyang, @dcoutts and @phadej to be potential reviewers.

@ezyang ezyang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 1 review.

Comment thread Cabal/Distribution/Package.hs Outdated
-- could refer to a pkg-config executable (PkgconfigName), or an internal
-- executable (UnqualComponentName). Thus the name is stringly typed.
--
--g

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Comment thread Cabal/Distribution/Package.hs Outdated
PackageName
UnqualComponentName -- name of executable component of package
VersionRange
deriving (Generic, Read, Show, Eq, Typeable, Data)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible that you may want a helper function that takes an ExeDependency and gives a ComponentName (since the UnqualComponentName is only "implicitly" qualified.) I don't know if you'd actually use it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, doesn't hurt to add it now. Good hint on unqual vs qual for anyone working with the code base.

Comment thread Cabal/Distribution/Package/TextClass.hs Outdated

parse = do name <- parse
_ <- Parse.char ':'
exe <- parse

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so right now you are forced to specify the executable name. That's fine (although our users might complain :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides laziness, I figured a blanket depend-on-all-the-exes dependency might complicate making the solver use deps on specific components. Then again we may need a blanket package dep anyways.

@ezyang ezyang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 3 (commit 2 was obvious, no problem.)

-- that we know how to desugar.
--
-- This should almost always be used instead of just accessing the
-- `toolDepends` field directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if that's true there better be a comment on toolDepends telling people about it, or rename that field to something to discourage people from using it directoy.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some longer documentation to the relevant fields in the top commit. I'll also grep at the end to make sure nothing is lurking.

@Ericson2314 Ericson2314 Nov 26, 2016 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could sed the field names too, but probably easiest to do that last.

--
-- This is a tiny function, but used in a number of places. Note that the
-- version bounds and components of the package are unchecked. This is because
-- we sanitize exe deps so that the matching name implies these other

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this sanitizing happen.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PackageDescription.Check does sanitation happen in places besides that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the overall codebase doesn't use "sanitization" as the term here. Furthermore, not all checks in PackageDescription.Check are necessarily run all the time: a package can still be built even if some of the checks fail. It is better to say that there is some invariant that is expected to hold; in that case the invariant description should be at the data type definition.

++ "'tested-with: GHC==6.10.4 && ==6.12.3'."

, check (not (null buildDependsRangeOnInternalLibrary)) $
, check (not (null depInternalLibraryWithExtraVersion)) $

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't read this code carefully. Good tests would tickle all of these cases.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew! A lot of copy pasta but tested everything.

@ezyang

ezyang commented Nov 12, 2016

Copy link
Copy Markdown
Contributor

Looking good. Obviously you still need to do the cabal-install bits.

@Ericson2314
Ericson2314 force-pushed the tool-depends branch 4 times, most recently from f6d7e02 to 3269f83 Compare November 16, 2016 13:54
@Ericson2314

Copy link
Copy Markdown
Collaborator Author

How should I write the (presumably system) tests for those tests? I see the cabal files in PackageTests, but not sure where the code verifying stdout / stderr is.

@Ericson2314
Ericson2314 force-pushed the tool-depends branch 2 times, most recently from b1487b4 to fd11fbc Compare November 16, 2016 16:29
@23Skidoo

Copy link
Copy Markdown
Member

You may want to wait until #4095 is merged.

@Ericson2314

Copy link
Copy Markdown
Collaborator Author

Hmm good idea

@Ericson2314

Ericson2314 commented Nov 17, 2016 •

Copy link
Copy Markdown
Collaborator Author

Hmm, so InternalLibrary4 explicitly tests that version bounds can trigger the use of an external library instead of internal one. This is in direct conflict with the buildDependsRangeOnInternalLibrary test this patch expands---it says version bounds don't matter because the internal library is always used. I don't really care which semantics we go with, except that we should be consistent for all 3 of "build-tools", "build-depends", and "tool-depends".

@ezyang

ezyang commented Nov 17, 2016

Copy link
Copy Markdown
Contributor

@Ericson2314 We got rid of this feature in af24cef. Internal library should always be used.

@Ericson2314

Ericson2314 commented Nov 26, 2016 •

Copy link
Copy Markdown
Collaborator Author

Ok things left: edit see new list in comment below

  • cabal-install's init
  • cabal-install's tests
  • Real name for Distribution.FooBar :D

@ezyang ezyang left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's helpful if the commit message mentions the overall code motion that occurred; especially here were some things got deleted, and other things got added.

@ezyang

ezyang commented Nov 26, 2016

Copy link
Copy Markdown
Contributor

Lookin' good!

, let toolname = mkUnqualComponentName name
, toolname `elem` map exeName (executables pkg_descr) ]
| (ExeDependency _ toolname _)
<- getAllInternalToolDependencies pkg_descr bi ]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

Comment thread Cabal/Distribution/Types/BuildInfo.hs Outdated
-- precisely specify an executable in a package.
--
-- Unless use are very sure what you are doing, use the function in
-- `Distribution.FooBar` rather than accessing this field directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... which function/!

@ezyang

ezyang commented Nov 28, 2016

Copy link
Copy Markdown
Contributor

NB: this shouldn't be merged until "Ok things left:" list is done.

@hvr

hvr commented Nov 28, 2016

Copy link
Copy Markdown
Member

@ezyang what's the first todo item about? if it's about cabal init I don't think it's essential for this PR

@ezyang

ezyang commented Nov 28, 2016

Copy link
Copy Markdown
Contributor

Looking at the source code, it doesn't look like the new-build code has been adjusted for tool-depends yet. But maybe no changes were needed; I don't know if it works or not; the tests would be able to say so.

@Ericson2314
Ericson2314 force-pushed the tool-depends branch 4 times, most recently from 30e62d9 to 0b62af1 Compare December 6, 2016 16:19
@Ericson2314

Ericson2314 commented Jan 6, 2017 •

Copy link
Copy Markdown
Collaborator Author

Ok, docs are done also all that remains is cabal init, and making the PATH more fine-grained a la #4104 (comment) . OK to do those in future PRs?

@ezyang

ezyang commented Jan 6, 2017

Copy link
Copy Markdown
Contributor

Yep. Anything in particular you want reviewed before merging?

@hvr

hvr commented Jan 7, 2017

Copy link
Copy Markdown
Member

let's get this merged soon before the PR starts to "conflict-rot" :-)

@Ericson2314
Ericson2314 merged commit 5e4377b into haskell:master Jan 7, 2017
@Ericson2314
Ericson2314 deleted the tool-depends branch January 7, 2017 16:09
@Ericson2314 Ericson2314 changed the title [WIP] implement tool-depends implement tool-depends Jan 9, 2017
@Ericson2314 Ericson2314 changed the title implement tool-depends Implement tool-depends Jan 9, 2017
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 11, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 12, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
@ezyang

ezyang commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

@Ericson2314 It would be great if we could have a changelog entry too!

@phadej

phadej commented Jan 13, 2017

Copy link
Copy Markdown
Collaborator

I can't wait till this gets to hvr's ppa repository so I can try it out wild!

@hvr

hvr commented Jan 14, 2017

Copy link
Copy Markdown
Member

@phadej ...I got the hint ;-)

@Ericson2314

Copy link
Copy Markdown
Collaborator Author

@ezyang

ezyang commented Jan 16, 2017

Copy link
Copy Markdown
Contributor

Thanks!

Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 17, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
@Ericson2314 Ericson2314 mentioned this pull request Jan 17, 2017
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 17, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 17, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 18, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 18, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 18, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 20, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
Ericson2314 added a commit to Ericson2314/cabal that referenced this pull request Jan 23, 2017
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
@Ericson2314 Ericson2314 changed the title Implement tool-depends Implement build-tool-depends Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants