commercialhaskell / commercialhaskell/stack
custom snapshots in 2.3.1 ingore git location if hackage package exists
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary/comments (optional)
Using custom snapshot.yaml resolver does not appear to be working properly if git locations are specified for a newer version
of a hackage project.
(I have tested this with a checked-in cabal files as well, so this does not seem to be related to https://github.com/commercialhaskell/stack/issues/5210 ).
This appears to be a regression
See https://github.com/commercialhaskell/stack/issues/3714
Things work fine if specified project was never uploaded to hackage.
### Steps to reproduce
I have create a test project to demonstrate this.
1. clone https://github.com/juris-futura/test-stack-snapshot
2. run `stack build` (will fail suggesting to add typed-encoding-0.4.2.0 to stack.yaml even though the snapshot has git hash
with package.yaml pointing to 0.4.9.0
3. `STACK_YAML=stack-works.yaml stack build` will work just fine - this replays the same configuration directly in stack-works.yaml
4. reverting to stack v1.9.3 will also work.
Alternatively
1. Fork a project that has been uploaded to hackage.
2. Create a branch with newer version in package.yaml and push it to github
3. Use that project as your dependency. Specify this dep in some custom snapshot (`resolver=mysnapshot.yaml`) and specify your git commit hash in that snapshot.
Similar steps have been listed in old https://github.com/commercialhaskell/stack/issues/3714
see DanBurton commented on Jan 5, 2018 with unordered containers.
### Expected
Dependency will be picked up from the custom snapshot
### Actual
Stack ignores snapshot dependency and suggest adding the wrong dependency found in hackage.
Example output
```
$ stack build
Cloning 9078a21d2d0ac745aa48a8d065e1dc4c0369ff45 from git@github.com:rpeszek/dag-check
Cloning e938fcb63f5f18bf1dda5e5aad0ac0be660b18d1 from git@github.com:rpeszek/typed-encoding
DEPRECATED: The package at Repo from git@github.com:rpeszek/typed-encoding, commit e938fcb63f5f18bf1dda5e5aad0ac0be660b18d1 does not include a cabal file.
Instead, it includes an hpack package.yaml file for generating a cabal file.
This usage is deprecated; please see https://github.com/commercialhaskell/stack/issues/5210.
Support for this workflow will be removed in the future.
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for test-stack-snapshot-0.1.0.0:
typed-encoding needed, but the stack configuration has no specified version (latest matching version is 0.4.2.0)
needed since test-stack-snapshot is a build target.
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps in /.../test-stack-snapshot/stack.yaml:
- typed-encoding-0.4.2.0@sha256:8b92de5f695ccf295990365e9f46bd2d904ec15e1c9c3e0578e4eb56b1ee27ff,5217
Plan construction failed.
```
### Stack version
```
$ stack --version
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
```
### Method of installation
* `curl -sSL https://get.haskellstack.org/ | sh`
(with possibly `stack upgrade`)
Contributor guide
Assessment
This issue has not been assessed yet.