Skip to content

Commit 170f0f4

Browse files
committed
Fix use of 'boot' file to determine workdir; apply patches in 'compile ghc --remote-source-dist'
1 parent 09f5003 commit 170f0f4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lib/GHCup/GHC.hs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -868,20 +868,23 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
868868
tmpDownload <- lift withGHCupTmpDir
869869
tmpUnpack <- lift mkGhcupTmpDir
870870
tar <- liftE $ download uri Nothing Nothing Nothing (fromGHCupPath tmpDownload) Nothing False
871-
(bf, tver) <- liftE $ cleanUpOnError @'[UnknownArchive, ArchiveResult, ProcessError] tmpUnpack $ do
871+
(workdir, tver) <- liftE $ cleanUpOnError @'[UnknownArchive, ArchiveResult, ProcessError, PatchFailed, DownloadFailed, DigestError, ContentLengthError, GPGError] tmpUnpack $ do
872872
liftE $ unpackToDir (fromGHCupPath tmpUnpack) tar
873-
let regex = [s|^(.*/)*boot$|] :: B.ByteString
874-
[bootFile] <- liftIO $ findFilesDeep
873+
874+
-- bootstrapped ghc renames boot to boot.source
875+
let regex = [s|^(.*/)*boot(.source)*$|] :: B.ByteString
876+
(boot:_) <- liftIO $ findFilesDeep
875877
tmpUnpack
876-
(makeRegexOpts compExtended
877-
execBlank
878-
regex
879-
)
880-
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer
881-
(appendGHCupPath tmpUnpack (takeDirectory bootFile))
882-
pure (bootFile, tver)
878+
(makeRegexOpts compExtended execBlank regex)
879+
880+
let workdir = appendGHCupPath tmpUnpack (takeDirectory boot)
881+
882+
lift $ logDebug $ "GHC compile workdir: " <> T.pack (fromGHCupPath workdir)
883+
884+
liftE $ applyAnyPatch patches (fromGHCupPath workdir)
883885

884-
let workdir = appendGHCupPath tmpUnpack (takeDirectory bf)
886+
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer workdir
887+
pure (workdir, tver)
885888

886889
ov <- case vps of
887890
Just vps' -> fmap Just $ expandVersionPattern tver "" "" "" "" vps'

0 commit comments

Comments
 (0)