[ghc] fix dependencies

Remove allow-newer:*, allow-older:* in cabal.project file and instead
list these explicitly. This is a big step for managing dependencies.
parent f10826f5
Pipeline #6627 failed with stages
in 13 minutes and 53 seconds
......@@ -121,6 +121,54 @@ From inside a Nix shell:
n$ cabal run gargantext-server -- --toml gargantext-settings.toml --run Prod
```
#### Upgrading haskell packages
We use `gargantext.cabal`, `cabal.project` and `cabal.project.freeze`
as the source of truth. Ouf ot that, we generate the `stack.yaml` file
for those who prefer to use Stack.
Upgrading packages can be a pain sometimes, with cabal.
Here are some tips:
- Manually remove entries from your `cabal.project.freeze` to make the
build a bit more "elastic";
- Lock the hackage-index state in the `cabal.project`, so that the
solver won't try to pull newer dependencies;
- Specify constraints you want directly when building like `cabal
v2-build --constraint tasty==x.y.z.w`
- Generate another `.freeze` with `cabal v2-freeze` once you got the
new build to compile (this is good for small, incremental upgrades)
- Bounds in `.cabal` are definitely respected, but ofc the `.freeze`
takes priority, so you want to maybe use `cabal gen-bounds` when
your `.freeze` still exists, remove the file, try again.
Also, it's helpful to build with `stack build` from time to time. The
warnings are displayed, whenever a different stack lts package is used
than the one defined in `.cabal` file - it's an incentive to upgrade
the `.cabal` file versions.
Occasionally, you can get issues with the `allow-newer: *` constraint
from `cabal.project`. E.g. when I was building with GHC 9.4.7, I had
errors with `hashable-1.5.0`. The solution is:
```shell
cabal v2-build --constraint hashable==1.4.3.0
```
(we don't depend on `hashable` directly, but `allow-newer: *` is so
liberal that a package that is too new is used).
Overall, it's preferred to specify strict constraints in
`gargantext.cabal` file and to do that, one can use `stack ls dependencies`
to have an idea what works.
If you want to see the detailed build info for a given dependency:
```shell
cabal v2-build -v servant-server
```
Also, here is a relevant discussion:
https://discourse.haskell.org/t/whats-your-workflow-to-update-cabal-dependencies/9475
### Initializing and running
#### Start containers for database and NLP software bricks
......
......@@ -18,12 +18,13 @@ fi
# with the `sha256sum` result calculated on the `cabal.project` and
# `cabal.project.freeze`. This ensures the files stay deterministic so that CI
# cache can kick in.
expected_cabal_project_hash="e3b7610fda785be9d103e0c6b22ecfa777f0e156fdf7563100672a65d5cca097"
expected_cabal_project_freeze_hash="c6b5f3024cbd47a1290ffb90b7785c06c60aec7d5fa47b98787c8d0a3d8d10e6"
expected_cabal_project_hash="641c87fb990ef95f861805e11c76663f075516af845c5dab458bf82b3ba5fd7d"
expected_cabal_project_freeze_hash="6ca9d2c298827a05d873e30aaac5db3cf6648c7ca9118f13f1b109c13479f38b"
cabal --store-dir=$STORE_DIR v2-build --dry-run
cabal2stack --system-ghc --allow-newer --resolver lts-21.17 --resolver-file devops/stack/lts-21.17.yaml -o stack.yaml
# cabal2stack --system-ghc --allow-newer --resolver lts-21.17 --resolver-file devops/stack/lts-21.17.yaml -o stack.yaml
cabal2stack --system-ghc --resolver lts-21.17 --resolver-file devops/stack/lts-21.17.yaml -o stack.yaml
cabal --store-dir=$STORE_DIR v2-freeze
# Run 'sed' to remove the constraint for 'gargantext', as it doesn't make sense and
......
-- Generated by stack2cabal
index-state: 2023-12-10T10:34:46Z
-- index-state: 2023-12-10T10:34:46Z
index-state: 2024-09-12T03:02:26Z
with-compiler: ghc-9.4.7
optimization: 2
......@@ -63,7 +64,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/chessai/eigen.git
tag: 8fff32a43df743c8c83428a86dd566a0936a4fba
tag: 1790fdf9138970dde0dbabf8b270698145a4a88c
-- tag: 8fff32a43df743c8c83428a86dd566a0936a4fba
source-repository-package
type: git
......@@ -197,8 +199,52 @@ source-repository-package
tag: 02f5ed9ee2d6cce45161addf945b88bc6adf9059
allow-older: *
allow-newer: *
-- allow-older: *
-- allow-newer: *
allow-newer:
accelerate-arithmetic:accelerate
, MissingH:base
, accelerate-utility:accelerate
, base:*
, crawlerHAL:servant
, crawlerISTEX:servant
, crawlerPubMed:servant
, crawlerPubMed:servant-client-core
, epo-api-client:base
, epo-api-client:aeson
, epo-api-client:servant
, epo-api-client:text
, iso639:aeson
, iso639:text
, morpheus-graphql-app:text
, morpheus-graphql-client:text
, morpheus-graphql-code-gen-utils:text
, morpheus-graphql-code-gen:text
, morpheus-graphql-core:text
, morpheus-graphql-server:text
, morpheus-graphql-subscriptions:text
, morpheus-graphql:text
, openalex:servant
, openalex:servant-client-core
, openalex:time
, servant-client:servant
, servant-client:servant-client-core
, servant-ekg:base
, servant-ekg:hashable
, servant-ekg:servant
, servant-ekg:text
, servant-ekg:time
, servant-xml-conduit:base
, servant-xml-conduit:bytestring
, servant-xml-conduit:servant
, stemmer:base
allow-older: aeson:hashable
, crawlerHAL:servant-client
, epo-api-client:http-client-tls
, haskell-throttle:time
, hsparql:rdf4h
, openalex:http-client-tls
, openalex:vector
package gargantext
ghc-options: -fwrite-ide-info -hiedir=".stack-work/hiedb"
......
This diff is collapsed.
This diff is collapsed.
"allow-newer": true
#"allow-newer": true
"extra-deps":
- "HSvm-0.1.1.3.22"
- "KMP-0.2.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment