factor/extra/builder/builder.factor

157 lines
4.0 KiB
Factor
Raw Normal View History

2008-01-31 01:25:06 -05:00
2008-02-12 01:15:20 -05:00
USING: kernel parser io io.files io.launcher io.sockets hashtables math threads
2008-02-12 05:42:47 -05:00
arrays 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
2008-02-14 01:43:50 -05:00
combinators.cleave benchmark
classes strings quotations words parser-combinators new-slots accessors
assocs.lib smtp builder.util ;
2008-01-31 01:25:06 -05:00
IN: builder
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-10 02:04:14 -05:00
: git-clone ( -- desc ) { "git" "clone" "../factor" } ;
2008-02-04 22:26:59 -05:00
2008-02-12 06:38:09 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: stamp
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-12 06:38:09 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-11 15:59:02 -05:00
: git-id ( -- id )
{ "git" "show" } <process-stream> [ readln ] with-stream " " split second ;
2008-02-12 05:42:47 -05:00
: record-git-id ( -- ) git-id "../git-id" [ . ] with-file-out ;
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-14 02:01:09 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: target ( -- target ) { os [ cpu "." split ] } to-strings "-" join ;
2008-02-14 01:43:50 -05:00
: make-vm ( -- desc )
<process*>
{ "make" target } to-strings >>arguments
"../compile-log" >>stdout
+stdout+ >>stderr
>desc ;
2008-02-14 02:01:09 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: factor-binary ( -- name )
os
{ { "macosx" [ "./Factor.app/Contents/MacOS/factor" ] }
{ "winnt" [ "./factor-nt.exe" ] }
[ drop "./factor" ] }
case ;
2008-02-14 01:43:50 -05:00
: bootstrap-cmd ( -- cmd )
{ factor-binary [ "-i=" my-boot-image-name append ] "-no-user-init" }
to-strings ;
2008-02-04 22:26:59 -05:00
2008-02-10 02:04:14 -05:00
: bootstrap ( -- desc )
2008-02-14 01:43:50 -05:00
<process*>
bootstrap-cmd >>arguments
2008-02-14 06:20:38 -05:00
+closed+ >>stdin
2008-02-14 01:43:50 -05:00
"../boot-log" >>stdout
+stdout+ >>stderr
20 minutes>ms >>timeout
>desc ;
: builder-test ( -- desc ) { factor-binary "-run=builder.test" } to-strings ;
2008-02-10 02:04:14 -05:00
2008-02-12 00:42:21 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: (build) ( -- )
enter-build-dir
2008-02-12 05:42:47 -05:00
"report" [
2008-02-12 05:42:47 -05:00
"Build machine: " write host-name print
"Build directory: " write cwd print
2008-02-12 00:42:21 -05:00
2008-02-12 05:42:47 -05:00
git-clone [ "git clone failed" print ] run-or-bail
2008-02-10 02:04:14 -05:00
2008-02-12 05:42:47 -05:00
"factor" cd
2008-02-10 02:04:14 -05:00
2008-02-12 05:42:47 -05:00
record-git-id
2008-02-10 02:04:14 -05:00
2008-02-12 05:42:47 -05:00
make-clean run-process drop
2008-02-10 02:04:14 -05:00
2008-02-12 05:42:47 -05:00
make-vm [ "vm compile error" print "../compile-log" cat ] run-or-bail
2008-02-10 02:04:14 -05:00
2008-02-12 05:42:47 -05:00
[ my-arch download-image ] [ "Image download error" print throw ] recover
2008-02-10 02:04:14 -05:00
2008-02-14 06:20:38 -05:00
bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail
2008-02-12 05:42:47 -05:00
[ builder-test try-process ]
[ "Builder test error" print throw ]
recover
2008-02-12 05:42:47 -05:00
"Boot time: " write "../boot-time" eval-file milli-seconds>time print
"Load time: " write "../load-time" eval-file milli-seconds>time print
"Test time: " write "../test-time" eval-file milli-seconds>time print
"Did not pass load-everything: " print "../load-everything-vocabs" cat
"Did not pass test-all: " print "../test-all-vocabs" cat
2008-02-13 06:50:45 -05:00
"Benchmarks: " print
"../benchmarks" [ stdio get contents eval ] with-file-in benchmarks.
2008-02-13 06:50:45 -05:00
2008-02-12 05:42:47 -05:00
] with-file-out ;
2008-02-14 02:01:09 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SYMBOL: builder-recipients
: tag-subject ( str -- str ) { "builder@" host-name* ": " , } bake to-string ;
: build ( -- )
2008-02-12 05:42:47 -05:00
[ (build) ] [ drop ] recover
2008-02-14 01:43:50 -05:00
<email>
"ed@factorcode.org" >>from
builder-recipients get >>to
"report" tag-subject >>subject
"../report" file>string >>body
send ;
2008-02-12 05:42:47 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-14 02:01:09 -05:00
: git-pull ( -- desc )
{
"git"
"pull"
"--no-summary"
"git://factorcode.org/git/factor.git"
"master"
} ;
2008-02-11 15:59:02 -05:00
: 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 ;
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-11 15:59:02 -05:00
MAIN: build-loop