factor/extra/builder/builder.factor

136 lines
3.3 KiB
Factor
Raw Normal View History

2008-01-31 01:25:06 -05:00
2008-02-04 22:26:59 -05:00
USING: kernel io io.files io.launcher hashtables tools.deploy.backend
system continuations namespaces sequences splitting math.parser
2008-02-04 22:58:57 -05:00
prettyprint tools.time calendar bake vars http.client
combinators ;
2008-01-31 01:25:06 -05:00
IN: builder
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: datestamp ( -- string )
now `{ ,[ dup timestamp-year ]
,[ 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
: email-file ( subject file -- )
`{
2008-02-04 22:26:59 -05:00
{ +stdin+ , }
{ +arguments+ { "mutt" "-s" , %[ builder-recipients get ] } }
}
>hashtable run-process drop ;
: email-string ( subject -- )
`{ "mutt" "-s" , %[ builder-recipients get ] }
2008-02-05 00:48:18 -05:00
[ ] with-process-stream drop ;
2008-02-04 22:26:59 -05:00
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: target ( -- target ) `{ ,[ os ] %[ cpu "." split ] } "-" join ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-04 22:58:57 -05:00
: factor-binary ( -- name )
os
{ { "macosx" [ "./Factor.app/Contents/MacOS/factor" ] }
{ "windows" [ "./factor-nt.exe" ] }
[ drop "./factor" ] }
case ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-01-31 01:25:06 -05:00
VAR: stamp
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: build ( -- )
2008-02-04 22:26:59 -05:00
datestamp >stamp
"/builds/factor" cd
{ "git" "pull" "--no-summary" "git://factorcode.org/git/factor.git" }
run-process process-status
0 =
[ ]
[
"builder: git pull" email-string
"builder: git pull" throw
]
if
"/builds/" stamp> append make-directory
"/builds/" stamp> append cd
{ "git" "clone" "/builds/factor" } run-process drop
"factor" cd
{ "git" "show" } <process-stream>
[ readln ] with-stream
" " split second
"../git-id" <file-writer> [ print ] with-stream
{ "make" "clean" } run-process drop
`{
{ +arguments+ { "make" ,[ target ] } }
{ +stdout+ "../compile-log" }
{ +stderr+ +stdout+ }
}
>hashtable run-process process-status
0 =
[ ]
[
"builder: vm compile" "../compile-log" email-file
"builder: vm compile" throw
] if
[ "http://factorcode.org/images/latest/" boot-image-name append download ]
[ "builder: image download" email-string ]
recover
`{
{ +arguments+ {
2008-02-04 22:58:57 -05:00
,[ factor-binary ]
2008-02-04 22:26:59 -05:00
,[ "-i=" boot-image-name append ]
"-no-user-init"
} }
{ +stdout+ "../boot-log" }
{ +stderr+ +stdout+ }
}
>hashtable
[ run-process process-status ]
benchmark nip "../boot-time" <file-writer> [ . ] with-stream
0 =
[ ]
[
"builder: bootstrap" "../boot-log" email-file
"builder: bootstrap" throw
] if
`{
2008-02-04 22:58:57 -05:00
{ +arguments+
{ ,[ factor-binary ] "-e=USE: tools.browser load-everything" } }
2008-02-04 22:26:59 -05:00
{ +stdout+ "../load-everything-log" }
{ +stderr+ +stdout+ }
}
>hashtable [ run-process process-status ] benchmark nip
"../load-everything-time" <file-writer> [ . ] with-stream
0 =
[ ]
[
"builder: load-everything" "../load-everything-log" email-file
"builder: load-everything" throw
] if ;
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MAIN: build