Skip to content

new-freeze freezes the dependencies of unused components. #5136

Open

Description

@sebright

I reproduced this issue by adding an executable to a package that is used only as a library dependency in one of the tests in #5135: sebright@abba0dc. The new executable has a dependency on the package exe-dependency. Since exe-dependency isn't required by any other component, new-build shouldn't need to build it. However, new-freeze adds a constraint on the package. (The commit adds an assertion checking for the constraint, and it passes.) I think that this type of constraint shouldn't be necessary in new-build, especially once we implement component-based dependency solving, and the solver doesn't need to choose dependencies for unused components.

I think this is related to the old-freeze issue #1896.

Activity

  1. phadej commented on Feb 12, 2018

    @phadej
    Collaborator

    By playing with cabal-plan I noticed that executables of dependencies end up in the plan. For example:

    servant-server-0.13 % cabal new-build --dry-run --disable-tests --disable-benchmarks
    servant-server-0.13 % cabal-plan --hide-builtin dot --tred --path-from servant-server --path-to wai-app-static | dot -Tpng -odeps.png
    

    deps

    note the exe:warp above the red line. I think it shouldn't be there.

    I don't know how this works regarding store. Do we optimistically† solve for exes too, so they end up in the plan?

    EDIT But then it has a side-effect of executable showing in the plan:

    servant-server-0.13 % cabal-plan list-bins
    servant-server:exe:greet  .../mess/servant-server-0.13/dist-newstyle/build/x86_64-linux/ghc-8.2.2/servant-server-0.13/build/greet/greet
    wai-app-static:exe:warp .../.cabal/store/ghc-8.2.2/wai-app-static-3.1.6.1-a95001e75ff661a67f5af490d2687020725f222047cf4c4377e2228e846ec3e9/bin/warp
    

    † so solver is free to turn them off, if their deps get in the way

  2. sebright commented on Feb 12, 2018

    @sebright
    CollaboratorAuthor

    The solver always solves for all components of every dependency, because it doesn't yet have a way to determine which components are needed. That is a big part of #4087. I had assumed that new-build immediately pruned the solver's install plan to remove unnecessary components, but it looks like that isn't true. I just checked plan.json for the small example, and it also contains the exe dependency.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions