Skip to content
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

PD check: do not treat library names as package names #9132

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,18 +1352,13 @@ checkFields 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