How to always get latest version on hackage for selected packages

16 views
Skip to first unread message

John Ky

unread,
Oct 23, 2016, 6:47:09 AM10/23/16
to haskell-stack
Hello,

I'm interesting in configuring my stack.yaml such that for a specific few packages the latest version on hackage is resolvable.

Is this possible?

Cheers,

-John

Adam Bergmark

unread,
Oct 23, 2016, 7:06:55 AM10/23/16
to John Ky, haskell-stack
Hi John,

I think the simplest way to do this is something like this in your project directory:

$ rm -f stack.yaml
$ stack unpack package-1 package-2
$ stack init

You can use `--resolver ghc-8' to stack init to use the Cabal solver instead of using a stackage snapshot but this will take version constraints declared in cabal files into account.

A way to check if there are newer versions available is `cabal install my-package --dry-run | grep latest`

HTH,
Adam


--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/b685da1f-a83b-48c9-a57a-f7edc5249582%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Ky

unread,
Oct 24, 2016, 5:48:50 AM10/24/16
to Adam Bergmark, haskell-stack

Hi Adam,

I was able to get what I need using your information.  Thanks so much for your help!

#!/usr/bin/env bash

cabal update

mkdir -p deps

_project="$(echo *.cabal | cut -d '.' -f 1)"

pushd deps > /dev/null

cp ../$_project.cabal ./

projects() {
  cabal install $_project --dry-run | grep hw- | grep -v "^${_project}-[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$"
}

for x in $(projects); do
  stack unpack $x
done

rm ./$_project.cabal

popd > /dev/null

Cheers,

-John

Reply all
Reply to author
Forward
0 new messages