Commit c0d05db8 authored by Valentin Reis's avatar Valentin Reis

fix the artifact logic.

parent 54ea6949
Pipeline #5883 passed with stages
in 1 minute and 45 seconds
......@@ -139,10 +139,10 @@ instance Default ArgsRemote where
targets :: [Text]
targets = mapMaybe toTarget nixStatic
where
toTarget (Target t) = Just t
toTarget (Target t) = Just t
toTarget (SimpleTarget t) = Just t
toTarget (Both t) = Just t
toTarget _ = Nothing
toTarget (Both t) = Just t
toTarget _ = Nothing
sources :: [Text]
sources = mapMaybe toSrc nixStatic
......@@ -175,7 +175,7 @@ nixStatic = src <> both <> simpletarget <> target
, "openmc"
, "argonix"
]
simpletarget = SimpleTarget <$> ["numabench-check" , "excit-check"]
simpletarget = SimpleTarget <$> ["numabench-check", "excit-check"]
target =
Target
<$> [ "powerexpe"
......@@ -317,7 +317,7 @@ shellVerbose verbosity s = do
readProcessVerbose :: Verbosity -> Text -> [Text] -> [(Text, Text)] -> IO Text
readProcessVerbose verbosity name arguments envVars = do
putVerbose verbosity $ name <> mconcat (intersperse " " arguments)
putVerbose verbosity $ name <> " " <> mconcat (intersperse " " arguments)
head
. T.lines
. toS
......@@ -332,7 +332,7 @@ readProcessVerbose verbosity name arguments envVars = do
runProcessVerbose :: Verbosity -> Text -> [Text] -> [(Text, Text)] -> IO ()
runProcessVerbose a b c d = void $ readProcessVerbose a b c d
setupSystem :: Text -> ArgsCommon -> IO ([(Text, Text)],Text)
setupSystem :: Text -> ArgsCommon -> IO ([(Text, Text)], Text)
setupSystem target sa = do
sVerbose "sudo rm -rf result" >>= \case
......@@ -347,12 +347,10 @@ setupSystem target sa = do
["-d", "/tmp/deletable-nix-cache-XXXX"]
[]
varTMPDIR <- rpVerbose "mktemp"
["-d", "/tmp/tmpdir-XXXX"]
[]
varTMPDIR <- rpVerbose "mktemp" ["-d", "/tmp/tmpdir-XXXX"] []
sVerbose $ "chmod 777 " <> varTMPDIR
passVars <- getVars ["PATH", "NIX_PATH", "NIX_SSL_CERT_FILE"]
passVars <- getVars ["PATH", "NIX_PATH", "NIX_SSL_CERT_FILE"]
let envVars =
[("XDG_CACHE_HOME", varXDG_CACHE_HOME), ("TMPDIR", varTMPDIR)]
......@@ -360,7 +358,7 @@ setupSystem target sa = do
when (isTarget target) $ setupNodeOs envVars
return (envVars,varXDG_CACHE_HOME)
return (envVars, varXDG_CACHE_HOME)
where
getVars :: [Text] -> IO [(Text, Text)]
getVars vars = catMaybes <$> mapM maybeGet vars
......@@ -411,18 +409,24 @@ nixArguments target ArgsCommon {..} =
wrap :: NixCommand -> Text -> ArgsCommon -> IO ()
wrap nixCommand target sa@ArgsCommon {..} = do
when (verbosity == Verbose) $ print sa
(envVars,tmpXDGHOME) <- setupSystem target sa
(envVars, tmpXDGHOME) <- setupSystem target sa
putText $ nixc <> " " <> T.unwords arglist
case nixCommand of
NixShell -> executeFile (toS nixc) True (fmap toS arglist) Nothing
NixBuild -> do
_ <- P.runProcess
NixBuild ->
P.runProcess
(P.setEnv (fmap (\(x, y) -> (toS x, toS y)) envVars)
(P.proc (toS nixc) $ fmap toS arglist)
)
runProcessVerbose verbosity "cp" ["-r", "/tmp/papa", "./result"] []
runProcessVerbose verbosity "cp" ["-r", toS tmpXDGHOME, "./nixtmpdir"] []
>>= \case
ExitSuccess -> copySuccess "/tmp/papa"
ExitFailure _ -> copyFailure $ toS tmpXDGHOME
where
copySuccess source =
runProcessVerbose verbosity "cp" ["-r", source, "./result"] []
copyFailure source =
runProcessVerbose verbosity "cp" ["-r", source, "./nixtmpdir"] []
nixc = toCommand nixCommand
arglist =
nixArguments target sa
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment