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-13 16:18:40 -05:00
|
|
|
combinators.cleave benchmark ;
|
2008-01-31 01:25:06 -05:00
|
|
|
|
|
|
|
IN: builder
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-06 05:26:13 -05:00
|
|
|
: runtime ( quot -- time ) benchmark nip ;
|
|
|
|
|
2008-02-13 06:50:45 -05:00
|
|
|
: minutes>ms ( min -- ms ) 60 * 1000 * ;
|
|
|
|
|
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
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-06 00:09:33 -05:00
|
|
|
: target ( -- target ) `{ ,[ os ] %[ cpu "." split ] } "-" join ;
|
2008-02-05 19:28:05 -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-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-12 06:38:09 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
: datestamp ( -- string )
|
|
|
|
now `{ ,[ dup timestamp-year ]
|
|
|
|
,[ dup timestamp-month ]
|
|
|
|
,[ dup timestamp-day ]
|
|
|
|
,[ dup timestamp-hour ]
|
|
|
|
,[ timestamp-minute ] }
|
|
|
|
[ pad-00 ] map "-" join ;
|
|
|
|
|
|
|
|
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-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
|
|
|
: 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-13 06:50:45 -05:00
|
|
|
{ +timeout+ ,[ 20 minutes>ms ] }
|
2008-02-12 23:33:36 -05:00
|
|
|
} ;
|
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-11 22:17:42 -05:00
|
|
|
SYMBOL: build-status
|
2008-02-10 02:04:14 -05:00
|
|
|
|
2008-02-12 00:42:21 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-12 05:42:47 -05:00
|
|
|
: milli-seconds>time ( n -- string )
|
|
|
|
1000 /i 60 /mod >r 60 /mod r> 3array [ pad-00 ] map ":" join ;
|
|
|
|
|
|
|
|
: eval-file ( file -- obj ) <file-reader> contents eval ;
|
2008-02-12 02:27:57 -05:00
|
|
|
|
2008-02-12 01:15:20 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-12 05:42:47 -05:00
|
|
|
: cat ( file -- ) <file-reader> contents print ;
|
|
|
|
|
|
|
|
: run-or-bail ( desc quot -- )
|
|
|
|
[ [ try-process ] curry ]
|
|
|
|
[ [ throw ] curry ]
|
|
|
|
bi*
|
|
|
|
recover ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-11 19:13:49 -05:00
|
|
|
: (build) ( -- )
|
|
|
|
|
|
|
|
enter-build-dir
|
|
|
|
|
2008-02-12 05:42:47 -05:00
|
|
|
"report" [
|
2008-02-11 19:13:49 -05:00
|
|
|
|
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-12 23:33:36 -05:00
|
|
|
! bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail
|
|
|
|
|
2008-02-13 06:50:45 -05:00
|
|
|
! bootstrap
|
|
|
|
! <process-stream> dup dispose process-stream-process wait-for-process
|
|
|
|
! zero? not
|
|
|
|
! [ "Bootstrap error" print "../boot-log" cat "bootstrap error" throw ]
|
|
|
|
! when
|
|
|
|
|
|
|
|
[
|
|
|
|
bootstrap
|
|
|
|
<process-stream> dup dispose process-stream-process wait-for-process
|
|
|
|
zero? not
|
|
|
|
[ "bootstrap non-zero" throw ]
|
|
|
|
when
|
|
|
|
]
|
|
|
|
[ "Bootstrap error" print "../boot-log" cat "bootstrap" throw ]
|
|
|
|
recover
|
|
|
|
|
2008-02-12 05:42:47 -05:00
|
|
|
[ builder-test try-process ]
|
|
|
|
[ "Builder test error" print throw ]
|
|
|
|
recover
|
2008-02-11 19:13:49 -05:00
|
|
|
|
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
|
2008-02-13 16:14:54 -05:00
|
|
|
"../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-11 19:13:49 -05:00
|
|
|
|
|
|
|
: build ( -- )
|
2008-02-12 05:42:47 -05:00
|
|
|
[ (build) ] [ drop ] recover
|
|
|
|
"report" "../report" email-file ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
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
|