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

mkComponentGraph is broken #6894

Closed
phadej opened this issue Jun 11, 2020 · 2 comments
Closed

mkComponentGraph is broken #6894

phadej opened this issue Jun 11, 2020 · 2 comments
Assignees
Milestone

Comments

@phadej
Copy link
Collaborator

phadej commented Jun 11, 2020

-- | Create a 'Graph' of 'Component', or report a cycle if there is a
-- problem.
--
mkComponentsGraph :: ComponentRequestedSpec
                  -> PackageDescription
                  -> Either [ComponentName] ComponentsGraph
mkComponentsGraph enabled pkg_descr =
    let g = Graph.fromDistinctList
                           [ N c (componentName c) (componentDeps c)
                           | c <- pkgBuildableComponents pkg_descr
                           , componentEnabled enabled c ]
    in case Graph.cycles g of
          []     -> Right g
          ccycles -> Left  [ componentName c | N c _ _ <- concat ccycles ]
  where
    -- The dependencies for the given component
    componentDeps component =
      (CExeName <$> getAllInternalToolDependencies pkg_descr bi)

      ++ [ if pkgname == packageName pkg_descr
           then CLibName LMainLibName
           else CLibName (LSubLibName toolname)
         | Dependency pkgname _ _ <- targetBuildDepends bi
           -- ^ HERE, we ignore the library names all together
         , let toolname = packageNameToUnqualComponentName pkgname
         , toolname `elem` internalPkgDeps ]
      where

I think that because of this issue the foo:bar syntax is broken beyond repair in Cabal-3.0 and 3.2.

@phadej phadej added this to the 3.4.0.0 milestone Jun 11, 2020
@phadej phadej self-assigned this Jun 11, 2020
@phadej
Copy link
Collaborator Author

phadej commented Jun 11, 2020

--- a/cabal-testsuite/PackageTests/InternalLibraries/p/p.cabal
+++ b/cabal-testsuite/PackageTests/InternalLibraries/p/p.cabal
@@ -1,10 +1,10 @@
+cabal-version:       3.0
 name:                p
 version:             0.1.0.0
-license:             BSD3
+license:             BSD-3-Clause
 author:              Edward Z. Yang
 maintainer:          [email protected]
 build-type:          Simple
-cabal-version:       1.24
 
 library q
   build-depends:       base
@@ -13,7 +13,7 @@ library q
   default-language:    Haskell2010
 
 library
-  build-depends:       base, q
+  build-depends:       base, p:q
   exposed-modules:     P
   hs-source-dirs:      p
   default-language:    Haskell2010

is enough to reproduce this.

Run then make cabal-install-test TEST=PackageTests/InternalLibraries/setup.test.hs

@phadej
Copy link
Collaborator Author

phadej commented Jun 12, 2020

Solver also errors

-----BEGIN CABAL OUTPUT-----
Error:
    Dependency cycle between the following components: library
    In the inplace package 'issue-6894'
-----END CABAL OUTPUT-----

phadej added a commit to phadej/cabal that referenced this issue Jun 12, 2020
phadej added a commit to phadej/cabal that referenced this issue Jun 12, 2020
phadej added a commit to phadej/cabal that referenced this issue Jun 12, 2020
phadej added a commit that referenced this issue Jun 12, 2020
@phadej phadej closed this as completed in fb9bb5c Jun 12, 2020
phadej added a commit that referenced this issue Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant