-
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
Importing a source-repository-package
cannot be overridden
#8463
Comments
A similar issue with |
Huh, that's surprising. I think I'd expect the naive approach to be something like: type Dependencies = [Map PackageName DepInfo]
getDependency :: PackageName -> Dependencies -> Maybe DepInfo
getDependency packageName =
listToMaybe . mapMaybe (Map.lookup packageName) where |
Overriding for constraints is certainly something we'd want. Overriding for source-repository-packages feels different to me. Cabal actually has no notion that these are repositories that are used to satisfy particular dependencies. It just treats them all as places that also have "local" packages that are part of the project. In the phase where they're resolved, there's no real way for cabal to see that the two provide the same package -- they're different urls, which could point to anything. It just so happens that they both provide the same package, but that's only something that can be observed once the build-plan construction is underway. In this case, perhaps refactoring so there's a "core" file with everything but the source-repository-package, and then two different ones that import it, each of which provides a different one, is an appropriate solution? |
I understand that currently constraints are additive. If I want to import something like |
@philderbeast there's none currently. See Gershom's comment I linked in my previous message. |
I think you're describing a difficulty in implementing this particular feature, rather than a reason to not want it.
This is a viable work-around for right now, but it doesn't obviate the feature request. The workflow I want is to:
To answer "What needs to be done to be fully forward compatible?" I can simply see: are there any entries in The workflow that this work-around requires is:
To answer the above question, I need to check both This is a much more cumbersome workflow. |
It sounds so to me as well. Given that, if somebody proposes a good method to implement it, that would move things forward. |
Well I'm having difficulty conceptualizing the syntax and semantics of such a feature -- implementation can follow from specification. In particular, it would be ad-hoc and not always correct for any future import of a src-repository-package in one repo with one hash to override an existing one in the same repo with a different hash. So we need not a way of overriding but of removing a stanza, at which point we probably need a grammar for removing arbitrary stanzas. And I do not know of a lightweight grammar that makes that sort of reference easily possible, and certainly not one that would feel natural to end-users. |
A reasonable expectation is that local overrides remote. For instance, if I
|
On using the build of stack with cabal as test bed, disregarding the
I can get this to work as-is now (save for commenting the stack constraint) by adding
This doesn't work the other way, I can't have |
@parsonsmatt maybe we could give priority to shallower |
Describe the bug
I have a
cabal.project
and aghc94.cabal.project
that I am using to get compatible with GHC 9.4 on the work codebase. To simplify the code, I'm using theimport
feature in Cabal 3.8 withghc94.cabal.project
to ensure that there is as little duplication as possible and to track what work needs to be done to integrate everything.Unfortunately, because I have two different
source-repository-package
in each file for the same package, I get a conflict, andcabal
doesn't try to override.To Reproduce
Put the two
cabal.project
files in a directory somewhere with a.cabal
file that depends onbytebuild
.Expected behavior
cabal
clearly knows that I depend onbytebuild
. And in theimport
edcabal.project
, I satisfy that dependency with asource-repository-package
. In the importingghc94.cabal.project
, I would expect the newsource-repository-package
to override the one in the import.System information
cabal
,ghc
versionsThe text was updated successfully, but these errors were encountered: