clean results before copying them from Nix store
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
4e7c7c254b
commit
7c7eb0ba3d
|
@ -59,7 +59,7 @@ def build(Map opts = [:]) {
|
||||||
opts.args = defaults.args + opts.args
|
opts.args = defaults.args + opts.args
|
||||||
opts.keep = (opts.keep + defaults.keep).unique()
|
opts.keep = (opts.keep + defaults.keep).unique()
|
||||||
|
|
||||||
def resultPath = sh(
|
def nixPath = sh(
|
||||||
returnStdout: true,
|
returnStdout: true,
|
||||||
script: """
|
script: """
|
||||||
set +x
|
set +x
|
||||||
|
@ -68,10 +68,19 @@ def build(Map opts = [:]) {
|
||||||
nix-build ${_getNixCommandArgs(opts, false)}
|
nix-build ${_getNixCommandArgs(opts, false)}
|
||||||
"""
|
"""
|
||||||
).trim()
|
).trim()
|
||||||
if (!opts.link) { /* if not linking, copy results */
|
/* if not linking, copy results, but only if there's just one path */
|
||||||
sh "cp ${resultPath}/* ${env.WORKSPACE}/result/"
|
if (!opts.link && nixPath && !nixPath.contains('\n')) {
|
||||||
|
copyResults(nixPath)
|
||||||
}
|
}
|
||||||
return resultPath
|
return nixPath
|
||||||
|
}
|
||||||
|
|
||||||
|
private def copyResults(path) {
|
||||||
|
def resultsPath = "${env.WORKSPACE}/result"
|
||||||
|
sh "rm -fr ${resultsPath}"
|
||||||
|
sh "mkdir -p ${resultsPath}"
|
||||||
|
sh "cp -fr ${path}/* ${resultsPath}/"
|
||||||
|
sh "chmod -R 755 ${resultsPath}"
|
||||||
}
|
}
|
||||||
|
|
||||||
private makeNixBuildEnvFile(Map opts = [:]) {
|
private makeNixBuildEnvFile(Map opts = [:]) {
|
||||||
|
|
Loading…
Reference in New Issue