commercialhaskell / curator

Haskell Stackage curator build tool
Other
9 stars 8 forks source link

wiredInPackages is out of date and depends on GHC version #40

Open chreekat opened 6 months ago

chreekat commented 6 months ago

GHC's wired-in packages are currently

https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Unit/Types.hs#L635-643

wiredInUnitIds =
   [ primUnitId
   , bignumUnitId
   , ghcInternalUnitId
   , baseUnitId
   , rtsUnitId
   , thUnitId
   , experimentalUnitId
   ]

curator and stack both have different lists.

Curator:

https://github.com/commercialhaskell/curator/blob/master/src/Curator/Snapshot.hs#L565-L580

wiredInGhcPackages =
    Set.fromList
        [ "ghc-prim"
        , "integer-gmp"
        , "integer-simple"
        , "base"
        , "rts"
        , "template-haskell"
        , "dph-seq"
        , "dph-par"
        , "ghc"
        , "interactive"
        ]

Stack: https://github.com/commercialhaskell/stack/issues/6558

I have no idea what effect this has on Stack or Stackage snapshots.

bergmark commented 6 months ago

I don't know why stack needs the list, seems odd if it wouldn't tie it to GHC versions.

For curator, I think:

a ghc-wired package missing in curator means we may upgrade it and that can break snapshots - but perhaps that would also break the creation of the snapshots since we build with stack. If it's missing in ghc it means that we won't upgrade them in snapshots even if we have to - so that's less of an issue.

I'm not sure what actual issues it may cause... we should keep it up-to-date

chreekat commented 6 months ago

Yeah looks like you wouldn't be able to specify such a package in a snapshot:

        let isWiredIn pn _ = pn `Set.member` wiredInGhcPackages
            (wiredIn, packages) =
              Map.partitionWithKey isWiredIn (Pantry.snapshotPackages snapshot)
        if not (Map.null wiredIn)
        then do
          let errMsg = "GHC wired-in package can not be overriden"
          pure $ Map.map (const [OtherError errMsg]) wiredIn

src/Curator/Snapshot:192

mpilgrem commented 6 months ago

As wired-in packages are GHC boot packages, I think they should not be included directly in snapshots. I've done some spring cleaning on Stack's list.

mpilgrem commented 6 months ago

@bergmark, Stack will not create a project with the same name as a wired-in package. For example:

❯ stack new rts

Error: [S-5682]
       Stack declined to create a new directory for project rts, as
       package rts is 'wired-in' to a version of GHC. That can cause
       build errors.

       The names blocked by Stack are: base, dph-par, dph-seq, ghc,
       ghc-bignum, ghc-prim, integer-gmp, integer-simple, interactive,
       rts and template-haskell.
chreekat commented 5 months ago

Sort of related https://github.com/haskell/cabal/issues/9669

TeofilC commented 3 weeks ago

See also: https://github.com/haskell/cabal/issues/10087

GHC-9.12 is likely to not wire-in template-haskell and base.