Compare commits

..

1 Commits

Author SHA1 Message Date
Félix Baylac-Jacqué d82d4dbce0
Add Haskell script trying to reproduce the build
We add a Haskell script in charge of reproducing the build.
2020-05-26 13:04:58 +02:00
1 changed files with 6 additions and 9 deletions

View File

@ -20,20 +20,21 @@ import System.Process
data Config = Config
{ pkgName :: Text,
ghcPath :: Text }
data ReproStatus = ReproStatus IsReproducible ReproPaths
type IsReproducible = Bool
type ReproPaths = [Text]
type StorePath = Text
type NixError = Text
type ReproStatus = Maybe ReproPaths
main :: IO ()
main = do
c <- execParser opts
rs <- runExceptT $ repro c
case rs of
Left err -> T.putStr err >> exitFailure
Right Nothing -> T.putStr "SUCCESS" >> exitSuccess
Right (Just rp) -> T.putStr $ "Cannot Reproduce build:\n" <> unwords rp
Left err -> T.putStrLn err >> exitFailure
Right (ReproStatus True xs) -> T.putStrLn "SUCCESS" >> exitSuccess
Right (ReproStatus False xs) -> T.putStr $ "Cannot Reproduce build:\n" <> unwords xs
where
opts = info (configParser <**> helper)
( fullDesc
@ -61,11 +62,7 @@ repro c = do
(ecr2, p2) <- streamRunCmd "nix-store"
["--realise", "--quiet", "-K", "--check", drvPath] False
-- 4. If exit code > 1 => Just two repro paths
if ecr2 == E.ExitSuccess
then pure Nothing
else pure $ Just [ p1, p2 ]
pure $ ReproStatus (ecr2 == E.ExitSuccess) [p1, p2]
runDiffoscope :: ReproPaths -> IO StorePath
runDiffoscope = undefined