Skip to content

Commit

Permalink
Merge pull request #9145 from haskell/mergify/bp/3.10/pr-9132
Browse files Browse the repository at this point in the history
PD check: do not treat library names as package names (backport #9132)
  • Loading branch information
fgaz authored Sep 6, 2023
2 parents 3b74b68 + 9093f32 commit 29e80e9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 5 deletions.
6 changes: 1 addition & 5 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,17 +1210,13 @@ checkFields pkg =
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ]

internalLibraries =
map (maybe (packageName pkg) unqualComponentNameToPackageName . libraryNameString . libName)
(allLibraries pkg)

internalExecutables = map exeName $ executables pkg

internalLibDeps =
[ dep
| bi <- allBuildInfo pkg
, dep@(Dependency name _ _) <- targetBuildDepends bi
, name `elem` internalLibraries
, name == packageName pkg
]

internalExeDeps =
Expand Down
6 changes: 6 additions & 0 deletions cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cabal-version: 3.4
name: p
Version: 2
Build-Type: Simple

library
10 changes: 10 additions & 0 deletions cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cabal-version: 3.4
name: q
Version: 1
Build-Type: Simple

library
build-depends: q:p

library p
build-depends: p:p == 2
11 changes: 11 additions & 0 deletions cabal-testsuite/PackageTests/Regression/T9122/setup.cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Setup configure
Configuring p-2...
# Setup build
Preprocessing library for p-2..
Building library for p-2..
# Setup copy
Installing library in <PATH>
# Setup register
Registering library for p-2..
# Setup configure
Configuring q-1...
11 changes: 11 additions & 0 deletions cabal-testsuite/PackageTests/Regression/T9122/setup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Setup configure
Configuring p-2...
# Setup build
Preprocessing library for p-2..
Building library for p-2..
# Setup copy
Installing library in <PATH>
# Setup register
Registering library for p-2..
# Setup configure
Configuring q-1...
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/Regression/T9122/setup.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

main = setupAndCabalTest $ withPackageDb $ do
withDirectory "p" $ setup_install []
withDirectory "q" $ setup "configure" []
4 changes: 4 additions & 0 deletions changelog.d/issue-9122
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
synopsis: Fix dependency on an external package when an internal library with the same name exists
packages: Cabal
issues: #9122
prs: #9132

0 comments on commit 29e80e9

Please sign in to comment.