Skip to content

Commit

Permalink
PD check: do not treat library names as package names (#9132)
Browse files Browse the repository at this point in the history
Fixes #9122

(cherry picked from commit 4aa5f88)

# Conflicts:
#	Cabal/src/Distribution/PackageDescription/Check.hs
  • Loading branch information
fgaz authored and mergify[bot] committed Jul 24, 2023
1 parent 529f850 commit c4fa368
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,17 +1210,20 @@ checkFields pkg =
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ]

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

=======
>>>>>>> 4aa5f8861 (PD check: do not treat library names as package names (#9132))
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 c4fa368

Please sign in to comment.