haskell / haskell/cabal

v2-build --only-dependencies solver should never fail, if v2-build --dry doesn't.

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

Description

```
servant release-0.16 % cabal new-build --dry all | tail
- cookbook-generic-0.1 (exe:cookbook-using-custom-monad) (cannot read state cache)
- cookbook-db-sqlite-simple-0.1 (exe:cookbook-db-sqlite-simple) (cannot read state cache)
- cookbook-db-postgres-pool-0.1 (exe:cookbook-db-postgres-pool) (cannot read state cache)
- cookbook-curl-mock-0.1 (exe:cookbock-curl-mock) (cannot read state cache)
- cookbook-basic-streaming-2.1 (exe:cookbook-basic-streaming) (cannot read state cache)
- cookbook-basic-auth-0.1 (exe:cookbook-basic-auth) (cannot read state cache)
- tutorial-0.10 (test:spec) (cannot read state cache)
- cookbook-testing-0.0.1 (exe:cookbook-testing) (cannot read state cache)
- cookbook-pagination-2.1 (exe:cookbook-pagination) (cannot read state cache)
- cookbook-file-upload-0.1 (exe:cookbook-file-upload) (cannot read state cache)
```

```
servant release-0.16 % cabal new-build --dep all
cabal: Cannot select only the dependencies (as requested by the
'--only-dependencies' flag), the packages servant-0.16.1,
servant-foreign-0.15, servant-docs-0.11.3, servant-server-0.16.1 and
servant-client-0.16 are required by a dependency of one of the other targets.
```

Solver should pick as much as it can, there are dependencies to be built, even there are so called in-place packages (here: `tutorial` depends on `servant-js` which depends on `servant-js`)

---

More concretely, given there are four categories of packages in a plan

- **builtin** Lives in global (non-nix-style) package db
- **global** Lives in Nix-store cache
- **local** Local package
- **inplace** Local in-place package

I'd need a flag to build all packages which will end in the nix-store (which IMO we should rename to v2-build store: https://github.com/haskell/cabal/issues/6105, because nix-store is `/nix/store`). I think that `--only-dependencies` is close to that. To make more people happy, the `v2-build --only-dependencies` could also *download* inplace packages.

Given that, if you go on a flight, `v2-build --only-dependencies` will prepare you for an offline hacking session.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.