Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

cabal update is not run? #203

Closed
ulysses4ever opened this issue Mar 13, 2023 · 8 comments
Closed

cabal update is not run? #203

ulysses4ever opened this issue Mar 13, 2023 · 8 comments
Labels
info needed More information needed from the reporter re: cabal On setting up cabal

Comments

@ulysses4ever
Copy link
Contributor

ulysses4ever commented Mar 13, 2023

Not sure if it is related to the recent events like

The reason may be that we first haskell/setup (which does cabal update, which for cabal-3.10 uses XDG directories for storing config, store, etc.) and then restore cache with the legacy directory structure (under ~/.cabal). This confuses cabal.

Workaround: do cache-restore before haskell/setup. maybe not: to restore, you need to know the path that we usually got as an output of the action. So, pending more investigation.

@andreasabel
Copy link
Member

It looks like cabal update did run: https://github.com/haskell/cabal/actions/runs/4400882899/jobs/7706599146#step:4:129
Not sure what the problem is, then. Maybe two cabals installed in different locations using different homes for storing the package index?
Can you maybe equip your workflow with extra debug printing, like which cabal and the like?

@andreasabel andreasabel added info needed More information needed from the reporter re: cabal On setting up cabal labels Mar 13, 2023
@ulysses4ever
Copy link
Contributor Author

Good idea, thank you: I'll try it. Meanwhile, Mikolaj speculated on IRC that it may be due to the XDG directory switch that cabal is making. Anyway, my experiments so far live here: haskell/cabal#8840

@Mikolaj
Copy link
Member

Mikolaj commented Mar 13, 2023

I copied the speculation here: #202 (comment)

@ulysses4ever
Copy link
Contributor Author

It looks like the suggestion to restore cached ~/.cabal before applying the haskell/setup action fixed it, so I'm closing it. Thanks all!

@Mikolaj
Copy link
Member

Mikolaj commented Mar 13, 2023

Just to be certain: is the safer order of cache restore (first) vs haskell/setup/cabal update (second) the default in CI scripts generated by haskell-ci? It seems so, but perhaps there are variations or perhaps I added the cache stanza myself in my scripts I'm looking at?

@andreasabel
Copy link
Member

@Mikolaj: Haskell CI currently does things in this order:

  1. Install cabal & ghc (via ghcup or apt).
  2. Write the ~/.cabal/config manually (not invoking cabal).
  3. cabal update.
  4. Restore ~/.cabal/store.

But then, it does not generate a CI for Windows, so might not be affected by the XDG.

I am not sure, but I thought that cabal update would only affect ~/.cabal/packages and thus be independent of ~/.cabal/store.
One would have to be more careful though if one cached the whole ~/.cabal, which I would not dare to do with my current superficial knowledge of the ~/.cabal directory structure.

@Mikolaj
Copy link
Member

Mikolaj commented Mar 14, 2023

This is good news. Creating ~/.cabal early turns on our XDG backward compat mode so there's no risk of mixing up the two locations of cabal index. Thank you.

@andreasabel
Copy link
Member

Right. Of course, ghcup might be doing something concerning the .cabal directories in step 1. there...

TravisCardwell added a commit to ExtremaIS/phatsort-haskell that referenced this issue Mar 16, 2023
It looks like we now need to call `cabal update` *after* restoring
cache.  See haskell/actions#203

We call `cabal update` in order to determine the cache key, so this
means that it is called twice.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info needed More information needed from the reporter re: cabal On setting up cabal
Projects
None yet
Development

No branches or pull requests

3 participants