Compare commits
1 Commits
af06fbace0
...
d82d4dbce0
Author | SHA1 | Date |
---|---|---|
Félix Baylac-Jacqué | d82d4dbce0 |
15
ReproTest.hs
15
ReproTest.hs
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue