Skip to content

extra-deps' clones as many times the repository as there are subdirs #5411

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

Closed
blackheaven opened this issue Oct 7, 2020 · 8 comments · Fixed by #5624
Closed

extra-deps' clones as many times the repository as there are subdirs #5411

blackheaven opened this issue Oct 7, 2020 · 8 comments · Fixed by #5624

Comments

@blackheaven
Copy link

General summary/comments (optional)

When I specify, in extra-deps, a repository with many subdirs, the repository is clone many times.

Steps to reproduce

Build a project with this package.yml part:

extra-deps:
- git: https://github.com/theam/aws-lambda-haskell-runtime.git
  commit: 6aef017c1621c828a47dc98eae12d84818a8d45c
- git: https://github.com/brendanhay/amazonka.git
  commit: 020bc7bde47bb235e448c76088dc44d6cec13e9b
  subdirs:
    - gen
    - core
    - test
    - examples
    - amazonka

Expected

I expect only one cloning.

Actual

The repository is cloned once by subdir.

Partial output

Stack version

$ stack --version
Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0

Method of installation

curl -sSL https://get.haskellstack.org/ | sh
@mattaudesse
Copy link
Member

Thanks for reporting @blackheaven.

Just a note: I've given this the type: enhancement label rather than type: bug because it's surprising and sub-optimal (but not workflow-breaking) behavior.

@qrilka
Copy link
Contributor

qrilka commented Oct 8, 2020

Pantry caches repos but it looks like it does it per subdirectory - https://github.com/commercialhaskell/pantry/blob/master/src/Pantry/Storage.hs#L236

@blackheaven
Copy link
Author

Nice catch.

I am curious, what are the rationals for that strategy?

@qrilka
Copy link
Contributor

qrilka commented Oct 8, 2020

@snoyberg could you share them?

@snoyberg
Copy link
Contributor

snoyberg commented Oct 8, 2020

The model of pantry is that a tree represents a single package. This allows caching only what is needed for that package, and more frequent cache hits.

IMO, the best way to improve this is to tweak pantry to aggregate all packages coming from the same repo and collect all the trees at once. I don't think it would be too invasive a change, and shouldn't require any changes at all to the overall model.

@blackheaven
Copy link
Author

It makes sense, thank you for that explanation.

@hasufell
Copy link
Contributor

hasufell commented Oct 8, 2020

Another data point is cardano-wallet, which takes ~30 minutes just to clone all repos on my machine (1mb/s, say nothing 😢). Cabal takes about 5.

@hasufell
Copy link
Contributor

Fixed via:

hasufell added a commit to hasufell/stack that referenced this issue Sep 30, 2021
hasufell added a commit to hasufell/stack that referenced this issue Sep 30, 2021
hasufell added a commit to hasufell/stack that referenced this issue Sep 30, 2021
hasufell added a commit to hasufell/stack that referenced this issue Oct 1, 2021
hasufell added a commit to hasufell/stack that referenced this issue Oct 1, 2021
hasufell added a commit to hasufell/stack that referenced this issue Oct 5, 2021
hasufell added a commit to hasufell/stack that referenced this issue Oct 6, 2021
snoyberg added a commit that referenced this issue Oct 6, 2021
hololeap pushed a commit to hololeap/stack that referenced this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants