Data-Files cabal directive should support directories #713

Closed
bos opened this Issue May 24, 2012 · 10 comments

Comments

Projects
None yet
7 participants
@bos
Contributor

bos commented May 24, 2012

(Imported from Trac #722, reported by cygnus on 2010-08-02)

It should be possible to use the Data-Files directive to include whole directories (recursively) in source distributions. In many cases it's impossible or cumbersome to list all of the files one would like to install, and it seems to me that nobody should have to do that if what they really mean is, "install everything in that-data-dir/."

In implementation terms, this doesn't strike me as too tricky; after the wildcard parsing that already happens, detect whether the files to be copied are in fact directories and copy them recursively as such.

I'm more than willing to hack on this.

@bos

This comment has been minimized.

Show comment
Hide comment
@bos

bos May 24, 2012

Contributor

(Imported comment by @dcoutts on 2010-08-02)

I think we should discuss this with users a bit first. The point of the existing rather limited support for globbing is to avoid accidentally picking up more files than was intended (e.g. hidden or generated files). By limiting it to files with a common extension this risk is greatly reduced. Perhaps we could make it explicit by only doing recursive copy for directories that are listed in the data-files field with a trailing directory slash, e.g. data-files: graphics/

Contributor

bos commented May 24, 2012

(Imported comment by @dcoutts on 2010-08-02)

I think we should discuss this with users a bit first. The point of the existing rather limited support for globbing is to avoid accidentally picking up more files than was intended (e.g. hidden or generated files). By limiting it to files with a common extension this risk is greatly reduced. Perhaps we could make it explicit by only doing recursive copy for directories that are listed in the data-files field with a trailing directory slash, e.g. data-files: graphics/

@bos

This comment has been minimized.

Show comment
Hide comment
@bos

bos May 24, 2012

Contributor

(Imported comment by @ezyang on 2010-08-09)

I will note, for whatever it's worth, that this design policy has lead me to write scripts that do regular style globbing and convert it into something I can place in my Cabal file. :-)

Contributor

bos commented May 24, 2012

(Imported comment by @ezyang on 2010-08-09)

I will note, for whatever it's worth, that this design policy has lead me to write scripts that do regular style globbing and convert it into something I can place in my Cabal file. :-)

@bos

This comment has been minimized.

Show comment
Hide comment
@bos

bos May 24, 2012

Contributor

(Imported comment by cygnus on 2010-08-09)

I would support a trailing slash option.

Contributor

bos commented May 24, 2012

(Imported comment by cygnus on 2010-08-09)

I would support a trailing slash option.

@bos

This comment has been minimized.

Show comment
Hide comment
@bos

bos May 24, 2012

Contributor

(Imported comment by @dcoutts on 2010-08-10)

See also #794.

Contributor

bos commented May 24, 2012

(Imported comment by @dcoutts on 2010-08-10)

See also #794.

@hdgarrood

This comment has been minimized.

Show comment
Hide comment
@hdgarrood

hdgarrood May 21, 2013

Contributor

I think the issue IDs were rearranged -- #794 doesn't seem to be relevant to this issue. #784 is, however.

Contributor

hdgarrood commented May 21, 2013

I think the issue IDs were rearranged -- #794 doesn't seem to be relevant to this issue. #784 is, however.

@23Skidoo

This comment has been minimized.

Show comment
Hide comment
@23Skidoo

23Skidoo May 21, 2013

Member

@hdgarrood Yes, @dcoutts refers to http://hackage.haskell.org/trac/hackage/ticket/794 . Cross-references got mixed up during the trac -> github import.

Member

23Skidoo commented May 21, 2013

@hdgarrood Yes, @dcoutts refers to http://hackage.haskell.org/trac/hackage/ticket/794 . Cross-references got mixed up during the trac -> github import.

hdgarrood added a commit to hdgarrood/cabal that referenced this issue May 21, 2013

Allow directories in cabal data-files (#713)
This commit adds the capability to specify a whole directory which
contains data-files in a project's .cabal file.

If a data-files entry ends with a slash, like "static/", then it will
pull in all files under the directory named "static/".

Notes:

* This has only been tested by calling matchDirFileGlob in GHCi.
* I'm not sure about the name (data FileGlob = DirTrailingSlash --
  perhaps it should have Glob on the end like the others?) but I've been
  unable to come up with anything better.

@23Skidoo 23Skidoo modified the milestones: Cabal-1.22, Cabal-1.18 Apr 20, 2014

@mietek

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek Nov 26, 2014

Contributor

Having data-files: static/*.foo not glob static/*.bar.foo is rather surprising. A documented gotcha is still a gotcha.

I would support using a standard globbing mechanism in place of the current one, which also seems to have some odd corner cases. (#2030)

Contributor

mietek commented Nov 26, 2014

Having data-files: static/*.foo not glob static/*.bar.foo is rather surprising. A documented gotcha is still a gotcha.

I would support using a standard globbing mechanism in place of the current one, which also seems to have some odd corner cases. (#2030)

@mietek

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek Nov 26, 2014

Contributor

Halcyon supports declaring additional data-files for use at run-time with the HALCYON_EXTRA_DATA_FILES option, using standard GNU bash globbing syntax.

See Haskell Language for an example of declaring static website content as data files.

Contributor

mietek commented Nov 26, 2014

Halcyon supports declaring additional data-files for use at run-time with the HALCYON_EXTRA_DATA_FILES option, using standard GNU bash globbing syntax.

See Haskell Language for an example of declaring static website content as data files.

@mietek mietek referenced this issue in mietek/halcyon Feb 14, 2015

Open

Add and improve glob-based options #39

0 of 2 tasks complete

@hdgarrood hdgarrood referenced this issue Apr 4, 2015

Closed

Implement bash (with globstar) style globbing #2522

1 of 4 tasks complete

@ttuegel ttuegel modified the milestones: Cabal-1.24, Cabal-1.22 Apr 23, 2015

@BardurArantsson

This comment has been minimized.

Show comment
Hide comment
@BardurArantsson

BardurArantsson Jun 25, 2015

Collaborator

Tihs is either superceded by (or supercedes) #784 . Can we please close one of them?

EDIT: Actually, it's superceded. Glob syntax allows for directories (recursively) via "foo/*/"

Collaborator

BardurArantsson commented Jun 25, 2015

Tihs is either superceded by (or supercedes) #784 . Can we please close one of them?

EDIT: Actually, it's superceded. Glob syntax allows for directories (recursively) via "foo/*/"

@23Skidoo 23Skidoo modified the milestones: Cabal 1.24, Cabal 1.26 Feb 21, 2016

@ezyang ezyang modified the milestone: Cabal 2.0 Sep 6, 2016

@ezyang

This comment has been minimized.

Show comment
Hide comment
@ezyang

ezyang Sep 6, 2016

Contributor

OK, closing this one.

Contributor

ezyang commented Sep 6, 2016

OK, closing this one.

@ezyang ezyang closed this Sep 6, 2016

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