1 ! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: bootstrap.image.download http.client init kernel
4 mason.config mason.git mason.platform math.parser namespaces ;
7 TUPLE: sources git-id boot-image counter ;
11 SYMBOLS: latest-sources last-built-sources ;
14 f latest-sources set-global
15 f last-built-sources set-global
18 : latest-boot-image ( -- boot-image )
19 target-boot-image-name
20 [ maybe-download-image drop ] [ file-checksum ] bi ;
22 : latest-counter ( -- counter )
23 counter-url get-global http-get nip string>number ;
25 : update-sources ( -- )
26 ! Must be run from builds-dir
27 git-clone-or-pull latest-boot-image latest-counter <sources>
28 latest-sources set-global ;
30 : should-build? ( -- ? )
31 latest-sources get-global last-built-sources get-global = not ;
34 ! If the build completed (successfully or not) without
35 ! mason crashing or being killed, don't build this git ID
36 ! and boot image hash again.
37 latest-sources get-global last-built-sources set-global ;