mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-01-22 07:07:32 -06:00
make duration more readable
This commit is contained in:
parent
00c93702ad
commit
d49948eae3
1 changed files with 14 additions and 8 deletions
|
@ -324,7 +324,13 @@ type
|
||||||
duration*: Duration
|
duration*: Duration
|
||||||
successful*: bool
|
successful*: bool
|
||||||
|
|
||||||
|
func formatDuration(d: Duration): string =
|
||||||
|
## convert duration to: X minutes and Y seconds
|
||||||
|
let seconds = d.inSeconds
|
||||||
|
if seconds > 60:
|
||||||
|
result.add $(seconds div 60) & " minutes"
|
||||||
|
result.add " and "
|
||||||
|
result.add $(seconds mod 60) & " seconds"
|
||||||
|
|
||||||
proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
||||||
let startTime = now()
|
let startTime = now()
|
||||||
|
@ -337,7 +343,7 @@ proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
||||||
result.duration = now() - startTime
|
result.duration = now() - startTime
|
||||||
# TODO: make splitDrv more ergonmic?
|
# TODO: make splitDrv more ergonmic?
|
||||||
info "succesfully built: " & splitDrv(drv.name).name
|
info "succesfully built: " & splitDrv(drv.name).name
|
||||||
info "-> duration: " & $result.duration
|
info "-> duration: " & formatDuration(result.duration)
|
||||||
|
|
||||||
func outputsPaths(o: OizysDerivation): seq[string] =
|
func outputsPaths(o: OizysDerivation): seq[string] =
|
||||||
for _, output in o.drv.outputs:
|
for _, output in o.drv.outputs:
|
||||||
|
@ -403,12 +409,12 @@ proc getUpdatedLockFile() =
|
||||||
|
|
||||||
# probably duplicating logic above ¯\_(ツ)_/¯
|
# probably duplicating logic above ¯\_(ツ)_/¯
|
||||||
proc buildSystem(host: string, rest: seq[string]) =
|
proc buildSystem(host: string, rest: seq[string]) =
|
||||||
var cmd = nixCommand("build")
|
var cmd = nixCommand("build")
|
||||||
cmd.addArg nixosConfigAttr(host)
|
cmd.addArg nixosConfigAttr(host)
|
||||||
cmd.addArgs rest
|
cmd.addArgs rest
|
||||||
let code = runCmd cmd
|
let code = runCmd cmd
|
||||||
if code != 0:
|
if code != 0:
|
||||||
fatalQuit "build failed"
|
fatalQuit "build failed"
|
||||||
|
|
||||||
proc ciUpdate*(rest: seq[string]) =
|
proc ciUpdate*(rest: seq[string]) =
|
||||||
for host in getHosts():
|
for host in getHosts():
|
||||||
|
|
Loading…
Reference in a new issue