Skip to content
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

New command list-dependencies #682

Merged
merged 11 commits into from
Jul 29, 2015

Conversation

markus1189
Copy link
Contributor

Implements #638 .

Adds a new command stack list-dependencies that will list all transitive dependencies for the local packages.

It's not able to show dependencies for the test and benchmark packages, because I could not figure out how to do it, nevertheless I though I should probably pr this as is for the added functionality.

The problem I had with test/benchmark in a nutshell:

It seems like loadSourceMap and loadLocals by default assume that they are not enabled (package config sets it to false). Once I changed that it seems like it somehow does not pickup the dependencies for test packages like QuickCheck when using withLoadPackage's function to load packages...

If you see what I am doing wrong I'd be happy to change this :)

The nice part is that it reuses the structure generated by Stack.Dot so in theory we could also display versions for the stack dot output.

@creichert
Copy link

Awesome, +1 from me

On Mon, Jul 27 2015, Markus Hauck [email protected] wrote:

Implements #638 .

Adds a new command stack list-dependencies that will list all transitive dependencies for the local packages.

It's not able to show dependencies for the test and benchmark packages, because I could not figure out how to do it, nevertheless I though I should probably pr this as is for the added functionality.

The problem I had with test/benchmark in a nutshell:

It seems like loadSourceMap and loadLocals by default assume that they are not enabled (package config sets it to false). Once I changed that it seems like it somehow does not pickup the dependencies for test packages like QuickCheck when using withLoadPackage's function to load packages...

If you see what I am doing wrong I'd be happy to change this :)

The nice part is that it reuses the structure generated by Stack.Dot so in theory we could also display versions for the stack dot output.
You can view, comment on, or merge this pull request online at:

#682

-- Commit Summary --

  • Remove redundant TemplateHaskell pragma
  • Keep track of versions in dot dependency graph
  • Add list-dependencies subcommand
  • Update DotSpec
  • Use lpPackageFinal instead of lpPackage
  • Add separator argument to stack list-dependencies
  • Version of installed packages in list-dependencies
  • Remove local packages from list-dependencies output
  • Use locals from loadSourceMap where possible
  • Correct haddock code markup and some formatting

-- File Changes --

M src/Stack/Dot.hs (157)
M src/main/Main.hs (16)
M src/test/Stack/DotSpec.hs (41)

-- Patch Links --

https://github.com/commercialhaskell/stack/pull/682.patch
https://github.com/commercialhaskell/stack/pull/682.diff


Reply to this email directly or view it on GitHub:
#682

@markus1189 markus1189 force-pushed the 638-list-dependencies branch from 0807f89 to 10b2428 Compare July 27, 2015 19:38
@borsboom
Copy link
Contributor

I'd prefer the default separator to be -, to match ghc-pkg list and many other things (but very nice to see the --separator option, that will make scripting much easier).

I'm also currently seeing the version shown as <unknown> for any packages included with GHC. Is that expected?

base <unknown>
ghc-prim <unknown>
integer-gmp <unknown>
template-haskell <unknown>

@markus1189
Copy link
Contributor Author

Well I think two things speak for as the default.
1.cabal list --installeduses it as well
2. you can more easily extract only the version/only the name when using a space because it is not part of a valid package name (right?), whereas-is, e.g.x509-system 1.5.0is easier to take apart thanx509-system-1.5.0.

Having said that I have to strong feelings for any default so I am also fine with - as a separator.

I'm also currently seeing the version shown as for any packages included with GHC. Is that expected?

Uhm no, for me it's not the case, I have

base 4.7.0.2
ghc-prim 0.3.1.0
integer-gmp 0.5.1.0
template-haskell 2.9.0.0

The <unknown> means that the version was not resolved and is Nothing, though I guess it would be better to either let it out completely or error, or maybe add an cmdline option.

Strange, any idea on what I could do to reproduce? I am using the standard stack.yaml checked in the repo.

@borsboom
Copy link
Contributor

Yeah I don't have a strong preference for the separator either (I've just gotten used to -), so I'm fine with leaving at as space.

Here's my --verbose output. Can you compare to yours?

$ stack --verbose list-dependencies
Version 0.1.2.1, Git revision 67220bfed687e80d69cc64df1dd48026ecc2b55f
2015-07-29 16:47:11.30497: [debug] Checking for project config at: /Users/manny/fpco/tmp/stack/stack.yaml @(stack-0.1.2.1:Stack.Config src/Stack/Config.hs:460:9)
2015-07-29 16:47:11.307415: [debug] Loading project config file stack.yaml @(stack-0.1.2.1:Stack.Config src/Stack/Config.hs:483:13)
2015-07-29 16:47:11.318005: [debug] Run process: ghc --numeric-version @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
2015-07-29 16:47:11.377504: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal id @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
2015-07-29 16:47:11.402206: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
2015-07-29 16:47:11.426672: [debug] Checking resolver: lts-2.17 @(stack-0.1.2.1:Stack.Build.Source src/Stack/Build/Source.hs:87:13)
2015-07-29 16:47:11.795129: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
2015-07-29 16:47:11.83475: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/manny/.stack/snapshots/x86_64-osx/lts-2.17/7.8.4/pkgdb/ dump --expand-pkgroot @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
2015-07-29 16:47:11.915845: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/manny/fpco/tmp/stack/.stack-work/install/x86_64-osx/lts-2.17/7.8.4/pkgdb/ dump --expand-pkgroot @(stack-0.1.2.1:System.Process.Read src/System/Process/Read.hs:255:3)
[...]

@markus1189
Copy link
Contributor Author

What git revision is that? origin/638-list-dependencies is 10b2428 for me, otherwise the output looks the same (ignoring the paths and time): https://www.diffchecker.com/ur99obyp

@borsboom
Copy link
Contributor

Ah, that was after I merged in upstream master. I reset to 10b2428 and still see the <unknown>s.

@markus1189
Copy link
Contributor Author

Hm even after clean and removing .stack-work it's still not the case here, that's really mysterious

libVersionFromInstalled (Library ghcPkgId) =
case ghcPkgIdPackageIdentifier ghcPkgId of
PackageIdentifier _ v -> Just v
libVersionFromInstalled (Executable _) = Nothing
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where the nothing comes from in the end

@markus1189
Copy link
Contributor Author

Seems like it also works on travis: https://travis-ci.org/markus1189/stack/jobs/73232119

borsboom added a commit that referenced this pull request Jul 29, 2015
@borsboom borsboom merged commit d964178 into commercialhaskell:master Jul 29, 2015
@borsboom
Copy link
Contributor

After blowing away my old ~/.stack, it's reporting version numbers for all packages. I spent some time looking into the difference, but so far not finding anything and I don't know that it's worth putting more effort into.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 26, 2016

I just ran into the fact that it uses space instead of -. Are we sure that's a reasonable default? :/

I wanted to do stack list-dependencies | xargs stack unpack.

We might consider changing the behavior of this once we've sorted out the show / query commands (#1614)

@mgsloan
Copy link
Contributor

mgsloan commented Feb 26, 2016

Opened this issue: #1614

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.

5 participants