]> gitweb.factorcode.org Git - factor.git/blob - extra/mason/updates/updates.factor
Fix comments to be ! not #!.
[factor.git] / extra / mason / updates / updates.factor
1 ! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
2 ! See http://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 ;
5 IN: mason.updates
6
7 TUPLE: sources git-id boot-image counter ;
8
9 C: <sources> sources
10
11 SYMBOLS: latest-sources last-built-sources ;
12
13 [
14     f latest-sources set-global
15     f last-built-sources set-global
16 ] "mason.updates" add-startup-hook
17
18 : latest-boot-image ( -- boot-image )
19     target-boot-image-name
20     [ maybe-download-image drop ] [ file-checksum ] bi ;
21
22 : latest-counter ( -- counter )
23     counter-url get-global http-get nip string>number ;
24
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 ;
29
30 : should-build? ( -- ? )
31     latest-sources get-global last-built-sources get-global = not ;
32
33 : finish-build ( -- )
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 ;