commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.99k stars 845 forks source link

stack list-dependencies #638

Closed bitemyapp closed 9 years ago

bitemyapp commented 9 years ago

Would help with some custom Dockerization stuff, ideally we'd be able to run it and collect a set of all packages we need across multiple projects and their respective versions so we can install the deps before our code gets into the Docker image.

creichert commented 9 years ago

This would be quite nice. It would also help for generating the tags for a stack megarepo and all it's dependencies (similar to how codex works and mentioned in the `codex issue tracker).

On Mon, Jul 20 2015, Chris Allen notifications@github.com wrote:

Would help with some custom Dockerization stuff, ideally we'd be able to run it and collect a set of all packages we need and their respective versions so we can install the deps before our code gets into the Docker image.


Reply to this email directly or view it on GitHub: https://github.com/commercialhaskell/stack/issues/638

borsboom commented 9 years ago

Would the output of stack dot --external be usable for this? I realize it's not in the ideal format, but might work as something to tide you over.

bitemyapp commented 9 years ago

@manny-fp doesn't have versions and would require munging but might save us some work. Thank you!

borsboom commented 9 years ago

A PR implementing this would be most welcome, and happy to answer any questions or give direction. Hopefully the stack dot can be used as a starting point.

markus1189 commented 9 years ago

I think I will give this a go, what's the desired output? Just lines of <package name>-<version>?

bitemyapp commented 9 years ago

@markus1189 tab separated for easier shell processing would be even better, if it's not too much trouble.

$packagename<TAB>$version

creichert commented 9 years ago

Something like cabal list --simple-output would work perfectly for my use.

On Wed, Jul 22 2015, Markus Hauck notifications@github.com wrote:

I think I will give this a go, what's the desired output? Just lines of -?


Reply to this email directly or view it on GitHub: https://github.com/commercialhaskell/stack/issues/638#issuecomment-123643813

markus1189 commented 9 years ago

A first version is here: https://github.com/markus1189/stack/tree/638-list-dependencies. Example

$ stack list-dependencies --separator '-'
Cabal-1.18.1.5
MonadRandom-0.3.0.2
StateVar-1.1.0.0
adjunctions-4.2.1
aeson-0.8.0.2
ansi-terminal-0.6.2.1
ansi-wl-pprint-0.6.7.2
array-0.5.0.0
asn1-encoding-0.9.0
asn1-parse-0.9.1
asn1-types-0.3.0
async-2.0.2
attoparsec-0.12.1.6
auto-update-0.1.2.2
base-<unknown>
base16-bytestring-0.1.1.6
base64-bytestring-1.0.0.1
bifunctors-4.2.1
binary-0.7.1.0
blaze-builder-0.4.0.1
blaze-html-0.8.0.2
blaze-markup-0.7.0.2
byteable-0.1.1
bytestring-0.10.4.0
bytestring-builder-0.10.6.0.0
case-insensitive-1.2.0.4
cereal-0.4.1.1
chunked-data-0.1.0.1
cipher-aes-0.2.11
cipher-des-0.0.6
cipher-rc4-0.1.4
comonad-4.2.6
conduit-1.2.4.2
conduit-combinators-0.3.1
conduit-extra-1.1.9
connection-0.2.4
containers-0.5.5.1
contravariant-1.3.1.1
cookie-0.4.1.6
crypto-cipher-types-0.0.9
crypto-numbers-0.2.7
crypto-pubkey-0.2.8
crypto-pubkey-types-0.4.3
crypto-random-0.0.9
cryptohash-0.11.6
cryptohash-conduit-0.1.1
data-default-class-0.0.1
deepseq-1.3.0.2
deepseq-generics-0.1.1.2
directory-1.2.1.0
distributive-0.4.4
dlist-0.7.1.1
dlist-instances-0.1
either-4.3.4.1
enclosed-exceptions-1.0.1.1
exceptions-0.8.0.2
fast-logger-2.3.1
file-embed-0.0.8.2
filepath-1.3.0.2
free-4.11
fsnotify-0.1.0.3
ghc-prim-<unknown>
gitrev-1.0.0
hashable-1.2.3.3
hastache-0.6.1
hinotify-0.3.7
hourglass-0.2.9
http-client-0.4.15
http-client-tls-0.2.2
http-conduit-2.1.5.1
http-types-0.8.6
ieee754-0.7.6
integer-gmp-<unknown>
kan-extensions-4.2.2
keys-3.10.2
lifted-base-0.2.3.6
memory-0.7
mime-types-0.1.0.6
mmorph-1.0.4
monad-control-1.0.0.4
monad-logger-0.3.13.1
monad-loops-0.4.3
mono-traversable-0.9.2.1
mtl-2.1.3.1
mwc-random-0.13.3.2
nats-1
network-2.6.2.0
network-uri-2.6.0.3
old-locale-1.0.0.6
optparse-applicative-0.11.0.2
optparse-simple-0.0.3
parsec-3.1.9
path-0.5.2
path-pieces-0.2.0
pem-0.2.2
persistent-2.1.6
persistent-sqlite-2.1.4.2
persistent-template-2.1.3.4
pointed-4.2.0.2
prelude-extras-0.4
pretty-1.1.1.1
primitive-0.6
process-1.2.0.0
profunctors-4.4.1
project-template-0.2.0
random-1.1
resource-pool-0.2.3.2
resourcet-1.1.5
retry-0.6
safe-0.3.9
scientific-0.3.3.8
securemem-0.1.9
semigroupoids-4.3
semigroups-0.16.2.2
silently-1.2.4.1
socks-0.5.4
split-0.2.2
stack-0.1.2.1
stm-2.4.4
stm-chans-3.0.0.4
streaming-commons-0.1.12.1
syb-0.4.4
system-fileio-0.3.16.3
system-filepath-0.4.13.4
tagged-0.7.3
tar-0.4.1.0
template-haskell-<unknown>
temporary-1.2.0.3
text-1.2.0.6
time-1.4.2
tls-1.2.18
transformers-0.3.0.0
transformers-base-0.4.4
transformers-compat-0.4.0.3
unix-2.7.0.1
unix-compat-0.4.1.4
unordered-containers-0.2.5.1
vector-0.10.12.3
vector-algorithms-0.6.0.4
vector-binary-instances-0.2.1.0
vector-instances-3.3.0.1
void-0.7
word8-0.1.2
x509-1.5.1
x509-store-1.5.0
x509-system-1.5.0
x509-validation-1.5.2
yaml-0.8.11
zlib-0.5.4.2

