Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
argonix
Commits
11f8a6b2
Commit
11f8a6b2
authored
Feb 28, 2019
by
Valentin Reis
Browse files
Should resolve TMPDIR issues
parent
55499ff0
Pipeline
#5735
passed with stage
in 1 minute and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Argonix.hs
View file @
11f8a6b2
...
...
@@ -233,30 +233,28 @@ sudoRemoveFile printer desc filePath = do
cleanSocket
::
FilePath
->
Shell
()
cleanSocket
=
sudoRemoveFile
printWarning
"socket"
socketList
::
[
FilePath
]
socketList
=
[
"/tmp/nrm-downstream-in"
,
"/tmp/nrm-downstream-event"
,
"/tmp/nrm-upstream-in"
,
"/tmp/nrm-upstream-event"
]
setupSystem
::
ArgsCommon
->
Shell
()
setupSystem
sa
=
do
doVerbose
$
printInfo
"Setting the nix-build environment up."
doVerbose
$
printInfo
"Cleaning sockets."
Prelude
.
mapM_
cleanSocket
[
"/tmp/nrm-downstream-in"
,
"/tmp/nrm-downstream-event"
,
"/tmp/nrm-upstream-in"
,
"/tmp/nrm-upstream-event"
]
Prelude
.
mapM_
cleanSocket
socketList
doVerbose
$
printInfo
"Setting up a cache directory:"
cachedir
<-
single
$
inproc
"mktemp"
[
"-d"
,
"/tmp/deletable-nix-cache-XXXX"
]
empty
export
"XDG_CACHE_HOME"
$
lineToText
cachedir
doVerbose
$
printInfo
$
lineToText
cachedir
<>
" exported to XDG_CACHE_HOME"
inproc
"rm"
[
"-rf"
,
"./nixtmpdir"
]
empty
inproc
"mkdir"
[
"-p"
,
"./nixtmpdir"
]
empty
export
"TMPDIR"
"./nixtmpdir/"
doVerbose
$
printInfo
$
lineToText
cachedir
<>
" exported to XDG_CACHE_HOME"
liftIO
$
createAndSetTMPDIR
"./nixtmpdir"
vshell
"sudo rm -rf result"
empty
>>=
\
case
ExitSuccess
->
printInfo
"removed ./result"
ExitFailure
n
->
die
(
"Failed to remove ./result "
<>
repr
n
)
ExitSuccess
->
printInfo
"removed ./result"
ExitFailure
n
->
die
(
"Failed to remove ./result "
<>
repr
n
)
doVerbose
$
printInfo
"running nix-build for the containers attribute."
doVerbose
$
printCommand
$
"nix-build "
<>
pack
(
unwords
(
nixArguments
"containers"
sa
))
...
...
@@ -283,6 +281,14 @@ setupSystem sa = do
vshell
=
verboseShell
verbose
verbose
=
verbosity
sa
==
Verbose
doVerbose
=
when
verbose
createAndSetTMPDIR
name
=
do
path
<-
(
</>
fromText
name
)
<$>
pwd
b
<-
testpath
path
when
b
$
rmtree
path
mkdir
path
case
toText
path
of
Right
p
->
export
"TMPDIR"
p
Left
_
->
die
"Path error when setting TMPDIR"
nixArguments
::
String
->
ArgsCommon
->
[
String
]
nixArguments
target
ArgsCommon
{
..
}
=
...
...
@@ -300,6 +306,7 @@ wrap :: NixCommand -> String -> ArgsCommon -> IO ()
wrap
nixCommand
target
sa
@
ArgsCommon
{
..
}
=
sh
$
do
when
(
verbosity
==
Verbose
)
$
liftIO
$
print
sa
_
<-
setupSystem
sa
printf
"toto"
printCommand
$
pack
nixc
<>
" "
<>
pack
(
unwords
arglist
)
liftIO
(
executeFile
nixc
True
arglist
Nothing
)
where
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment