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

Keep going when submodule sdist fails #115

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 9 additions & 4 deletions src/Mafia/Cabal/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Control.Monad.IO.Class (MonadIO(..))
import qualified Data.List as List
import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Data.Text.IO as T

import Mafia.Cabal.Types
import Mafia.Hash
Expand All @@ -32,9 +33,9 @@ import Mafia.Process

import P

import System.IO (IO)
import System.IO (IO, stderr)

import X.Control.Monad.Trans.Either (EitherT, left)
import X.Control.Monad.Trans.Either (EitherT, left, runEitherT)

------------------------------------------------------------------------

Expand Down Expand Up @@ -128,8 +129,12 @@ getSourcePackage dir = do
case mpid of
Nothing -> return Nothing -- no .cabal file found
Just pid -> do
hash <- hashSourcePackage dir
return (Just (SourcePackage dir pid (sphHash hash)))
-- not necessarily fatal if a package can't be hashed. log it, though
hash <- liftIO $ runEitherT (hashSourcePackage dir)
either
(\e -> liftIO (T.hPutStrLn stderr (renderCabalError e)) *> pure Nothing)
(pure . Just . SourcePackage dir pid . sphHash)
hash

------------------------------------------------------------------------

Expand Down