]> gitweb.factorcode.org Git - factor.git/blob - extra/update/update.factor
Merge branch 'master' into experimental
[factor.git] / extra / update / update.factor
1 USING: kernel system sequences io.files io.directories
2 io.pathnames io.launcher bootstrap.image http.client update.util ;
3 IN: update
4
5 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6
7 : run-command ( cmd -- ) to-strings try-process ;
8
9 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
11 : git-pull-clean ( -- )
12   image parent-directory
13     [
14       { "git" "pull" "git://factorcode.org/git/factor.git" branch-name }
15       run-command
16     ]
17   with-directory ;
18
19 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20
21 : remote-clean-image ( -- url )
22   { "http://factorcode.org/images/clean/" platform "/" my-boot-image-name }
23   to-string ;
24
25 : download-clean-image ( -- ) remote-clean-image download ;
26
27 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28
29 : make-clean ( -- ) { gnu-make "clean" } run-command ;
30 : make       ( -- ) { gnu-make         } run-command ;
31 : boot       ( -- ) { "./factor" { "-i=" my-boot-image-name } } run-command ;
32
33 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34
35 : rebuild ( -- )
36   image parent-directory
37     [
38       download-clean-image
39       make-clean
40       make
41       boot
42     ]
43   with-directory ;
44
45 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
46
47 : update ( -- )
48   image parent-directory
49     [
50       git-id
51       git-pull-clean
52       git-id
53       = not
54         [ rebuild ]
55       when
56     ]
57   with-directory ;
58
59 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
60
61 MAIN: update