diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index 9a79fb4f683..166d53e0290 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -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 = diff --git a/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal b/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal new file mode 100644 index 00000000000..1100690129a --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal @@ -0,0 +1,6 @@ +cabal-version: 3.4 +name: p +Version: 2 +Build-Type: Simple + +library diff --git a/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal b/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal new file mode 100644 index 00000000000..d9bd9b331e5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal @@ -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 diff --git a/cabal-testsuite/PackageTests/Regression/T9122/setup.cabal.out b/cabal-testsuite/PackageTests/Regression/T9122/setup.cabal.out new file mode 100644 index 00000000000..1367a55a1a0 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T9122/setup.cabal.out @@ -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 +# Setup register +Registering library for p-2... +# Setup configure +Configuring q-1... diff --git a/cabal-testsuite/PackageTests/Regression/T9122/setup.out b/cabal-testsuite/PackageTests/Regression/T9122/setup.out new file mode 100644 index 00000000000..8957672640b --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T9122/setup.out @@ -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 +# Setup register +Registering library for p-2.. +# Setup configure +Configuring q-1... diff --git a/cabal-testsuite/PackageTests/Regression/T9122/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T9122/setup.test.hs new file mode 100644 index 00000000000..93a4a976b3b --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T9122/setup.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = setupAndCabalTest $ withPackageDb $ do + withDirectory "p" $ setup_install [] + withDirectory "q" $ setup "configure" [] diff --git a/changelog.d/issue-9122 b/changelog.d/issue-9122 new file mode 100644 index 00000000000..c8d82af1d86 --- /dev/null +++ b/changelog.d/issue-9122 @@ -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