1 ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays calendar calendar.format combinators
4 continuations io io.encodings.utf8 io.files io.launcher
5 io.pathnames io.sockets kernel make mason.config math namespaces
6 parser prettyprint prettyprint.config sequences splitting ;
9 : print-timestamp ( string -- )
10 now timestamp>string write bl print flush ;
14 : short-host-name ( -- string )
15 host-name "." split1 drop [ no-host-name ] unless* ;
17 SYMBOL: current-git-id
19 : short-running-process ( command -- )
20 ! Give network operations and shell commands at most
21 ! 30 minutes to complete, to catch hangs.
29 '[ drop @ f ] attempt-all drop ; inline
31 : upload-process ( process -- )
32 ! Give network operations and shell commands at most
33 ! 30 minutes to complete, to catch hangs.
35 upload-timeout get >>timeout
39 :: upload-safely ( local username host remote -- )
40 remote ".incomplete" append :> temp
41 { username "@" host ":" temp } concat :> scp-remote
42 scp-command get :> scp
43 ssh-command get :> ssh
44 5 [ { scp local scp-remote } upload-process ] retry
45 5 [ { ssh host "-l" username "mv" temp remote } short-running-process ] retry ;
47 : eval-file ( file -- obj )
48 dup utf8 file-lines parse-fresh
49 [ "Empty file: " swap append throw ] [ nip first ] if-empty ;
51 : to-file ( object file -- ) utf8 [ [ . ] without-limits ] with-file-writer ;
53 : datestamp ( timestamp -- string )
62 ] { } make [ pad-00 ] map "-" join ;
64 : nanos>time ( n -- string )
65 1,000,000,000 /i 60 /mod [ 60 /mod ] dip 3array [ pad-00 ] map ":" join ;
69 : build-dir ( -- path ) builds-dir get stamp get append-path ;
71 CONSTANT: load-all-vocabs-file "load-everything-vocabs"
72 CONSTANT: load-all-errors-file "load-everything-errors"
74 CONSTANT: test-all-vocabs-file "test-all-vocabs"
75 CONSTANT: test-all-errors-file "test-all-errors"
77 CONSTANT: help-lint-vocabs-file "help-lint-vocabs"
78 CONSTANT: help-lint-errors-file "help-lint-errors"
80 CONSTANT: compiler-errors-file "compiler-errors"
81 CONSTANT: compiler-error-messages-file "compiler-error-messages"
83 CONSTANT: boot-time-file "boot-time"
84 CONSTANT: load-time-file "load-time"
85 CONSTANT: test-time-file "test-time"
86 CONSTANT: help-lint-time-file "help-lint-time"
87 CONSTANT: benchmark-time-file "benchmark-time"
88 CONSTANT: html-help-time-file "html-help-time"
90 CONSTANT: benchmarks-file "benchmarks"
91 CONSTANT: benchmark-error-messages-file "benchmark-error-messages"
92 CONSTANT: benchmark-error-vocabs-file "benchmark-error-vocabs"
94 SYMBOL: status-error ! didn't bootstrap, or crashed
95 SYMBOL: status-dirty ! bootstrapped but not all tests passed
96 SYMBOL: status-clean ! everything good