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

Fix "source-repository-package breaks 'cabal v2-install'" #5708

Merged
merged 2 commits into from
Nov 25, 2018
Merged

Fix "source-repository-package breaks 'cabal v2-install'" #5708

merged 2 commits into from
Nov 25, 2018

Conversation

fommil
Copy link
Contributor

@fommil fommil commented Nov 23, 2018

Fix #5643 which is a bigger bug than original reported: v2-install currently does not work at all if there are git packages. // @hasufell


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

@fommil fommil changed the base branch from master to 2.4 November 23, 2018 10:24
@fommil

This comment has been minimized.

@23Skidoo
Copy link
Member

Would be nice if there was a test case.

@fommil
Copy link
Contributor Author

fommil commented Nov 23, 2018

@23Skidoo yeah, I would like that too. Where can I look to add one? I basically just need to run v2-install on a package definition that has a git source dependency.

@23Skidoo
Copy link
Member

I'd look at the existing VCS tests.

@fommil
Copy link
Contributor Author

fommil commented Nov 23, 2018

@23Skidoo could you please point me to them in the repo?

@fommil
Copy link
Contributor Author

fommil commented Nov 23, 2018

I can confirm that this fixes the exception for me, but unfortunately it causes a recompile of my project (e.g. the originally reported repro). I'm not sure if that is a side effect of this fix, or if it is another bug in cabal. i.e. if I do cabal v2-build foo -O0 then cabal v2-install foo -O0 then I get two full recompiles.

git clone https://github.com/hasufell/example-cabal-project.git
cd example-cabal-project
cabal v2-build example-cabal-project 
cabal v2-install example-cabal-project --symlink-bindir=bin

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "0aea563786d6a5f69244ee8169832039d66d2159",
"tag":"linux-7.6.3"
}
@quasicomputational
Copy link
Contributor

quasicomputational commented Nov 23, 2018

A PackageTest (in cabal-testsuite/PackageTests/; have a look in, e.g., NewSdist for examples of what they look like) should be able to exercise this code. I'd also suggest a test for new-sdist with a source-repository-package, which was also broken.

Is installing binaries from a source-repository-package the right thing to do, considering that regular dependencies off Hackage don't have binaries installed? Will this surprise users? See also #5586.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "0aea563786d6a5f69244ee8169832039d66d2159",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "0aea563786d6a5f69244ee8169832039d66d2159",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "0aea563786d6a5f69244ee8169832039d66d2159",
"tag":"linux-8.6.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "0aea563786d6a5f69244ee8169832039d66d2159",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
@fommil
Copy link
Contributor Author

fommil commented Nov 23, 2018

@quasicomputational adding a test seems to be the easy thing, but referencing a git repo that must permanently be available is another thing. Does one exist that I can use?

I think I've convinced myself to prefer a workflow based on v2-build rather than v2-install so I'm not sure what other people's expectations are. In my usecase I just want access to the binary, I don't care about sdists.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"linux-8.6.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"osx-7.8.4"
}
@quasicomputational
Copy link
Contributor

I think we'll want to have a local git repository during testing, rather than hitting the network. Creating one as part of the test is probably the simplest route, so shell out to git init etc.

To be clear - you want to have a binary from the source-repository-package installed (i.e., copied to the symlink-bindir directory)? That's what the patch as written will do - i.e., it's treating the package from the git repo as local. I don't object to this exactly, but I just want to be clear on if this is desired behaviour or an implementation detail.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"osx-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 23, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "5206a2b121b81bc110ff327d77606288f8faf593",
"tag":"osx-8.0.2"
}
@hvr
Copy link
Member

hvr commented Nov 23, 2018

@quasicomputational The consequence in v2-install makes me think we really need the ability to control whether a git repo dep is considered local or non-local (as brought up in #5586); and I'd argue to make the default be to treat it as non-local as that's what imho is the less surprising default: In my POV, referring to git repos instead of hackage packages is mostly for the purpose of vendoring rather than treating them as part of your project proper.

@fommil
Copy link
Contributor Author

fommil commented Nov 23, 2018

I'm travelling and won't be able to work on this PR for a few weeks.

@hvr hvr requested a review from 23Skidoo November 24, 2018 00:52
@hvr hvr added this to the 2.4.1.0 milestone Nov 24, 2018
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "7fd8f95d1535560cd6345f33066baacdf8281d7b",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "7fd8f95d1535560cd6345f33066baacdf8281d7b",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "7fd8f95d1535560cd6345f33066baacdf8281d7b",
"tag":"osx-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-8.6.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"osx-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"osx-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 24, 2018
"url":"pull/5708",
"account":"haskell",
"repo":"cabal",
"commit": "8108719b1e32ff5095b238727a5c4986bec3e216",
"tag":"osx-8.0.2"
}
fommil and others added 2 commits November 25, 2018 16:31
When creating an sdist, if the project is a remote source repo then
use the local directory if it is available.

This allows projects with remote source repos to use the v2-install
command.

Resolves: #5643
Resolves the non-vcs-related part of #5643

NB: this patch mostly moves around code; use
    `git show --ignore-space-change` to facilitate code-review
@hvr hvr merged commit 005d912 into haskell:2.4 Nov 25, 2018
hvr added a commit that referenced this pull request Nov 25, 2018
@fommil fommil deleted the source-install-5643 branch November 26, 2018 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants