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

Feature request: A togglable version of data-files #7260

Open
hololeap opened this issue Jan 27, 2021 · 6 comments
Open

Feature request: A togglable version of data-files #7260

hololeap opened this issue Jan 27, 2021 · 6 comments

Comments

@hololeap
Copy link

I'm working on packaging a cabal project which includes quite a few example files which are packaged using data-files. I would like to make these files optional instead of being installed by cabal no matter what: tweag/ormolu#682

I understand that data-files is generally used for files which are needed after installation, and so having the ability to toggle them with a flag doesn't make much sense. However, a different version of data-files with the ability to toggle their installation with a flag would be a nice feature.

Of course, if something with the same functionality already exists, please let me know, but I asked around in #haskell and nobody seemed to know of any such feature.

@fgaz
Copy link
Member

fgaz commented Jan 27, 2021

Sounds like extra-doc-files is what you want, since examples could be considered part of the documentation, and docs are toggleable. Otherwise the usual solution is to split the package or just to offer the examples as a separate download

@phadej
Copy link
Collaborator

phadej commented Jan 27, 2021

extra-doc-files is a bad idea. That field should been named extra-haddock-files.

What @hololeap is looking for is extra-source-files, which means that they are added to source distributions, i.e. sdist. But they are not installed.

@fgaz
Copy link
Member

fgaz commented Jan 27, 2021

The installation of those can't be toggled though, can it?

@hololeap
Copy link
Author

I should also add that I am trying to package ormolu for Gentoo, which uses Setup.hs for configure, build, and install (with sandboxing and other features of course.) I'm looking for something that can be toggled like so: setup configure --flag=examples, or perhaps a different option that can turn the installation of these files on and off.

@phadej
Copy link
Collaborator

phadej commented Jan 28, 2021

I don't see a strong motivation here.

If you are anyway packaging for a distribution (Gentoo in this case), surely you can install example files in a way the distribution packaging works anyway. In fact,

I think it's not optimal that example files are in source distributions uploaded to Hackage. I'm very confident that no-one will look for them there, and using Hackage as a middle-step for executable distribution is not clear.

It is convenient that you can

cabal install ormolu

yet, I doubt users will ever look at the example files somewhere in ~/.cabal/store, if ormolu-the-executable doesn't somehow provide them (maybe using data-files indeed).

Is that a goal?

Otherwise, if you want to install something into /usr/share/ormolu, then use your linux distribution packager facilities. IMO.

@hololeap
Copy link
Author

The maintainer of ormolu wants to keep the (~700) example files in data-files and doesn't want to split them to an ormolu-examples package. My current solution is to patch the cabal file to remove the data-files, or leave it alone if the user has the examples flag in Gentoo set. I was looking for some way to toggle these files through cabal during setup configure instead of patching or removing them after setup install.

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

3 participants