haskell / haskell/cabal

Importing a `source-repository-package` cannot be overridden

Open
#8,463 11 comments 0 reactions 0 assignees View on GitHub
re: project-file type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

I have a `cabal.project` and a `ghc94.cabal.project` that I am using to get compatible with GHC 9.4 on the work codebase. To simplify the code, I'm using the `import` feature in Cabal 3.8 with `ghc94.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, and `cabal` doesn't try to override.

```
-- cabal.project

packages: .

source-repository-package
type: git
location: https://github.com/avieth/bytebuild.git
tag: 036aa84fb037e62c4e7da4523c818541481b9a07
--sha256: 9yiWSMGyi9vxVAV27YctWFYTDL0Uaa1j7TfyUdgMYtY=
subdir: .

-- ghc94.cabal.project
packages: .

import: ./cabal.project

-- https://github.com/byteverse/bytebuild/pull/29
source-repository-package
type: git
location: https://github.com/parsonsmatt/bytebuild
tag: e8dee26a4cc379a1971b428187fad51824de8e38
```

**To Reproduce**

Put the two `cabal.project` files in a directory somewhere with a `.cabal` file that depends on `bytebuild`.

```
$ cabal v2-build --project-file ghc94.cabal.project
```

**Expected behavior**

`cabal` clearly knows that I depend on `bytebuild`. And in the `import`ed `cabal.project`, I satisfy that dependency with a `source-repository-package`. In the *importing* `ghc94.cabal.project`, I would expect the new `source-repository-package` to *override* the one in the import.

**System information**

- Operating system: Ubuntu
- `cabal`, `ghc` versions

```
λ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
λ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.2
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.