[GHC] #10566: Move "package key" generation to GHC

GHC ghc-devs at haskell.org
Tue Jul 7 00:41:45 UTC 2015


#10566: Move "package key" generation to GHC
-------------------------------------+-------------------------------------
        Reporter:  ezyang            |                   Owner:  ezyang
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Package system    |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by ezyang):

 Based on conversation with simonpj et al, we have a different plan to
 accomplish this:

 1. We introduce a new concept, the *version hash*, a hash of package name,
 package version, and the version hashes of all textual dependencies (i.e.
 packages which were include.) A version hash is a coarse approximation of
 installed package IDs, which are suitable for inclusion in package keys
 (you don't want to put an IPID in a package key, since it means the key
 will change any time the source changes.) Version hashes are calculated by
 Cabal and passed to GHC, and they are recorded in the installed package
 database.

 2. GHC now accepts a new flag `-version-hash` which Cabal can invoke in
 order to pass in a version hash. So now we get something like `-version-
 hash 8TmvWUcS1U1IKHT0levwg3 -hide-all-packages -package-id ...` when we
 call GHC. GHC takes `-version-hash` and then computes a package key based
 on it.

 3. Cabal computes the version hash by looking at the recorded version
 hashes in the installed package database of all the external dependencies
 of the library portion of the package. It then calls GHC's `--package-key`
 major mode to get the package key that the package will end up having.

 Cabal tracking bug: https://github.com/haskell/cabal/pull/2685

 One minor complication: sometimes, GHC needs to know what the package name
 of the package currently being built is to give a good error message.
 Since the version hash is just a hash, this isn't enough information.
 There are two ways we can get the information we need:

 1. Just pass it to GHC.  `-package-name` is not a bad flag name for this.

 2. Put it into an (inplace) package database and have GHC query that
 database for the information. This requires some Cabal changes, see
 https://github.com/haskell/cabal/issues/2710

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


More information about the ghc-tickets mailing list