2008-01-31 01:25:06 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
USING: kernel io io.files io.launcher io.sockets hashtables
|
2008-02-04 22:26:59 -05:00
|
|
|
system continuations namespaces sequences splitting math.parser
|
2008-02-04 22:58:57 -05:00
|
|
|
prettyprint tools.time calendar bake vars http.client
|
2008-02-10 02:04:14 -05:00
|
|
|
combinators bootstrap.image bootstrap.image.download
|
|
|
|
combinators.cleave ;
|
2008-01-31 01:25:06 -05:00
|
|
|
|
|
|
|
IN: builder
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-06 05:26:13 -05:00
|
|
|
: runtime ( quot -- time ) benchmark nip ;
|
|
|
|
|
|
|
|
: log-runtime ( quot file -- )
|
|
|
|
>r runtime r> <file-writer> [ . ] with-stream ;
|
|
|
|
|
|
|
|
: log-object ( object file -- ) <file-writer> [ . ] with-stream ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-01-31 01:25:06 -05:00
|
|
|
: datestamp ( -- string )
|
|
|
|
now `{ ,[ dup timestamp-year ]
|
2008-02-02 01:29:47 -05:00
|
|
|
,[ dup timestamp-month ]
|
|
|
|
,[ dup timestamp-day ]
|
|
|
|
,[ dup timestamp-hour ]
|
|
|
|
,[ timestamp-minute ] }
|
2008-02-05 00:48:18 -05:00
|
|
|
[ pad-00 ] map "-" join ;
|
2008-01-31 01:25:06 -05:00
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
SYMBOL: builder-recipients
|
|
|
|
|
2008-02-10 04:01:20 -05:00
|
|
|
: host-name* ( -- name ) host-name "." split first ;
|
|
|
|
|
|
|
|
: tag-subject ( str -- str ) `{ "builder@" ,[ host-name* ] ": " , } concat ;
|
2008-02-10 02:04:14 -05:00
|
|
|
|
|
|
|
: email-string ( subject -- )
|
|
|
|
`{ "mutt" "-s" ,[ tag-subject ] %[ builder-recipients get ] }
|
|
|
|
[ ] with-process-stream drop ;
|
|
|
|
|
2008-01-31 01:25:06 -05:00
|
|
|
: email-file ( subject file -- )
|
|
|
|
`{
|
2008-02-04 22:26:59 -05:00
|
|
|
{ +stdin+ , }
|
2008-02-10 02:04:14 -05:00
|
|
|
{ +arguments+
|
|
|
|
{ "mutt" "-s" ,[ tag-subject ] %[ builder-recipients get ] } }
|
2008-02-04 22:26:59 -05:00
|
|
|
}
|
|
|
|
>hashtable run-process drop ;
|
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
: run-or-notify ( desc message -- )
|
|
|
|
[ [ try-process ] curry ]
|
|
|
|
[ [ email-string throw ] curry ]
|
|
|
|
bi*
|
|
|
|
recover ;
|
|
|
|
|
|
|
|
: run-or-send-file ( desc message file -- )
|
|
|
|
>r >r [ try-process ] curry
|
2008-02-10 04:05:34 -05:00
|
|
|
r> r> [ email-file throw ] 2curry
|
2008-02-10 02:04:14 -05:00
|
|
|
recover ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-01-31 01:25:06 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-06 00:09:33 -05:00
|
|
|
: target ( -- target ) `{ ,[ os ] %[ cpu "." split ] } "-" join ;
|
2008-02-05 19:28:05 -05:00
|
|
|
|
2008-01-31 01:25:06 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-04 22:58:57 -05:00
|
|
|
: factor-binary ( -- name )
|
|
|
|
os
|
|
|
|
{ { "macosx" [ "./Factor.app/Contents/MacOS/factor" ] }
|
2008-02-06 00:09:33 -05:00
|
|
|
{ "winnt" [ "./factor-nt.exe" ] }
|
2008-02-04 22:58:57 -05:00
|
|
|
[ drop "./factor" ] }
|
|
|
|
case ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-01-31 01:25:06 -05:00
|
|
|
VAR: stamp
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: git-pull ( -- desc )
|
2008-02-06 00:09:33 -05:00
|
|
|
{
|
|
|
|
"git"
|
|
|
|
"pull"
|
|
|
|
"--no-summary"
|
2008-02-07 16:14:40 -05:00
|
|
|
"git://factorcode.org/git/factor.git"
|
2008-02-06 00:09:33 -05:00
|
|
|
"master"
|
2008-02-10 02:04:14 -05:00
|
|
|
} ;
|
2008-02-07 19:30:20 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: git-clone ( -- desc ) { "git" "clone" "../factor" } ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: enter-build-dir ( -- )
|
|
|
|
datestamp >stamp
|
|
|
|
"/builds" cd
|
|
|
|
stamp> make-directory
|
|
|
|
stamp> cd ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: record-git-id ( -- )
|
2008-02-06 05:26:13 -05:00
|
|
|
{ "git" "show" } <process-stream> [ readln ] with-stream " " split second
|
2008-02-10 02:04:14 -05:00
|
|
|
"../git-id" log-object ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: make-clean ( -- desc ) { "make" "clean" } ;
|
2008-02-08 21:09:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: make-vm ( -- )
|
2008-02-04 22:26:59 -05:00
|
|
|
`{
|
|
|
|
{ +arguments+ { "make" ,[ target ] } }
|
|
|
|
{ +stdout+ "../compile-log" }
|
|
|
|
{ +stderr+ +stdout+ }
|
|
|
|
}
|
2008-02-10 02:04:14 -05:00
|
|
|
>hashtable ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: retrieve-boot-image ( -- )
|
2008-02-07 20:50:26 -05:00
|
|
|
[ my-arch download-image ]
|
|
|
|
[ ]
|
2008-02-04 22:26:59 -05:00
|
|
|
[ "builder: image download" email-string ]
|
2008-02-10 02:04:14 -05:00
|
|
|
cleanup ;
|
2008-02-08 21:09:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: bootstrap ( -- desc )
|
2008-02-04 22:26:59 -05:00
|
|
|
`{
|
|
|
|
{ +arguments+ {
|
2008-02-04 22:58:57 -05:00
|
|
|
,[ factor-binary ]
|
2008-02-07 20:50:26 -05:00
|
|
|
,[ "-i=" my-boot-image-name append ]
|
2008-02-04 22:26:59 -05:00
|
|
|
"-no-user-init"
|
|
|
|
} }
|
|
|
|
{ +stdout+ "../boot-log" }
|
|
|
|
{ +stderr+ +stdout+ }
|
|
|
|
}
|
2008-02-10 02:04:14 -05:00
|
|
|
>hashtable ;
|
2008-02-04 22:26:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
: builder-test ( -- desc ) `{ ,[ factor-binary ] "-run=builder.test" } ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
2008-02-08 21:09:59 -05:00
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
"factor" cd
|
|
|
|
|
|
|
|
record-git-id
|
|
|
|
|
|
|
|
make-clean "make clean error" run-or-notify
|
|
|
|
|
|
|
|
make-vm "vm compile error" "../compile-log" run-or-send-file
|
|
|
|
|
|
|
|
retrieve-boot-image
|
|
|
|
|
|
|
|
bootstrap "bootstrap error" "../boot-log" run-or-send-file
|
|
|
|
|
|
|
|
builder-test "builder.test fatal error" run-or-notify
|
2008-02-06 05:26:13 -05:00
|
|
|
|
2008-02-06 00:09:33 -05:00
|
|
|
"../load-everything-log" exists?
|
2008-02-10 04:01:20 -05:00
|
|
|
[ "load-everything" "../load-everything-log" email-file ]
|
2008-02-06 00:09:33 -05:00
|
|
|
when
|
|
|
|
|
2008-02-06 05:26:13 -05:00
|
|
|
"../failing-tests" exists?
|
2008-02-10 04:01:20 -05:00
|
|
|
[ "failing tests" "../failing-tests" email-file ]
|
2008-02-06 05:26:13 -05:00
|
|
|
when
|
|
|
|
|
2008-02-10 02:04:14 -05:00
|
|
|
"ready" build-status set-global ;
|
2008-01-31 01:25:06 -05:00
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
MAIN: build
|