Commit 82498192 authored by Valentin Reis's avatar Valentin Reis

avoiding the presence of ./result with symlinked contents.

parent 4e810303
Pipeline #5825 passed with stage
in 1 minute and 42 seconds
......@@ -19,6 +19,7 @@ executable argonix
text,
ansi-terminal,
neat-interpolation,
process,
foldl,
system-filepath
default-language: Haskell2010
......
......@@ -11,7 +11,10 @@ License : MIT
Maintainer : fre@freux.fr
-}
module Main (main) where
module Main
( main
)
where
import Data.Default
import Turtle hiding ( header
......@@ -30,6 +33,10 @@ import System.Console.ANSI.Types ( Color )
import Turtle.Shell
import Control.Foldl
import System.Posix.Process
import qualified System.Process as P
( createProcess
, proc
)
import System.IO hiding ( FilePath )
-- | Miscellaneous printing utilities
......@@ -252,8 +259,10 @@ setupSystem sa = do
doVerbose $ printInfo "running nix-build for the containers attribute."
doVerbose $ printCommand $ "nix-build " <> pack
(unwords (nixArguments "containers" sa))
nodeos_config <- single
$ inproc "nix-build" (fmap pack (nixArguments "containers" sa ++ ["--no-out-link"])) empty
nodeos_config <- single $ inproc
"nix-build"
(fmap pack (nixArguments "containers" sa ++ ["--no-out-link"]))
empty
doVerbose $ printInfo "Checking filesystem attributes on /tmp"
checkFsAttributes "/tmp"
vshell "sudo rm -rf /tmp/argo_nodeos_config" empty
......@@ -283,10 +292,10 @@ setupSystem sa = do
case toText path of
Right p -> sh $ do
shell ("chmod 777 " <> p) empty >>= \case
ExitSuccess -> printf ("Successfully chmod" % s %"\n") p
ExitSuccess -> printf ("Successfully chmod" % s % "\n") p
ExitFailure _ -> die "failed at chmod"
shell ("ln -s " <> p <> " " <> name) empty >>= \case
ExitSuccess -> printf ("Successfully ln -s" % s %"\n") p
ExitSuccess -> printf ("Successfully ln -s" % s % "\n") p
ExitFailure _ -> die "failed at ln -s"
export "TMPDIR" p
printInfo $ format ("TMPDIR exported to " % s) p
......@@ -297,7 +306,8 @@ nixArguments target ArgsCommon {..} =
[unpack argopkgs, "-A", target]
++ concat [ ["--arg", longform <> "-src", p] | (longform, p) <- overrides ]
++ (if grafting == Libnrm then ["--arg", "graftLibnrm", "true"] else [])
++ [ "--show-trace" | verbosity == Verbose ]
++ (if v then ["-o", "/tmp/papa"] else [] ++ [ "--show-trace" | v ])
where v = verbosity == Verbose
data NixCommand = NixBuild | NixShell
toCommand :: IsString p => NixCommand -> p
......@@ -321,17 +331,15 @@ wrap nixCommand target sa@ArgsCommon {..} = sh $ do
printCommand $ pack nixc <> " " <> pack (unwords arglist)
void $ shell "echo \"TMPDIR=$TMPDIR\"" empty
void $ shell "echo \"XDG_CACHE_HOME=$XDG_CACHE_HOME\"" empty
liftIO (executeFile nixc True arglist Nothing)
liftIO $ case nixCommand of
NixShell -> executeFile nixc True arglist Nothing
NixBuild -> P.createProcess (P.proc nixc arglist)
>> P.createProcess (P.proc "cp" ["-r", "/tmp/papa", "./result"])
where
nixc = toCommand nixCommand
arglist =
nixArguments target sa
++ [ "--pure"
, "--allow-new-privileges"
, "-K"
, "--option"
, "build-use-sandbox"
]
++ ["--allow-new-privileges", "-K", "--option", "build-use-sandbox"]
++ [if sandboxing == Sandbox then "true" else "false"]
remotely :: String -> ArgsCommon -> ArgsRemote -> IO ()
......
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