-
Notifications
You must be signed in to change notification settings - Fork 704
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
Apply local configuration to install targets #9697
Conversation
547692a
to
80312d7
Compare
80312d7
to
5ebe696
Compare
Note for tomorrow: I should probably pass --installdir to |
Great sleuthing! |
5ebe696
to
1fe83f3
Compare
1fe83f3
to
129946d
Compare
129946d
to
922ef7f
Compare
922ef7f
to
25e1283
Compare
We should probably backport this |
25e1283
to
aa592c3
Compare
@alt-romes CI has failed after the rebase, the patch needs to be slightly modified it seems. |
aa592c3
to
811e7d8
Compare
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
811e7d8
to
802a326
Compare
@alt-romes It looks like this is causing issues. From the matrix channel (I can reproduce).
I think the issue is that you cannot call |
In haskell#9697 we fixed passing local options to cabal install targets, but rebasing accidentally dropped one of the added the tests for that PR, which tested cabal install <target>, where <target> was only available from a remote repository.
I noticed now that my rebase force-with-lease deleted the test for remote repository package you added @mpickering. |
Refactor CmdInstall / fix bug in #9697
In haskell#9697 we fixed passing local options to cabal install targets, but rebasing accidentally dropped one of the added the tests for that PR, which tested cabal install <target>, where <target> was only available from a remote repository.
Add test cabal install remote-pkg for #9697
I'm confused/concerned about this despite reviewing it and missing this element (for which, apologies) My understanding was this was intended to do the following "The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets." However it also appears to switch Why was this change made and was it necessary to resolve the linked issue, or is it just an additional change that was considered an improvement and sort of "slid in"? |
That's not quite right, before my patch: baseCliConfig =
commandLineFlagsToProjectConfig
globalFlags
flags{configFlags = configFlags'}
clientInstallFlags'
cliConfig = addLocalConfigToTargets baseCliConfig targetStrings The change slid in because the Let me clarify what local options are (excerpt from a commit message that didn't make it):
So, local options are both top-level cabal.project fields and cli arguments. Now, in 76670eb, the behaviour started to be: apply local options to the targets of What did this patch actually break, and that @andreabedini fixed subsequently? |
I don't think it would be easy nor necessary to separate the actual cli flags from the top-level cabal.project options to apply to the If I have a
and do If I do |
I don't know the fine details of what kinds of configuration there are, etc., but just reporting as a user here:
If you're intending for this to work differently, that's your purview, but I would then at least like a fat warning when using a global installation command in a context where local configuration is used. :) |
@tomsmeding that sounds about right. If there is a clear way to distinguish between cli arguments and cabal.project options we could probably look at whether the target refers to a package which is local to the project in order to determine if the cabal.project options should apply. But I'm not sure there is.
FWIW this decision was made in #8779, I have only patched it to work for the remaining |
Alright, thanks for the clarification @alt-romes and sorry for the confusion on my part. I had wrongly thought #8779 only applied cli flags and not the project file, but some testing with cabal-3.10.1.0 has convinced me I was wrong. I think this is not ideal, but we can live with it, even long term, and there's no reason to attach figuring out if we want to change this in the future to this current patch. (so i did miss it in a review -- but not of this pr but that pr) Thanks again for walking though it so clearly! |
I believe we have something like that: |
In haskell#9697 we fixed passing local options to cabal install targets, but rebasing accidentally dropped one of the added the tests for that PR, which tested cabal install <target>, where <target> was only available from a remote repository.
The target of
cabal install
is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it.In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied.
However,
cabal install
targets are NOT necessarily package names, so, e.g., if we didcabal install exe:mycomp
, the local flags would not apply since "exe:mycomp" is not a recognized /package/.The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets.
Fixes #7297, #8909, the install part of #7236, #8529, #7832