Command to build an sdist
At the moment it's not that easy to build a generated sdist. You can unpack it yourself and build it from there, but it would be nice to have a one-command way to do this.
This is useful to catch issues like missing extra-source-files, which seems to be quite common (and just bit me!).
I would be happy with:
-
cabal build <sdist path>, ideally working for any such cabal command, includinghaddock -
cabal sdist --build
Related:
- Stack has an option: https://docs.haskellstack.org/en/stable/sdist_command/#-no-test-tarball-flag
- A request to also run tests: https://github.com/haskell/cabal/issues/1141
- https://github.com/haskell/cabal/issues/5064
iirc you can install tarballs with cabal install path/to/package.tar.gz, is it not suitable for your workflow?
Discussed a bit on IRC, but I interpret cabal install as very side-effect-y, which is very much not what I want. I want to build it! And I might want to test it or haddock it also.
Note that the command line help says that you can do cabal build ./sdist.tgz but IIRC it does not work.
I'd also stay clear of cabal install.
Question: how do would you expect it to work? Should it be build like a local parkage? (Where is the build directory then?) or like a configured package (like extra-packages in cabal.project)?
I remembered but not quite correctly. https://github.com/haskell/cabal/issues/7328 talks about specifying a source directory not a source tarball.
Question: how do would you expect it to work? Should it be build like a local parkage? (Where is the build directory then?) or like a configured package (like extra-packages in cabal.project)?
IIRC, the idea would be to do what cabal install does, namely pretend it's a non-local package just like all the others involved in the build. No idea about ' configured package (like extra-packages in cabal.project)' vs what cabal install does.
I mean like a named package can be listed in extra-packages in cabal.project, this makes it a non-local package. Notice you can use package: ../path/to/sdist but that becomes a local package. TBH I haven't looked into CmdInstall.hs enough to know what it does :)
@jneira wrote:
iirc you can install tarballs with
cabal install path/to/package.tar.gz, is it not suitable for your workflow?
You cannot with v2-install, at least in 2025.