Skip to content
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

Continue building after failing to install build-tool #209

Merged
merged 1 commit into from
Mar 9, 2018
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
20 changes: 18 additions & 2 deletions src/Mafia/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,28 @@ installBuildTools :: CacheEnv -> Set BuildTool -> EitherT InstallError IO [Direc
installBuildTools env tools = do
pkgs <-
for (Set.toList tools) $ \(BuildTool name constraints) ->
installPackage name constraints
tryInstall name constraints

pure .
fmap (</> "bin") .
fmap (packageSandboxDir env) $
fmap pkgKey pkgs
fmap pkgKey $
catMaybes pkgs
where
-- Some packages refer to build-tools that are not cabal packages.
-- For example, "zip-archive" depends on "unzip", but this is talking about a binary, not a cabal package.
-- This is unfortunate, and perhaps the package shouldn't include this as it isn't a build tool, but we should probably provide some way to continue building regardless.
tryInstall name constraints = EitherT $ do
r <- runEitherT $ installPackage name constraints
case r of
Left e -> do
T.hPutStrLn stderr $
"Error while trying to install build tool '" <> unPackageName name <> "': "
T.hPutStrLn stderr $ renderInstallError e
T.hPutStrLn stderr "Trying to continue anyway, as some packages refer to non-existent build tools."
return $ Right Nothing
Right pkg -> do
return $ Right $ Just pkg

-- | Detect the build tools required by a package.
detectBuildTools :: Package -> EitherT InstallError IO (Set BuildTool)
Expand Down