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-15 06:22:52 -05:00
|
|
|
SYMBOL: builds-dir
|
|
|
|
|
|
|
|
: builds ( -- path )
|
|
|
|
builds-dir get
|
|
|
|
home "/builds" append
|
|
|
|
or ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
: prepare-build-machine ( -- )
|
|
|
|
builds make-directory
|
|
|
|
builds cd
|
|
|
|
{ "git" "clone" "git://factorcode.org/git/factor.git" } run-process drop ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
: builds-check ( -- ) builds exists? not [ prepare-build-machine ] when ;
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
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
|
2008-02-15 06:22:52 -05:00
|
|
|
builds cd
|
2008-02-10 02:04:14 -05:00
|
|
|
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
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-15 04:17:30 -05:00
|
|
|
SYMBOL: build-status
|
|
|
|
|
2008-02-11 19:13:49 -05:00
|
|
|
: (build) ( -- )
|
|
|
|
|
2008-02-16 10:05:01 -05:00
|
|
|
builds-check
|
|
|
|
|
2008-02-15 04:17:30 -05:00
|
|
|
build-status off
|
|
|
|
|
2008-02-11 19:13:49 -05:00
|
|
|
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
|
2008-02-15 04:17:30 -05:00
|
|
|
"CPU: " write cpu print
|
|
|
|
"OS: " write os print
|
2008-02-15 08:46:20 -05:00
|
|
|
"Build directory: " write cwd print nl
|
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-15 04:17:30 -05:00
|
|
|
[ retrieve-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-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
|
2008-02-15 08:46:20 -05:00
|
|
|
"Test time: " write "../test-time" eval-file milli-seconds>time print nl
|
2008-02-12 05:42:47 -05:00
|
|
|
|
|
|
|
"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-15 04:17:30 -05:00
|
|
|
] with-file-out
|
|
|
|
|
|
|
|
build-status on ;
|
2008-02-11 19:13:49 -05:00
|
|
|
|
2008-02-14 02:01:09 -05:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-02-15 06:22:52 -05:00
|
|
|
SYMBOL: builder-from
|
|
|
|
|
2008-02-14 02:01:09 -05:00
|
|
|
SYMBOL: builder-recipients
|
|
|
|
|
|
|
|
: tag-subject ( str -- str ) { "builder@" host-name* ": " , } bake to-string ;
|
|
|
|
|
2008-02-15 06:22:52 -05:00
|
|
|
: subject ( -- str ) build-status get [ "report" ] [ "error" ] if tag-subject ;
|
2008-02-15 04:17:30 -05:00
|
|
|
|
2008-02-15 06:22:52 -05:00
|
|
|
: send-builder-email ( -- )
|
2008-02-14 01:43:50 -05:00
|
|
|
<email>
|
2008-02-15 06:22:52 -05:00
|
|
|
builder-from get >>from
|
2008-02-14 01:43:50 -05:00
|
|
|
builder-recipients get >>to
|
2008-02-15 04:17:30 -05:00
|
|
|
subject >>subject
|
2008-02-14 01:43:50 -05:00
|
|
|
"../report" file>string >>body
|
|
|
|
send ;
|
2008-02-12 05:42:47 -05:00
|
|
|
|
2008-02-15 06:22:52 -05:00
|
|
|
: build ( -- )
|
|
|
|
[ (build) ] [ drop ] recover
|
2008-02-15 06:54:19 -05:00
|
|
|
[ send-builder-email ] [ drop "not sending mail" . ] recover ;
|
2008-02-15 06:22:52 -05:00
|
|
|
|
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 ( -- )
|
2008-02-15 06:54:19 -05:00
|
|
|
builds-check
|
2008-02-11 15:59:02 -05:00
|
|
|
[
|
2008-02-15 07:04:53 -05:00
|
|
|
builds "/factor" append cd
|
2008-02-11 15:59:02 -05:00
|
|
|
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
|