2010-05-25 17:15:55 -04:00
|
|
|
! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
|
2008-09-16 00:20:33 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2010-09-04 19:58:10 -04:00
|
|
|
USING: bootstrap.image.download init io.directories io.launcher
|
|
|
|
|
kernel namespaces mason.common mason.platform ;
|
2008-09-16 00:20:33 -04:00
|
|
|
IN: mason.updates
|
|
|
|
|
|
2010-09-04 19:58:10 -04:00
|
|
|
SYMBOLS: latest-git-id latest-boot-image ;
|
|
|
|
|
SYMBOLS: last-git-id last-boot-image ;
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
f latest-git-id set-global
|
|
|
|
|
f latest-boot-image set-global
|
|
|
|
|
f last-git-id set-global
|
|
|
|
|
f last-boot-image set-global
|
|
|
|
|
] "mason.updates" add-startup-hook
|
|
|
|
|
|
2008-09-16 00:20:33 -04:00
|
|
|
: git-pull-cmd ( -- cmd )
|
|
|
|
|
{
|
|
|
|
|
"git"
|
|
|
|
|
"pull"
|
|
|
|
|
"--no-summary"
|
|
|
|
|
"git://factorcode.org/git/factor.git"
|
|
|
|
|
"master"
|
|
|
|
|
} ;
|
|
|
|
|
|
2010-09-04 19:58:10 -04:00
|
|
|
: update-source ( -- )
|
2008-09-16 00:20:33 -04:00
|
|
|
git-pull-cmd short-running-process
|
2010-09-04 19:58:10 -04:00
|
|
|
git-id latest-git-id set-global ;
|
|
|
|
|
|
|
|
|
|
: update-boot-image ( -- )
|
|
|
|
|
boot-image-name
|
|
|
|
|
[ maybe-download-image drop ]
|
|
|
|
|
[ file-checksum latest-boot-image set-global ] bi ;
|
|
|
|
|
|
|
|
|
|
: update-code ( -- )
|
|
|
|
|
update-source
|
|
|
|
|
update-boot-image ;
|
|
|
|
|
|
|
|
|
|
: new-source-available? ( -- ? )
|
|
|
|
|
last-git-id get-global latest-git-id get-global = not ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
|
|
|
|
: new-image-available? ( -- ? )
|
2010-09-04 19:58:10 -04:00
|
|
|
last-boot-image get-global latest-boot-image get-global = not ;
|
|
|
|
|
|
|
|
|
|
: build? ( -- ? )
|
|
|
|
|
new-source-available? new-image-available? or ;
|
2008-09-16 00:20:33 -04:00
|
|
|
|
2010-09-04 19:58:10 -04:00
|
|
|
: finish-build ( -- )
|
|
|
|
|
#! If the build completed (successfully or not) without
|
|
|
|
|
#! mason crashing or being killed, don't build this git ID
|
|
|
|
|
#! and boot image hash again.
|
|
|
|
|
latest-git-id get-global last-git-id set-global
|
|
|
|
|
latest-boot-image get-global last-boot-image set-global ;
|