Skip to content

Commit

Permalink
Merge pull request #313 from andreabedini/with-compiler
Browse files Browse the repository at this point in the history
Add with-compiler to snapshot's cabal.config file
  • Loading branch information
snoyberg authored Jun 9, 2022
2 parents be614d4 + ab379c6 commit e37596e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Handler/StackageHome.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Handler.StackageHome
) where

import Data.These
import RIO (textDisplay)
import RIO.Time (FormatTime)
import Import
import Stackage.Database
Expand Down Expand Up @@ -65,7 +66,7 @@ getStackageDiffR name1 name2 = track "Handler.StackageHome.getStackageDiffR" $ d
getStackageCabalConfigR :: SnapName -> Handler TypedContent
getStackageCabalConfigR name = track "Handler.StackageHome.getStackageCabalConfigR" $ do
cacheSeconds $ 60 * 60 * 48
Entity sid _ <- lookupSnapshot name >>= maybe notFound return
Entity sid snapshot <- lookupSnapshot name >>= maybe notFound return
render <- getUrlRender

mdownload <- lookupGetParam "download"
Expand All @@ -79,16 +80,18 @@ getStackageCabalConfigR name = track "Handler.StackageHome.getStackageCabalConfi

respondSource typePlain $ yieldMany plis .|
if isGlobal
then conduitGlobal render
else conduitLocal render
then conduitGlobal (snapshotCompiler snapshot) render
else conduitLocal (snapshotCompiler snapshot) render
where
-- FIXME move this stuff into stackage-common
conduitGlobal render = do
conduitGlobal compiler render = do
headerGlobal render
compilerVersion compiler
mapC (Chunk . showPackageGlobal)

conduitLocal render = do
conduitLocal compiler render = do
headerLocal render
compilerVersion compiler
goFirst
mapC (Chunk . showPackageLocal)
yield $ Chunk $ toBuilder '\n'
Expand Down Expand Up @@ -116,6 +119,11 @@ getStackageCabalConfigR name = track "Handler.StackageHome.getStackageCabalConfi
toBuilder (snapshotUrl render) ++
toBuilder '\n'

compilerVersion compiler = yield $ Chunk $
toBuilder (asText "with-compiler: ") ++
toBuilder (textDisplay compiler) ++
toBuilder '\n'

oldSnapshotUrl render = asHttp $ render $ OldSnapshotR (toPathPiece name) []
snapshotUrl render = asHttp $ render $ SnapshotR name StackageHomeR

Expand Down

0 comments on commit e37596e

Please sign in to comment.