1 ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel namespaces sequences splitting system accessors
4 math.functions make io io.files io.pathnames io.directories
5 io.directories.hierarchy io.launcher io.encodings.utf8 prettyprint
6 combinators.short-circuit parser combinators calendar
7 calendar.format arrays mason.config locals system ;
10 HOOK: really-delete-tree os ( path -- )
12 M: windows really-delete-tree
13 #! Workaround: Cygwin GIT creates read-only files for
15 [ { "chmod" "ug+rw" "-R" } swap (normalize-path) suffix try-process ]
19 M: unix really-delete-tree delete-tree ;
21 : short-running-process ( command -- )
22 #! Give network operations at most 15 minutes to complete.
28 :: upload-safely ( local username host remote -- )
29 [let* | temp [ remote ".incomplete" append ]
30 scp-remote [ { username "@" host ":" temp } concat ]
31 scp [ scp-command get ]
32 ssh [ ssh-command get ] |
33 { scp local scp-remote } short-running-process
34 { ssh host "-l" username "mv" temp remote } short-running-process
37 : eval-file ( file -- obj )
38 dup utf8 file-lines parse-fresh
39 [ "Empty file: " swap append throw ] [ nip first ] if-empty ;
41 : cat ( file -- ) utf8 file-contents print ;
43 : cat-n ( file n -- ) [ utf8 file-lines ] dip short tail* [ print ] each ;
45 : to-file ( object file -- ) utf8 [ . ] with-file-writer ;
47 : datestamp ( timestamp -- string )
56 ] { } make [ pad-00 ] map "-" join ;
58 : milli-seconds>time ( n -- string )
60 [ hour>> ] [ minute>> ] [ second>> floor ] tri 3array
61 [ pad-00 ] map ":" join ;
65 : builds/factor ( -- path ) builds-dir get "factor" append-path ;
66 : build-dir ( -- path ) builds-dir get stamp get append-path ;
68 : prepare-build-machine ( -- )
69 builds-dir get make-directories
71 [ { "git" "clone" "git://factorcode.org/git/factor.git" } try-process ]
75 { "git" "show" } utf8 [ readln ] with-process-reader
78 : ?prepare-build-machine ( -- )
79 builds/factor exists? [ prepare-build-machine ] unless ;
81 CONSTANT: load-everything-vocabs-file "load-everything-vocabs"
82 CONSTANT: load-everything-errors-file "load-everything-errors"
84 CONSTANT: test-all-vocabs-file "test-all-vocabs"
85 CONSTANT: test-all-errors-file "test-all-errors"
87 CONSTANT: help-lint-vocabs-file "help-lint-vocabs"
88 CONSTANT: help-lint-errors-file "help-lint-errors"
90 CONSTANT: compiler-errors-file "compiler-errors"
91 CONSTANT: compiler-error-messages-file "compiler-error-messages"
93 CONSTANT: boot-time-file "boot-time"
94 CONSTANT: load-time-file "load-time"
95 CONSTANT: test-time-file "test-time"
96 CONSTANT: help-lint-time-file "help-lint-time"
97 CONSTANT: benchmark-time-file "benchmark-time"
98 CONSTANT: html-help-time-file "html-help-time"
100 CONSTANT: benchmarks-file "benchmarks"
101 CONSTANT: benchmark-error-messages-file "benchmark-error-messages"
102 CONSTANT: benchmark-error-vocabs-file "benchmark-error-vocabs"
106 SYMBOL: status-error ! didn't bootstrap, or crashed
107 SYMBOL: status-dirty ! bootstrapped but not all tests passed
108 SYMBOL: status-clean ! everything good