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

[BUG] Cabal.extra-source-files lists many non-existing cbits files #543

Closed
amigalemming opened this issue Apr 20, 2024 · 5 comments
Closed

Comments

@amigalemming
Copy link

Description

The directory cbits/tracy is empty, but Cabal.extra-source-files lists many subdirectories and cpp and hpp files.

Steps to reproduce

accelerate-git$ cabal sdist
cabal: sdist of accelerate-1.3.0.0: filepath wildcard
'cbits/tracy/public/*.cpp' refers to the directory 'cbits/tracy/public', which
does not exist or is not a directory.
filepath wildcard 'cbits/tracy/public/*.cpp' does not match any files.

Your environment

  • Accelerate: GIT-HEAD, currently 5ceb2da
@tomsmeding
Copy link
Member

If I recall correctly, the situation here is that those files do exist if the tracy submodule is cloned, which happens if the -fdebug flag is set. And in this case, the C files are actually needed. However, cabal does not allow putting a flag conditional around extra-source-files (perhaps for good reason), so we're in a catch.

What do you need an sdist for?

@amigalemming
Copy link
Author

amigalemming commented Apr 20, 2024

Aha, it seems I must pull a submodule.

Ok, my original problem is, I want to fetch accelerate/GIT-HEAD in a cabal.project.local:

source-repository-package
   type: git
   location: https://github.com/AccelerateHS/accelerate/
   tag: 5ceb2da5d9ddc4ea0a5705d46bf4de9321ba17da

and this fails because of the missing submodule. I must Cabal teach somehow to also pull that submodule.

When I build this project, Cabal fetches the Git repository and then seems to package that working copy with cabal sdist.

@tomsmeding
Copy link
Member

I see! If this is all you need, then the answer is:

source-repository-package
    ...
    post-checkout-command: bash -c "git submodule update --init --recursive"

for cabal >= 3.8. For cabal < 3.8, you'll need to put ! before git, because it had a bug where it thought a unix status code of 1 meant "true".

@amigalemming
Copy link
Author

Perfect, this solves my problem!

@tomsmeding
Copy link
Member

tomsmeding commented Apr 20, 2024

Thanks for asking, now there is something that people can find when searching for the error message :)

EDIT: for future visitors: if you have a good idea how to manage this extra-source-files field where the contents depends on whether a cabal flag is enabled, please let us know. For the time being, this is what it is.

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