Commit 23781aae authored by Valentin Reis's avatar Valentin Reis
Browse files

verbosity management

parent 3e55ab18
Pipeline #5479 passed with stage
in 1 minute and 26 seconds
......@@ -35,8 +35,8 @@ import System.IO hiding ( FilePath )
colorShell :: Color -> Shell () -> Shell ()
colorShell color she = setC color *> she *> setC White
where setC c = liftIO $ setSGR [SetColor Foreground Dull c]
verboseShell :: Text -> Shell Line -> Shell ExitCode
verboseShell c i = printCommand c >> shell c i
verboseShell :: Bool -> Text -> Shell Line -> Shell ExitCode
verboseShell v c i = when v (printCommand c) >> shell c i
printInfo :: Text -> Shell ()
printCommand :: Text -> Shell ()
printError :: Text -> Shell ()
......@@ -247,29 +247,29 @@ setupSystem sa = do
$ inproc "nix-build" (fmap pack (nixArguments "containers" sa)) empty
printInfo "Checking filesystem attributes on /tmp"
checkFsAttributes "/tmp"
verboseShell "sudo rm -rf /tmp/argo_nodeos_config" empty
verboseShell
vshell "sudo rm -rf /tmp/argo_nodeos_config" empty
vshell
(format ("cp " % s % "/bin/argo_nodeos_config /tmp/argo_nodeos_config")
(lineToText nodeos_config)
)
empty
verboseShell "sudo chown root:root /tmp/argo_nodeos_config" empty >>= \case
vshell "sudo chown root:root /tmp/argo_nodeos_config" empty >>= \case
ExitSuccess -> return ()
ExitFailure n ->
die ("Failed to set argo_nodeos_config permissions " <> repr n)
verboseShell "sudo chmod u+sw /tmp/argo_nodeos_config" empty >>= \case
vshell "sudo chmod u+sw /tmp/argo_nodeos_config" empty >>= \case
ExitSuccess -> return ()
ExitFailure n -> die ("Setting suid bit failed with exit code " <> repr n)
verboseShell "sudo /tmp/argo_nodeos_config --clean_config=kill_content:true"
empty
vshell "sudo /tmp/argo_nodeos_config --clean_config=kill_content:true" empty
void $ printInfo "Done setting the environment for nix-build up."
where vshell = verboseShell (verbosity sa == Verbose)
nixArguments :: String -> ArgsCommon -> [String]
nixArguments target ArgsCommon {..} =
[unpack argopkgs, "-A", target]
++ concat [ ["--arg", longform <> "-src", p] | (longform, p) <- overrides ]
++ (if grafting == Libnrm then ["--arg", "rebuildApps", "false"] else [])
++ ["--show-trace" | verbosity == Verbose]
++ [ "--show-trace" | verbosity == Verbose ]
data NixCommand = NixBuild | NixShell
toCommand :: IsString p => NixCommand -> p
......
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