Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflict between /home/runner/.cabal and /home/runner/.config/cabal/config #108

Open
tych0 opened this issue Jan 5, 2025 · 1 comment
Open

Comments

@tych0
Copy link

tych0 commented Jan 5, 2025

Hi, I am seeing failures like:

2025-01-02T20:34:19.0988675Z flock xcffib.cabal cabal --config-file=./cabal.config new-run --minimize-conflict-set -j4 exe:xcffibgen -- --input ./proto/src --output ./xcffib
2025-01-02T20:34:19.1249266Z Warning: Both /home/runner/.cabal and /home/runner/.config/cabal/config exist
2025-01-02T20:34:19.1249706Z - ignoring the former.
2025-01-02T20:34:19.1250062Z It is advisable to remove one of them. In that case, we will use the remaining
2025-01-02T20:34:19.1250489Z one by default (unless '$CABAL_DIR' is explicitly set).
2025-01-02T20:34:19.6802799Z Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
2025-01-02T20:34:19.6803760Z update' to download it.
2025-01-02T20:34:19.6951914Z Resolving dependencies...
2025-01-02T20:34:19.6958135Z Error: [Cabal-7107]
2025-01-02T20:34:19.6958565Z Could not resolve dependencies:
2025-01-02T20:34:19.6959032Z [__0] trying: xcffib-1.6.0 (user goal)
2025-01-02T20:34:19.6959619Z [__1] unknown package: optparse-applicative (dependency of xcffib)
2025-01-02T20:34:19.6960341Z [__1] fail (backjumping, conflict set: optparse-applicative, xcffib)
2025-01-02T20:34:19.6961443Z After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: xcffib, optparse-applicative

but only sometimes, and only when the warning about /home/runner/.cabal and /home/runner/.config/cabal/config is printed.

Seems like the action sets up one of these directories and updates the hackage cache there, butthat only causes problems in some cases? Unclear exactly what's going on to me.

Full actions run here:

https://github.com/tych0/xcffib/actions/runs/12613197315/job/35150752203

@andreasabel
Copy link
Member

We have a workaround to switch off XDG for cabal which might not work anymore or not reliably:

if (opts.cabal.enable)
await core.group('Setting up cabal', async () => {
// Andreas, 2023-03-16, issue #210.
// Create .cabal/bin to activate non-XDG mode of cabal.
if (process.platform !== 'win32')
io.mkdirP(`${process.env.HOME}/.cabal/bin`);
// Create config only if it doesn't exist.
await exec('cabal', ['user-config', 'init'], {
silent: true,
ignoreReturnCode: true
});
// Set the 'store-dir' in the cabal configuration.
// Blindly appending is fine.
// Cabal merges these and picks the last defined option.
const configFile = await cabalConfig();
const storeDir =
process.platform === 'win32'
? 'C:\\sr'
: `${process.env.HOME}/.cabal/store`;
fs.appendFileSync(configFile, `store-dir: ${storeDir}${EOL}`);
core.setOutput('cabal-store', storeDir);

Original issue:

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants