mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-05 01:53:15 -06:00
rework cache build
This commit is contained in:
parent
4a5cae6ee1
commit
3c730fb6f1
1 changed files with 16 additions and 19 deletions
|
@ -245,31 +245,28 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
|
|||
info "nothing to build"
|
||||
quit "exiting...", QuitSuccess
|
||||
|
||||
var outs: seq[string]
|
||||
for drv in drvs:
|
||||
var cmd = "nix build"
|
||||
cmd.addArg drv
|
||||
cmd.addArg "--no-link"
|
||||
cmd.addArg "--print-out-paths"
|
||||
cmd.addArgs rest
|
||||
let buildErr = runCmd(cmd)
|
||||
if buildErr != 0:
|
||||
let (path, _, buildCode) = runCmdCapt(cmd)
|
||||
if buildCode != 0:
|
||||
error "failed to build: " & drv
|
||||
continue
|
||||
outs.add path
|
||||
# TODO: propagate errors using nix log?
|
||||
|
||||
let results = collect(
|
||||
for k, p in walkDir(".", relative = true):
|
||||
if k in { pcLinkToDir, pcLinkToFile} and p.startsWith("result"):
|
||||
p
|
||||
)
|
||||
var cmd = service
|
||||
cmd.addArg "push"
|
||||
cmd.addArg name
|
||||
cmd.addArg "--jobs"
|
||||
cmd.addArg $jobs
|
||||
cmd.addArgs outs
|
||||
let pushErr = runCmd(cmd)
|
||||
if pushErr != 0:
|
||||
errorQuit "failed to push build to cache"
|
||||
|
||||
cmd = service
|
||||
cmd.addArg "push"
|
||||
cmd.addArg name
|
||||
cmd.addArg "--jobs"
|
||||
cmd.addArg $jobs
|
||||
cmd.addArgs results
|
||||
let pushErr = runCmd(cmd)
|
||||
if pushErr != 0:
|
||||
errorQuit "failed to push build to cache"
|
||||
|
||||
for p in results:
|
||||
removeFile p
|
||||
|
||||
|
|
Loading…
Reference in a new issue