haskell / haskell/cabal

cabal check should warn about `hs-source-dir` that will be not included in sdist tarball

Open
#7,320 0 comments 0 reactions 0 assignees View on GitHub
cabal-install: cmd/check type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
* `cabal check` does not check if a dir listed in `hs-source-dir` will not be included in the tarball by `cabal sdist`, cause the component does not use any module within that source dir
* `cabal upload` then fail cause the `hs-source-file` is not included in the tarball

```
PS D:\hls> cabal upload .\dist-newstyle\sdist\haskell-language-server-1.0.0.0.tar.gz -u user-p pass
Uploading .\dist-newstyle\sdist\haskell-language-server-1.0.0.0.tar.gz...
Error uploading .\dist-newstyle\sdist\haskell-language-server-1.0.0.0.tar.gz:
http code 400
Error: Invalid package

'hs-source-dirs: plugins/hls-tactics-plugin/src' directory does not exist.
```

**To Reproduce**
Steps to reproduce the behavior:

* checkout haskell-language-server repo at 9cab320f258139f801e4a8081a3c05d448c6a33b
* run `cabal check` and observe there is no warnings
* run `cabal sdist`
* observe the tarball does not include `plugins/hls-tactics-plugin/src` but its `haskell-language-server.cabal` include it in the `hs-source-dir` of the `functional-test`component
* so the package will be rejected by hackage

**Expected behavior**

`cabal check` should warn about that, noting the package will be rejected by hackage, like other similar problems

**System information**
- `cabal-3.4.0.0`

Contributor guide

Open the contributing guide

Research direction

Start with the `cabal check` and `cabal sdist` entry points, using the reproduction's `haskell-language-server.cabal` functional-test component and `hs-source-dir` as the case to trace. Add coverage for a source directory omitted from the sdist and verify that `cabal check` reports the issue before upload would be rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.