9

Over time I've developed a messy system level Haskell installation that I'm not sure how to completely clean up. But for the most part this isn't of much concern as I simply use stack to manage per-project Haskell configurations. However as my project requirements diverge from my system Haskell setup, I wonder what the best way is to build and upload packages for Hackage.

Specifically (1) should I be using

stack exec -- cabal sdist
stack exec -- cabal upload

instead of simply

cabal sdist
cabal upload

and (2) should is there any reason to install a project version of cabal (with stack build cabal?)

Or is there some better stack-based approach to building and distributing to Hackage that doesn't involve invoking cabal directly?

Community
  • 1
  • 1
orome
  • 45,163
  • 57
  • 202
  • 418
  • There is `stack sdist` and `stack upload` which I believe should work without invoking `cabal` directly. – ppb Dec 28 '16 at 20:25
  • It seems like `stack upload .` isn't seeing the credentials that `cabal upload` sees (I'm asked for my name, etc.). Any idea how to set those so I'm not asked each time? – orome Dec 28 '16 at 20:35
  • From what I'm seeing it should save them automatically under '~/.stack/upload/credentials.json' ([in world-readable plain text](https://github.com/commercialhaskell/stack/issues/2159)) after first upload. – ppb Dec 28 '16 at 20:50
  • @ppb: That seems to work, but after confirming that upload was successful I get "Environment variable GPG_TTY is not set (see man gpg-agent)" and "Unable to find gpg2 or gpg executable". [Any idea what's happening there?](http://stackoverflow.com/q/41415900/656912) – orome Jan 01 '17 at 13:43
  • @ppb: I think `stack sdist` and `stack upload` constitute an answer. – orome Jan 02 '17 at 13:24

1 Answers1

10

Adding an answer based on my earlier comment.


stack offers equivalent functionality via its
  • stack sdist
  • stack upload

commands, which don't require interfacing with cabal directly in stack-based projects.

A full list of commands supported by stack can be obtained via:

$ stack --help

and the official documentation.

Individual commands also support --help to see what command line flags they support.

ppb
  • 905
  • 6
  • 9