From 46694f2f90de3aff8c089f63a00cf41276dadec9 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Mon, 11 Feb 2008 14:59:02 -0600 Subject: [PATCH] builder: move to build-loop model --- extra/builder/builder.factor | 46 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index a17afb9d55..bb83fcf3f8 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -1,5 +1,5 @@ -USING: kernel io io.files io.launcher io.sockets hashtables +USING: kernel io io.files io.launcher io.sockets hashtables math threads system continuations namespaces sequences splitting math.parser prettyprint tools.time calendar bake vars http.client combinators bootstrap.image bootstrap.image.download @@ -95,9 +95,10 @@ VAR: stamp stamp> make-directory stamp> cd ; -: record-git-id ( -- ) - { "git" "show" } [ readln ] with-stream " " split second - "../git-id" log-object ; +: git-id ( -- id ) + { "git" "show" } [ readln ] with-stream " " split second ; + +: record-git-id ( -- ) git-id "../git-id" log-object ; : make-clean ( -- desc ) { "make" "clean" } ; @@ -113,7 +114,8 @@ VAR: stamp [ my-arch download-image ] [ ] [ "builder: image download" email-string ] - cleanup ; + cleanup + flush ; : bootstrap ( -- desc ) `{ @@ -135,12 +137,6 @@ SYMBOL: build-status : build ( -- ) - "running" build-status set-global - - "/builds/factor" cd - - git-pull "git pull error" run-or-notify - enter-build-dir git-clone "git clone error" run-or-notify @@ -165,10 +161,30 @@ SYMBOL: build-status "../failing-tests" exists? [ "failing tests" "../failing-tests" email-file ] - when - - "ready" build-status set-global ; + when ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -MAIN: build \ No newline at end of file +: minutes>ms ( min -- ms ) 60 * 1000 * ; + +: updates-available? ( -- ? ) + git-id + git-pull run-process drop + git-id + = not ; + +: build-loop ( -- ) + [ + "/builds/factor" cd + updates-available? + [ build ] + when + ] + [ drop ] + recover + 5 minutes>ms sleep + build-loop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MAIN: build-loop \ No newline at end of file