Skip to content

dune install fails to install directories #3752

Closed

Description

@samoht

dune build @install works well for target directories but dune install fails.

See for instance this small repro:

(rule
  (target foo)
  (package p)
  (action (progn
    (run mkdir foo)
    (run touch foo/bar))))

(install (package p) (section lib) (files foo))

and

$ dune build @install
$ echo $?
0
$ dune install
Installing /Users/thomas/.opam/system/lib/p/META
Installing /Users/thomas/.opam/system/lib/p/dune-package
Installing /Users/thomas/.opam/system/lib/p/foo
Error: Is a directory

Activity

  1. self-assigned this
    on Oct 13, 2020
  2. voodoos commented on Oct 13, 2020

    @voodoos
    Collaborator

    @rgrinberg, what are your thoughts on this issue ?

    I understood that it would be a useful fix for the Mirage team and I would like your feedback before diving-in.

    It looks like it would be easy to fix that issue when the directory is just a static directory (and not a target).

  3. rgrinberg commented on Oct 13, 2020

    @rgrinberg
    Member

    It would be a good feature to have. How do you plan on expressing a dependency on a target directory though?

    By the way, perhaps it would make sense to allow glob patterns inside install stanzas first? That might be enough for your use case.

  4. MisterDA commented on Apr 13, 2022

    @MisterDA
    Contributor

    By the way, perhaps it would make sense to allow glob patterns inside install stanzas first? That might be enough for your use case.

    It's exactly what I would have needed right now!
    My use-case is that my project embeds a webserver with a bunch of static files static/{img/*.png,css/*.css,js/*.js}. I'd like so install all these files without having to list each of them, and preserve the directory structure.

    EDIT:
    btw the example in the first message fails with Dune 3.0 with:

    8 | (install (package p) (section lib) (files foo))
                                                  ^^^
    Error: Error trying to read targets after a rule was run:
    - default/lib/p/foo: Unexpected file kind "S_DIR" (directory)
    
  5. linked a pull request that will close this issuefeature: install dir #5097on May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions