mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 14:20:44 -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"
|
info "nothing to build"
|
||||||
quit "exiting...", QuitSuccess
|
quit "exiting...", QuitSuccess
|
||||||
|
|
||||||
|
var outs: seq[string]
|
||||||
for drv in drvs:
|
for drv in drvs:
|
||||||
var cmd = "nix build"
|
var cmd = "nix build"
|
||||||
cmd.addArg drv
|
cmd.addArg drv
|
||||||
|
cmd.addArg "--no-link"
|
||||||
|
cmd.addArg "--print-out-paths"
|
||||||
cmd.addArgs rest
|
cmd.addArgs rest
|
||||||
let buildErr = runCmd(cmd)
|
let (path, _, buildCode) = runCmdCapt(cmd)
|
||||||
if buildErr != 0:
|
if buildCode != 0:
|
||||||
error "failed to build: " & drv
|
error "failed to build: " & drv
|
||||||
continue
|
continue
|
||||||
|
outs.add path
|
||||||
|
# TODO: propagate errors using nix log?
|
||||||
|
|
||||||
let results = collect(
|
var cmd = service
|
||||||
for k, p in walkDir(".", relative = true):
|
|
||||||
if k in { pcLinkToDir, pcLinkToFile} and p.startsWith("result"):
|
|
||||||
p
|
|
||||||
)
|
|
||||||
|
|
||||||
cmd = service
|
|
||||||
cmd.addArg "push"
|
cmd.addArg "push"
|
||||||
cmd.addArg name
|
cmd.addArg name
|
||||||
cmd.addArg "--jobs"
|
cmd.addArg "--jobs"
|
||||||
cmd.addArg $jobs
|
cmd.addArg $jobs
|
||||||
cmd.addArgs results
|
cmd.addArgs outs
|
||||||
let pushErr = runCmd(cmd)
|
let pushErr = runCmd(cmd)
|
||||||
if pushErr != 0:
|
if pushErr != 0:
|
||||||
errorQuit "failed to push build to cache"
|
errorQuit "failed to push build to cache"
|
||||||
|
|
||||||
for p in results:
|
|
||||||
removeFile p
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue