[GHC] #16072: All dependencies of packages must be explicitly listed when defining flavour packages

GHC ghc-devs at haskell.org
Wed Dec 19 15:13:03 UTC 2018


#16072: All dependencies of packages must be explicitly listed when defining
flavour packages
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Build System   |           Version:  8.6.3
  (Hadrian)                          |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In the Hadrian user guide, it explains that you can use the `packages`
 variable in order to describe what is built. However, unless you list all
 the dependencies of what you want to build also in `packages` then it will
 fail to build.

 For example, if I want to just build `ghctags` then I might try to modify
 `packages` to

 {{{
 ghcTagsPackages stage = case stage of
                            Stage2 -> [ghcTags]
                            _ -> []
 }}}

 but this will fail as I haven't listed any dependencies of `ghcTags` at
 all.

 The culprit here is the `contextDependencies` function.

 {{{
 contextDependencies :: Context -> Action [Context]
 contextDependencies Context {..} = do
     depPkgs <- go [package]
     return [ Context depStage pkg way | pkg <- depPkgs, pkg /= package ]
   where
     depStage = min stage Stage1
     go pkgs  = do
         deps <- concatMapM step pkgs
         let newPkgs = nubOrd $ sort (deps ++ pkgs)
         if pkgs == newPkgs then return pkgs else go newPkgs
     step pkg = do
         deps   <- pkgDependencies pkg
         active <- sort <$> stagePackages depStage
 return $ intersectOrd (compare . pkgName) active deps
 }}}

 Notice in the definition of `step`, the actual package dependencies are
 intersected with `stagePackages`.


 It is also unclear to me why this function is defined recursively as
 surely when we `need` one dependency, that will in turn `need` its
 dependencies and so on.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16072>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list