You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just scanned hackage index trying to find what other packages are affected. As it turns out, at the moment 15 out of 9069 packages have max deprecated-versions >= max non-deprecated-versions. In other words, stack unpacking any of those 15 packages would download a deprecated version:
I hope it will be useful for anyone who decides to fix this bug (at least for testing).
I initially wanted to fix it myself, but it seems that it is not that trivial. We need to either make a request to Hackage API each time a user runs stack unpack, or enrich the package index with information about package deprecations in order to have it at our disposal at runtime. Currently package index just don't have this info. As far as I understand, package index is created by another tool (not stack), so maybe another issue should be created in that tool's Github repo as well.
Hmm, it's surprising to me that stack unpack would unpack the latest version rather than the snapshot version. Maybe that's a good way to fix this? Granted, that doesn't help for the packages that aren't in the snapshot / when you're using a compiler resolver.
Yeah, I could go either way on this. Not really clear to me whether it's preferable to use the latest version or the snapshot version, so I'd tend toward staying with the current behaviour unless there's a compelling reason to change it (and I'm not sure that this issue qualifies as compelling enough).
I just confirmed that the package index in ~/.stack/indices/Hackage/00-index.tar does include the preferred-versions file (e.g., in stack/preferred-versions), and so does the all-cabal-hashes repo ((e.g., stack's preferred-versions).
hmm there are a couple ways mentioned above to approach this
Z. query hackage api each time
all the information needed should already be present so I'm not to fond of this, but it is def the simplest
S Z. extend package-cache map to contain this information
Currently a package-cache is keyed by package-indentifier, but preferred-versions applies to the whole package. Perhaps something like this? - not too familiar if this will cause significant performance regression
Just playing with the stack --stack-yaml some/stack.yaml unpack some-package
It looks like it ignores the version specified inside the .yaml (in my case in the packages section) and it just takes some random one, possibly, latest.
@tolysz Good point. The case of unpacking a local package (in particular, location: git) makes me think that stack unpack should default to unpacking the version specified by the stack.yaml. Then we can add a stack unpack --latest command to get the current behavior.
I'm thinking it's fine to change the meaning of stack unpack, since I doubt it gets much use in scripts. It'd probably be good to have the command output clearly state when it's not unpacking the latest version, though, incase folks still expect that.
For ghcjs/ghcjs#442@luigy had the excellent idea of using stack unpack as an initial step to leverage Stack in the boot process. For us to do that however, this needs to be fixed. Any pointers on where to begin?
Since stack.yaml doesn't make one list which cabal files are in which locations, I think the code I listed does some searching. To be fair I'm fine with any sort of default, but I hope everyone would agree that there should be at least an option to unpack the version stack would build in practice.
@luigy if you want to take it it would be very much appreciated. All this GHCJS is some serious yack-shaving on my capstone project for school I'm worried I should soon be getting back too. :)
(CC @RyanGlScott, @vollmerm)
We just came across the stack unpack behavior and were surprised that it was ignoring our stack.yaml.
Likewise, we expected to be able to pass --resolver=lts-5.13 to force it, as most of the stack commands we use respect --resolver. But that wasn't an option.
Reading this issue it sounds like there's some consensus around giving stack the ability to unpack stack-dictated package versions.
One thing to note that that PR doesn't do is to also consider extra-deps. Hopefully with the implementation of #1265 there will be a straightforward way to implement a query of "What is the package version specified by a given stack.yaml configuration"
Activity
DNNX commentedon Nov 22, 2015
I just scanned hackage index trying to find what other packages are affected. As it turns out, at the moment 15 out of 9069 packages have
max deprecated-versions >= max non-deprecated-versions. In other words,stack unpacking any of those 15 packages would download a deprecated version:I hope it will be useful for anyone who decides to fix this bug (at least for testing).
I initially wanted to fix it myself, but it seems that it is not that trivial. We need to either make a request to Hackage API each time a user runs
stack unpack, or enrich the package index with information about package deprecations in order to have it at our disposal at runtime. Currently package index just don't have this info. As far as I understand, package index is created by another tool (not stack), so maybe another issue should be created in that tool's Github repo as well.mgsloan commentedon Nov 22, 2015
Hmm, it's surprising to me that
stack unpackwould unpack the latest version rather than the snapshot version. Maybe that's a good way to fix this? Granted, that doesn't help for the packages that aren't in the snapshot / when you're using a compiler resolver.borsboom commentedon Nov 22, 2015
Yeah, I could go either way on this. Not really clear to me whether it's preferable to use the latest version or the snapshot version, so I'd tend toward staying with the current behaviour unless there's a compelling reason to change it (and I'm not sure that this issue qualifies as compelling enough).
I just confirmed that the package index in
~/.stack/indices/Hackage/00-index.tardoes include the preferred-versions file (e.g., instack/preferred-versions), and so does the all-cabal-hashes repo ((e.g., stack's preferred-versions).luigy commentedon Dec 8, 2015
hmm there are a couple ways mentioned above to approach this
Z. query hackage api each time
all the information needed should already be present so I'm not to fond of this, but it is def the simplest
S Z. extend package-cache map to contain this information
Currently a package-cache is keyed by package-indentifier, but preferred-versions applies to the whole package. Perhaps something like this? - not too familiar if this will cause significant performance regression
also from skimming the code looks like a change like this will rebuild cache correctly once users upgrade
and maybe have a flag to support @mgsloan comment on fetching it using the snapshot?
tolysz commentedon Dec 10, 2015
Just playing with the
stack --stack-yaml some/stack.yaml unpack some-packageIt looks like it ignores the version specified inside the
.yaml(in my case in thepackagessection) and it just takes some random one, possibly, latest.mgsloan commentedon Dec 11, 2015
@tolysz Good point. The case of unpacking a local package (in particular,
location: git) makes me think thatstack unpackshould default to unpacking the version specified by the stack.yaml. Then we can add astack unpack --latestcommand to get the current behavior.I'm thinking it's fine to change the meaning of
stack unpack, since I doubt it gets much use in scripts. It'd probably be good to have the command output clearly state when it's not unpacking the latest version, though, incase folks still expect that.tolysz commentedon Dec 11, 2015
Or even
stack unpack --hackage...mgsloan commentedon Dec 12, 2015
I prefer
--latestover--hackage, because all the packages come from hackage.Ericson2314 commentedon Feb 23, 2016
Not if
stack.yamlspecifies otherwise.Ericson2314 commentedon Feb 23, 2016
For ghcjs/ghcjs#442 @luigy had the excellent idea of using
stack unpackas an initial step to leverage Stack in the boot process. For us to do that however, this needs to be fixed. Any pointers on where to begin?6 remaining items
Ericson2314 commentedon Feb 24, 2016
Since
stack.yamldoesn't make one list which cabal files are in which locations, I think the code I listed does some searching. To be fair I'm fine with any sort of default, but I hope everyone would agree that there should be at least an option to unpack the version stack would build in practice.Ericson2314 commentedon Feb 24, 2016
@luigy if you want to take it it would be very much appreciated. All this GHCJS is some serious yack-shaving on my capstone project for school I'm worried I should soon be getting back too. :)
mgsloan commentedon Feb 24, 2016
I'd be open to adding some code to stack for the purpose of supporting ghcjs-boot's usecase, ideally remaining as generic as possible.
[rfc] first pass at commercialhaskell#1391
rrnewton commentedon Apr 18, 2016
(CC @RyanGlScott, @vollmerm)
We just came across the stack unpack behavior and were surprised that it was ignoring our stack.yaml.
Likewise, we expected to be able to pass
--resolver=lts-5.13to force it, as most of the stack commands we use respect--resolver. But that wasn't an option.Reading this issue it sounds like there's some consensus around giving stack the ability to unpack stack-dictated package versions.
mgsloan commentedon Apr 18, 2016
Agreed that we really should make this change. Hopefully we can get #1858 finished up for this release.
tolysz commentedon Aug 28, 2016
Ideally, we would need to get the latest revision of
.cabalfor a given version.mgsloan commentedon Sep 26, 2016
We don't want to use the latest revisions, because that can make stack builds non reproducible.
mgsloan commentedon Oct 24, 2016
NOTE: Existing work
The PR for this has languished for a long time, so I've closed it - https://github.com/commercialhaskell/stack/pull/1839/files . Future efforts should use this as reference, as a lot of work already got done by @luigy here.
One thing to note that that PR doesn't do is to also consider extra-deps. Hopefully with the implementation of #1265 there will be a straightforward way to implement a query of "What is the package version specified by a given stack.yaml configuration"
snoyberg commentedon Mar 20, 2019
This has already been fixed in Stack, closing.