Skip to content

Add with-compiler to snapshot's cabal.config file #313

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

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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