commercialhaskell / commercialhaskell/stack
Flag to refresh lockfile for specific dependency
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
Suppose I'm using `packageB`, which depends on `packageA`, and in my extra-deps I have
- packageA-1.0.0
- packageB-1.0.0
Additionally, my stack.yaml.lock locks `packageB` at revision 1, which has a version bound `packageA < 1.1.0`.
Now I update to `packageA-1.1.0`. I check hackage, and there's no new version of `packageB`, but there is a revision 2, that loosens the bounds. How do I update to that revision?
One way is to replace the `packageB` dep with `packageB-1.0.0@rev:2`. Maybe this is what we're expected to do? But in practice I feel like I've basically never seen an `@rev` in a stack.yaml file. If I did see one, I'd assume it was because there was a more-recent revision that was explicitly being excluded for some reason. So I'm reluctant to do that.
Another way is to delete the stack.yaml.lock file and rebuild. A new one gets generated that'll have the most recent revision of `packageB`. But that also potentially updates a load of other revisions, which I might not want.
A third way is to replace the `packageB` dep, rebuild, and then put it *back* to `package-1.0.0` as it is currently and rebuild again. (I don't think the intermediate rebuild needs to succeed, but I guess it needs to construct a build plan.) This updates just the `packageB` revision in the lockfile, and in terms of results it's the option I like the most.
But it's also not at all obvious. So it might be good to have a flag like `stack build --refresh-lockfile=packageB`, that would use the latest revision regardless of what's in the lockfile, and then lock that revision for future runs.
Combined with #5969, it might be helpful to offer a suggestion to use this flag, when a build fails because `packageA`'s version isn't supported by the current revision of `packageB`, but it is by a more recent revision.
Contributor guide
Assessment
This issue has not been assessed yet.