I am currently stuck trying to figure out how to get the version for packages that came with ghc, e.g. template-haskell, base, etc. any idea (maybe @manny-fp)? Currently I am using the SourceMap from Stack.Build.Source via loadSourceMap but they are not in there... (source)

And on a related note, currently I am printing all dependencies, not only the direct ones (listed in build-depends, that's what you want, right?)

snoyberg commented 9 years ago

You'd have to use the installed package information for those.

On Fri, Jul 24, 2015, 1:30 AM Markus Hauck notifications@github.com wrote:

A first version is here: https://github.com/markus1189/stack/tree/638-list-dependencies. Example

$ stack list-dependencies --separator '-' Cabal-1.18.1.5 MonadRandom-0.3.0.2 StateVar-1.1.0.0 adjunctions-4.2.1 aeson-0.8.0.2 ansi-terminal-0.6.2.1 ansi-wl-pprint-0.6.7.2 array-0.5.0.0 asn1-encoding-0.9.0 asn1-parse-0.9.1 asn1-types-0.3.0 async-2.0.2 attoparsec-0.12.1.6 auto-update-0.1.2.2 base- base16-bytestring-0.1.1.6 base64-bytestring-1.0.0.1 bifunctors-4.2.1 binary-0.7.1.0 blaze-builder-0.4.0.1 blaze-html-0.8.0.2 blaze-markup-0.7.0.2 byteable-0.1.1 bytestring-0.10.4.0 bytestring-builder-0.10.6.0.0 case-insensitive-1.2.0.4 cereal-0.4.1.1 chunked-data-0.1.0.1 cipher-aes-0.2.11 cipher-des-0.0.6 cipher-rc4-0.1.4 comonad-4.2.6 conduit-1.2.4.2 conduit-combinators-0.3.1 conduit-extra-1.1.9 connection-0.2.4 containers-0.5.5.1 contravariant-1.3.1.1 cookie-0.4.1.6 crypto-cipher-types-0.0.9 crypto-numbers-0.2.7 crypto-pubkey-0.2.8 crypto-pubkey-types-0.4.3 crypto-random-0.0.9 cryptohash-0.11.6 cryptohash-conduit-0.1.1 data-default-class-0.0.1 deepseq-1.3.0.2 deepseq-generics-0.1.1.2 directory-1.2.1.0 distributive-0.4.4 dlist-0.7.1.1 dlist-instances-0.1 either-4.3.4.1 enclosed-exceptions-1.0.1.1 exceptions-0.8.0.2 fast-logger-2.3.1 file-embed-0.0.8.2 filepath-1.3.0.2 free-4.11 fsnotify-0.1.0.3 ghc-prim- gitrev-1.0.0 hashable-1.2.3.3 hastache-0.6.1 hinotify-0.3.7 hourglass-0.2.9 http-client-0.4.15 http-client-tls-0.2.2 http-conduit-2.1.5.1 http-types-0.8.6 ieee754-0.7.6 integer-gmp- kan-extensions-4.2.2 keys-3.10.2 lifted-base-0.2.3.6 memory-0.7 mime-types-0.1.0.6 mmorph-1.0.4 monad-control-1.0.0.4 monad-logger-0.3.13.1 monad-loops-0.4.3 mono-traversable-0.9.2.1 mtl-2.1.3.1 mwc-random-0.13.3.2 nats-1 network-2.6.2.0 network-uri-2.6.0.3 old-locale-1.0.0.6 optparse-applicative-0.11.0.2 optparse-simple-0.0.3 parsec-3.1.9 path-0.5.2 path-pieces-0.2.0 pem-0.2.2 persistent-2.1.6 persistent-sqlite-2.1.4.2 persistent-template-2.1.3.4 pointed-4.2.0.2 prelude-extras-0.4 pretty-1.1.1.1 primitive-0.6 process-1.2.0.0 profunctors-4.4.1 project-template-0.2.0 random-1.1 resource-pool-0.2.3.2 resourcet-1.1.5 retry-0.6 safe-0.3.9 scientific-0.3.3.8 securemem-0.1.9 semigroupoids-4.3 semigroups-0.16.2.2 silently-1.2.4.1 socks-0.5.4 split-0.2.2 stack-0.1.2.1 stm-2.4.4 stm-chans-3.0.0.4 streaming-commons-0.1.12.1 syb-0.4.4 system-fileio-0.3.16.3 system-filepath-0.4.13.4 tagged-0.7.3 tar-0.4.1.0 template-haskell- temporary-1.2.0.3 text-1.2.0.6 time-1.4.2 tls-1.2.18 transformers-0.3.0.0 transformers-base-0.4.4 transformers-compat-0.4.0.3 unix-2.7.0.1 unix-compat-0.4.1.4 unordered-containers-0.2.5.1 vector-0.10.12.3 vector-algorithms-0.6.0.4 vector-binary-instances-0.2.1.0 vector-instances-3.3.0.1 void-0.7 word8-0.1.2 x509-1.5.1 x509-store-1.5.0 x509-system-1.5.0 x509-validation-1.5.2 yaml-0.8.11 zlib-0.5.4.2

I am currently stuck trying to figure out how to get the version for packages that came with ghc, e.g. template-haskell, base, etc. any idea? Currently I am using the SourceMap from Stack.Build.Source via loadSourceMap but they are not in there...

And on a related note, currently I am printing all dependencies, not only the direct ones (listed in build-depends, that's what you want, right?)

— Reply to this email directly or view it on GitHub https://github.com/commercialhaskell/stack/issues/638#issuecomment-124440307 .

markus1189 commented 9 years ago

Thanks @snoyberg, I guess Stack.Installed.getInstalled is what I need, I'll give that a go later

creichert commented 9 years ago

Cool! I like the --separator flag, what's the default?

So, you are listing the transient dependencies of a single package or all package installed for a given snapshot?

Either way, looks like a great first version.

On Fri, Jul 24 2015, Markus Hauck notifications@github.com wrote:

A first version is here: https://github.com/markus1189/stack/tree/638-list-dependencies. Example

$ stack list-dependencies --separator '-'
Cabal-1.18.1.5
MonadRandom-0.3.0.2
StateVar-1.1.0.0
adjunctions-4.2.1
aeson-0.8.0.2
ansi-terminal-0.6.2.1
ansi-wl-pprint-0.6.7.2
array-0.5.0.0
asn1-encoding-0.9.0
asn1-parse-0.9.1
asn1-types-0.3.0
async-2.0.2
attoparsec-0.12.1.6
auto-update-0.1.2.2
base-<unknown>
base16-bytestring-0.1.1.6
base64-bytestring-1.0.0.1
bifunctors-4.2.1
binary-0.7.1.0
blaze-builder-0.4.0.1
blaze-html-0.8.0.2
blaze-markup-0.7.0.2
byteable-0.1.1
bytestring-0.10.4.0
bytestring-builder-0.10.6.0.0
case-insensitive-1.2.0.4
cereal-0.4.1.1
chunked-data-0.1.0.1
cipher-aes-0.2.11
cipher-des-0.0.6
cipher-rc4-0.1.4
comonad-4.2.6
conduit-1.2.4.2
conduit-combinators-0.3.1
conduit-extra-1.1.9
connection-0.2.4
containers-0.5.5.1
contravariant-1.3.1.1
cookie-0.4.1.6
crypto-cipher-types-0.0.9
crypto-numbers-0.2.7
crypto-pubkey-0.2.8
crypto-pubkey-types-0.4.3
crypto-random-0.0.9
cryptohash-0.11.6
cryptohash-conduit-0.1.1
data-default-class-0.0.1
deepseq-1.3.0.2
deepseq-generics-0.1.1.2
directory-1.2.1.0
distributive-0.4.4
dlist-0.7.1.1
dlist-instances-0.1
either-4.3.4.1
enclosed-exceptions-1.0.1.1
exceptions-0.8.0.2
fast-logger-2.3.1
file-embed-0.0.8.2
filepath-1.3.0.2
free-4.11
fsnotify-0.1.0.3
ghc-prim-<unknown>
gitrev-1.0.0
hashable-1.2.3.3
hastache-0.6.1
hinotify-0.3.7
hourglass-0.2.9
http-client-0.4.15
http-client-tls-0.2.2
http-conduit-2.1.5.1
http-types-0.8.6
ieee754-0.7.6
integer-gmp-<unknown>
kan-extensions-4.2.2
keys-3.10.2
lifted-base-0.2.3.6
memory-0.7
mime-types-0.1.0.6
mmorph-1.0.4
monad-control-1.0.0.4
monad-logger-0.3.13.1
monad-loops-0.4.3
mono-traversable-0.9.2.1
mtl-2.1.3.1
mwc-random-0.13.3.2
nats-1
network-2.6.2.0
network-uri-2.6.0.3
old-locale-1.0.0.6
optparse-applicative-0.11.0.2
optparse-simple-0.0.3
parsec-3.1.9
path-0.5.2
path-pieces-0.2.0
pem-0.2.2
persistent-2.1.6
persistent-sqlite-2.1.4.2
persistent-template-2.1.3.4
pointed-4.2.0.2
prelude-extras-0.4
pretty-1.1.1.1
primitive-0.6
process-1.2.0.0
profunctors-4.4.1
project-template-0.2.0
random-1.1
resource-pool-0.2.3.2
resourcet-1.1.5
retry-0.6
safe-0.3.9
scientific-0.3.3.8
securemem-0.1.9
semigroupoids-4.3
semigroups-0.16.2.2
silently-1.2.4.1
socks-0.5.4
split-0.2.2
stack-0.1.2.1
stm-2.4.4
stm-chans-3.0.0.4
streaming-commons-0.1.12.1
syb-0.4.4
system-fileio-0.3.16.3
system-filepath-0.4.13.4
tagged-0.7.3
tar-0.4.1.0
template-haskell-<unknown>
temporary-1.2.0.3
text-1.2.0.6
time-1.4.2
tls-1.2.18
transformers-0.3.0.0
transformers-base-0.4.4
transformers-compat-0.4.0.3
unix-2.7.0.1
unix-compat-0.4.1.4
unordered-containers-0.2.5.1
vector-0.10.12.3
vector-algorithms-0.6.0.4
vector-binary-instances-0.2.1.0
vector-instances-3.3.0.1
void-0.7
word8-0.1.2
x509-1.5.1
x509-store-1.5.0
x509-system-1.5.0
x509-validation-1.5.2
yaml-0.8.11
zlib-0.5.4.2

I am currently stuck trying to figure out how to get the version for packages that came with ghc, e.g. template-haskell, base, etc. any idea? Currently I am using the SourceMap from Stack.Build.Source via loadSourceMap but they are not in there...

And on a related note, currently I am printing all dependencies, not only the direct ones (listed in build-depends, that's what you want, right?)


Reply to this email directly or view it on GitHub: https://github.com/commercialhaskell/stack/issues/638#issuecomment-124440307

markus1189 commented 9 years ago

Okay versions are properly resolved for installed packages now :), The upside of all the changes is that in theory we could now also display versions in stack dot, e.g. activated by an additional flag.

Cool! I like the --separator flag, what's the default?

the default is a simple space (like cabal list) that should be enough for shell purposes, if one really needs tabs, you can pass --separator "\t", that's the reasoning from my side.

So, you are listing the transient dependencies of a single package or all package installed for a given snapshot?

You mean transitive? Yeah it currently lists all transitive dependencies, would be good if you could check the output for missing things, because it differs a little from cabal list --simple-output --installed. (https://github.com/markus1189/stack/tree/638-list-dependencies)

bitemyapp commented 9 years ago

@markus1189 this looks awesome, thank you :) :+1:

markus1189 commented 9 years ago

Example for the differences (for the stack project): https://www.diffchecker.com/9qd1c5zq At least partly it is because stack list-dependencies does not yet respect test and benchmark deps, I'll look into that next

markus1189 commented 9 years ago

Getting this to work with test/benchmark dependencies is unexpectedly hard... It seems like loadSourceMap and loadLocals by default assume that they are not enabled. Once I changed that it seems like it somehow does not pickup the dependencies for test packages like QuickCheck when using withLoadPackage.

I am rather tempted to first leave it as is, i.e. without showing dependencies for test/benchmark and let it open for further enhancement.

markus1189 commented 9 years ago

Moved to #682.