Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Codex automagically picks stack as a Builder #86

Closed
hasufell opened this issue Oct 1, 2018 · 4 comments
Closed

Codex automagically picks stack as a Builder #86

hasufell opened this issue Oct 1, 2018 · 4 comments

Comments

@hasufell
Copy link

hasufell commented Oct 1, 2018

codex/codex/Main.hs

Lines 158 to 174 in 9ab9707

toBuilderConfig cx' = checkConfig cx' >>= \state -> case state of
TaggerNotFound -> fail' $ "codex: tagger not found."
Ready -> do
stackFileExists <- doesFileExist $ "." </> "stack.yaml"
if stackFileExists then do
(ec, _, _) <- readCreateProcessWithExitCode (shell "which stack") ""
case ec of
ExitSuccess -> do
let opts = stackOpts cx'
globalPath <- readStackPath opts "stack-root"
binPath <- readStackPath opts "bin-path"
path <- getEnv "PATH"
setEnv "PATH" $ concat [path, ":", binPath]
return (Stack opts, cx' { hackagePath = globalPath </> "indices" </> "Hackage" })
_ ->
return (Cabal, cx')
else return (Cabal, cx')

This shouldn't happen. Just because there is a stack file doesn't mean I actually want to use stack.

cydparser added a commit to cydparser/codex that referenced this issue Oct 28, 2018
hasufell pushed a commit to capital-match/codex that referenced this issue Oct 31, 2018
cydparser added a commit to cydparser/codex that referenced this issue Nov 2, 2018
cydparser added a commit to cydparser/codex that referenced this issue Nov 26, 2018
cydparser added a commit to cydparser/codex that referenced this issue Nov 30, 2018
parsonsmatt pushed a commit that referenced this issue Nov 30, 2018
@parsonsmatt
Copy link
Collaborator

Should be fixed by #87

@vyorkin
Copy link

vyorkin commented Mar 15, 2020

Another solution could be to have a CLI option / config parameter to manually specify the builder. Something like codex set builder stack/cabal.

The reason for this suggestion is that you might have a .stack-work dir even if you want to use cabal as a bulider for codex. For example, currently if I have a .stack-work folder I get the following warnings and errors (for some reason):

codex: *warning* the following tags files where missings during assembly:
/home/vyorkin/.stack/indices/Hackage/packages/Cabal/3.0.1.0/tags
/home/vyorkin/.stack/indices/Hackage/packages/base/4.13.0.0/tags
"Codec.Compression.Zlib: compressed data stream format error (incorrect header check)"

So I have to remove the .stack-work to force the cabal builder and the run the codex update command again.

In this particular case something like builder might be helpful. What do you think?

@parsonsmatt
Copy link
Collaborator

Patches welcome! I'd be happy to accept a CLI flag --build-tool [cabal|stack] that could override the default behavior.

It would appear that base-4.30.0.0 and Cabal-3.0.1.0 are not uploaded to Hackage. I don't know why.

Does using cabal as a build tool not have these errors/warnings?

(fwiw, you can just mv .stack-work .stack-work-x instead of the potentially costly deleting/rebuilding)

@vyorkin
Copy link

vyorkin commented Mar 15, 2020

Does using cabal as a build tool not have these errors/warnings?

Yeah, it works perfectly when I use cabal as a build tool.

Thanks @parsonsmatt! I'll try to submit a PR soon

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

No branches or pull requests

3 participants