-
Notifications
You must be signed in to change notification settings - Fork 92
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
Don't ignore ghc compile bootstrap error, fix --remote-source-dist #1172
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -868,20 +868,26 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs | |
tmpDownload <- lift withGHCupTmpDir | ||
tmpUnpack <- lift mkGhcupTmpDir | ||
tar <- liftE $ download uri Nothing Nothing Nothing (fromGHCupPath tmpDownload) Nothing False | ||
(bf, tver) <- liftE $ cleanUpOnError @'[UnknownArchive, ArchiveResult, ProcessError] tmpUnpack $ do | ||
(workdir, tver) <- liftE $ cleanUpOnError @'[UnknownArchive, ArchiveResult, ProcessError, PatchFailed, DownloadFailed, DigestError, ContentLengthError, GPGError, NotFoundInPATH] tmpUnpack $ do | ||
liftE $ unpackToDir (fromGHCupPath tmpUnpack) tar | ||
let regex = [s|^(.*/)*boot$|] :: B.ByteString | ||
[bootFile] <- liftIO $ findFilesDeep | ||
|
||
-- bootstrapped ghc renames boot to boot.source | ||
let regex = [s|^(.*/)*boot(.source)*$|] :: B.ByteString | ||
(boot:_) <- liftIO $ findFilesDeep | ||
tmpUnpack | ||
(makeRegexOpts compExtended | ||
execBlank | ||
regex | ||
) | ||
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer | ||
(appendGHCupPath tmpUnpack (takeDirectory bootFile)) | ||
pure (bootFile, tver) | ||
(makeRegexOpts compExtended execBlank regex) | ||
|
||
let workdir = appendGHCupPath tmpUnpack (takeDirectory boot) | ||
|
||
lift $ logDebug $ "GHC compile workdir: " <> T.pack (fromGHCupPath workdir) | ||
|
||
liftE $ applyAnyPatch patches (fromGHCupPath workdir) | ||
|
||
-- bootstrap, if necessary | ||
liftE $ bootAndGenVersion workdir | ||
|
||
let workdir = appendGHCupPath tmpUnpack (takeDirectory bf) | ||
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer workdir | ||
pure (workdir, tver) | ||
|
||
ov <- case vps of | ||
Just vps' -> fmap Just $ expandVersionPattern tver "" "" "" "" vps' | ||
|
@@ -934,6 +940,8 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs | |
liftE $ applyAnyPatch patches (fromGHCupPath tmpUnpack) | ||
|
||
-- bootstrap | ||
liftE $ bootAndGenVersion tmpUnpack | ||
|
||
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer | ||
tmpUnpack | ||
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform (fromGHCupPath tmpUnpack) | ||
|
@@ -1035,6 +1043,24 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs | |
pure installVer | ||
|
||
where | ||
bootAndGenVersion :: ( MonadReader env m | ||
, HasSettings env | ||
, HasDirs env | ||
, HasLog env | ||
, MonadIO m | ||
, MonadThrow m | ||
) | ||
=> GHCupPath | ||
-> Excepts '[ProcessError, NotFoundInPATH] m () | ||
bootAndGenVersion tmpUnpack = do | ||
let bootFile = fromGHCupPath tmpUnpack </> "boot" | ||
hasBootFile <- liftIO $ doesFileExist bootFile | ||
when hasBootFile $ do | ||
lift $ logDebug "Doing ghc-bootstrap" | ||
lEM $ execLogged "python3" ["./boot"] (Just $ fromGHCupPath tmpUnpack) "ghc-bootstrap" Nothing | ||
-- This configure is to generate VERSION file | ||
liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) "ghc-bootstrap" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this belong outside of See GHCs
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, in that case it does belong here, as the bootstrapped ghc will contain the VERSION file. |
||
|
||
getGHCVer :: ( MonadReader env m | ||
, HasSettings env | ||
, HasDirs env | ||
|
@@ -1045,8 +1071,6 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs | |
=> GHCupPath | ||
-> Excepts '[ProcessError, ParseError, NotFoundInPATH] m Version | ||
getGHCVer tmpUnpack = do | ||
lEM $ execLogged "python3" ["./boot"] (Just $ fromGHCupPath tmpUnpack) "ghc-bootstrap" Nothing | ||
liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) "ghc-bootstrap" | ||
let versionFile = fromGHCupPath tmpUnpack </> "VERSION" | ||
hasVersionFile <- liftIO $ doesFileExist versionFile | ||
if hasVersionFile | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. As in: if we have booted, does it mean there is always a
VERSION
file? From what I understand one has to run configure too.@bgamari @AndreasPK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
boot
file is being renamed toboot.source
when doinghadrian build source-dist
, so this is a scenario different from simply bootstrapped ghc. And as part of thisbuild source-dist
theVERSION
is always being copied.ref: https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/src/Rules/SourceDist.hs#L123-143