Skip to content

cabal sdist concatenates main-is #3313

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

Open
hvr opened this issue Apr 11, 2016 · 4 comments
Open

cabal sdist concatenates main-is #3313

hvr opened this issue Apr 11, 2016 · 4 comments

Comments

@hvr
Copy link
Member

hvr commented Apr 11, 2016

consider the fragment

  if impl(ghcjs)
    main-is:           JSMain.hs
  else
    main-is:           Main.hs

With cabal 1.24 this causes cabal sdist to fail with

Building source dist for foo-0.1.0.0...
cabal: JSMain.hsMain.hs doesn't exist

@dcoutts says

this is a bug in the sdist code, it's using flattenPackageDescription to get both sides of all conditionals to find all files but that doesn't work for main-is apparently

/cc @ezyang

@23Skidoo
Copy link
Member

The culprit is likely the Monoid instance for Executable, which is basically modulePath a <> modulePath b.

@hvr
Copy link
Member Author

hvr commented Apr 11, 2016

@23Skidoo yeah, but there's no simple fix it seems other than using a Last or First monoid instead, which would likely result in a similar effect to #3314 (i.e. an incomplete src-tarball)

@23Skidoo
Copy link
Member

An easy fix would probably be to make it a list, and then fail at use sites if the list contains more than one element.

@dcoutts
Copy link
Contributor

dcoutts commented Apr 11, 2016

I think it may be better to do a dedicated traversal. We need two versions of this anyway, one to get all files under all/any configuration (for sdist) and another to find the files under a specific configuration (for build file monitoring).

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

No branches or pull requests

5 participants