Some mason improvements:

- Rename config variables to be more intuitive, split up upload-to-factorcode? into several variables
- Add target-variant variable. This allows running multiple masons on the same architecture but with different parameters, for example bootstrapping with SSE disabled, or simply for testing on a different OS release.
- Added a boot-flags variable for use with the above
Slava Pestov 2011-09-09 19:13:06 -07:00
parent 5f13058fc5
commit 7b04c8a6fa
10 changed files with 92 additions and 54 deletions

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays calendar combinators.short-circuit fry USING: accessors arrays calendar combinators.short-circuit fry
continuations debugger io.directories io.files io.launcher continuations debugger io.directories io.files io.launcher
io.pathnames io.encodings.ascii kernel make mason.common mason.config io.pathnames io.encodings.ascii kernel make mason.common
mason.platform mason.report mason.notify namespaces sequences mason.config mason.platform mason.report mason.notify namespaces
quotations macros system combinators splitting ; sequences quotations macros system combinators splitting ;
IN: mason.child IN: mason.child
: nmake-cmd ( -- args ) : nmake-cmd ( -- args )
@ -12,7 +12,9 @@ IN: mason.child
target-cpu get name>> "." split "-" join suffix ; target-cpu get name>> "." split "-" join suffix ;
: gnu-make-cmd ( -- args ) : gnu-make-cmd ( -- args )
gnu-make platform 2array ; gnu-make
target-os get name>> target-cpu get name>> (platform)
2array ;
: make-cmd ( -- args ) : make-cmd ( -- args )
{ {
@ -37,6 +39,7 @@ IN: mason.child
factor-vm , factor-vm ,
"-i=" boot-image-name append , "-i=" boot-image-name append ,
"-no-user-init" , "-no-user-init" ,
boot-flags get %
] { } make ; ] { } make ;
: boot ( -- ) : boot ( -- )

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: calendar system io.files io.pathnames namespaces kernel USING: calendar system io.files io.pathnames namespaces kernel
accessors assocs ; accessors assocs ;
@ -27,6 +27,12 @@ SYMBOL: target-os
target-os get-global [ os target-os set-global ] unless target-os get-global [ os target-os set-global ] unless
! (Optional) Architecture variant suffix.
SYMBOL: target-variant
! (Optional) Additional bootstrap flags.
SYMBOL: boot-flags
! Keep test-log around? ! Keep test-log around?
SYMBOL: builder-debug SYMBOL: builder-debug
@ -61,10 +67,22 @@ SYMBOL: docs-update-url
docs-update-url [ "http://builds.factorcode.org/docs-update" ] initialize docs-update-url [ "http://builds.factorcode.org/docs-update" ] initialize
! Boolean. Do we release binaries and update the clean branch? ! Boolean. Do we upload package binaries?
SYMBOL: upload-to-factorcode? SYMBOL: upload-package?
! The below are only needed if upload-to-factorcode? is true. ! Host to upload binary package to.
SYMBOL: package-host
! Username to log in.
SYMBOL: package-username
! Directory with binary packages.
SYMBOL: package-directory
! Boolean. Do we update the clean branch?
SYMBOL: update-clean-branch?
! The below are only needed if update-clean-branch? is true.
! Host with clean git repo. ! Host with clean git repo.
SYMBOL: branch-host SYMBOL: branch-host
@ -84,15 +102,6 @@ SYMBOL: image-username
! Directory with clean images. ! Directory with clean images.
SYMBOL: image-directory SYMBOL: image-directory
! Host to upload binary package to.
SYMBOL: upload-host
! Username to log in.
SYMBOL: upload-username
! Directory with binary packages.
SYMBOL: upload-directory
! Upload timeout ! Upload timeout
SYMBOL: upload-timeout SYMBOL: upload-timeout
1 hours upload-timeout set-global 1 hours upload-timeout set-global

View File

@ -1,28 +1,37 @@
! Copyright (C) 2009, 2010 Slava Pestov. ! Copyright (C) 2009, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors fry http.client io io.encodings.utf8 io.files USING: accessors fry http.client io io.encodings.utf8 io.files
kernel mason.common mason.config mason.email mason.twitter kernel mason.common mason.config mason.email mason.twitter
namespaces prettyprint sequences debugger continuations ; namespaces prettyprint sequences debugger continuations ;
IN: mason.notify IN: mason.notify
: status-notify? ( -- ? )
status-url get
target-variant get not and ;
: status-params ( report arg message -- assoc )
[
short-host-name "host-name" set
target-cpu get "target-cpu" set
target-os get "target-os" set
status-secret get "secret" set
[ "report" set ]
[ "arg" set ]
[ "message" set ] tri*
] H{ } make-assoc ;
: status-notify ( report arg message -- ) : status-notify ( report arg message -- )
'[ status-notify? [
5 [ '[
[ 5 [
short-host-name "host-name" set _ _ _ status-params status-url get
target-cpu get "target-cpu" set http-post 2drop
target-os get "target-os" set ] retry
status-secret get "secret" set ] [
_ "report" set "STATUS NOTIFY FAILED:" print
_ "arg" set error. flush
_ "message" set ] recover
] H{ } make-assoc ] [ 3drop ] if ;
status-url get http-post 2drop
] retry
] [
"STATUS NOTIFY FAILED:" print
error. flush
] recover ;
: notify-heartbeat ( -- ) : notify-heartbeat ( -- )
f f "heartbeat" status-notify ; f f "heartbeat" status-notify ;

View File

@ -1,4 +1,21 @@
USING: tools.test strings mason.platform ; USING: mason.config mason.platform namespaces tools.test
strings system ;
IN: mason.platform.tests IN: mason.platform.tests
[ t ] [ platform string? ] unit-test [ t ] [ platform string? ] unit-test
[
linux target-os set
x86.32 target-cpu set
f target-variant set
[ "linux-x86-32" ] [ platform ] unit-test
] with-scope
[
windows target-os set
x86.32 target-cpu set
"xp" target-variant set
[ "windows-x86-32-xp" ] [ platform ] unit-test
] with-scope

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel system accessors namespaces splitting sequences USING: kernel system accessors namespaces splitting sequences
mason.config bootstrap.image assocs ; mason.config bootstrap.image assocs ;
@ -8,7 +8,8 @@ IN: mason.platform
{ { CHAR: . CHAR: - } } substitute "-" glue ; { { CHAR: . CHAR: - } } substitute "-" glue ;
: platform ( -- string ) : platform ( -- string )
target-os get name>> target-cpu get name>> (platform) ; target-os get name>> target-cpu get name>> (platform)
target-variant get [ "-" glue ] when* ;
: gnu-make ( -- string ) : gnu-make ( -- string )
target-os get { freebsd openbsd netbsd } member? "gmake" "make" ? ; target-os get { freebsd openbsd netbsd } member? "gmake" "make" ? ;

View File

@ -38,11 +38,10 @@ IN: mason.release.branch
: upload-clean-image ( -- ) : upload-clean-image ( -- )
5 [ upload-clean-image-cmd short-running-process ] retry ; 5 [ upload-clean-image-cmd short-running-process ] retry ;
: (update-clean-branch) ( -- )
"factor" [
push-to-clean-branch
upload-clean-image
] with-directory ;
: update-clean-branch ( -- ) : update-clean-branch ( -- )
upload-to-factorcode? get [ (update-clean-branch) ] when ; update-clean-branch? get [
"factor" [
push-to-clean-branch
upload-clean-image
] with-directory
] when ;

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces make sequences arrays io io.files USING: kernel namespaces make sequences arrays io io.files
io.launcher mason.common mason.platform io.launcher mason.common mason.platform
@ -6,15 +6,15 @@ mason.release.archive mason.config ;
IN: mason.release.upload IN: mason.release.upload
: remote-location ( -- dest ) : remote-location ( -- dest )
upload-directory get "/" platform 3append ; package-directory get "/" platform 3append ;
: remote-archive-name ( archive-name -- dest ) : remote-archive-name ( archive-name -- dest )
[ remote-location "/" ] dip 3append ; [ remote-location "/" ] dip 3append ;
: upload ( archive-name -- ) : upload ( archive-name -- )
upload-to-factorcode? get [ upload-package? get [
upload-username get package-username get
upload-host get package-host get
pick remote-archive-name pick remote-archive-name
upload-safely upload-safely
] [ drop ] if ; ] [ drop ] if ;

View File

@ -5,7 +5,7 @@ kernel make mason.config namespaces ;
IN: webapps.mason.version.common IN: webapps.mason.version.common
: execute-on-server ( string -- ) : execute-on-server ( string -- )
[ "ssh" , upload-host get , "-l" , upload-username get , ] { } make [ "ssh" , package-host get , "-l" , package-username get , ] { } make
<process> <process>
swap >>command swap >>command
5 minutes >>timeout 5 minutes >>timeout

View File

@ -8,7 +8,7 @@ IN: webapps.mason.version.files
[ "releases/" % % "/" % % ] "" make ; [ "releases/" % % "/" % % ] "" make ;
: remote-directory ( string -- string' ) : remote-directory ( string -- string' )
[ upload-directory get ] dip "/" glue ; [ package-directory get ] dip "/" glue ;
SLOT: os SLOT: os
SLOT: cpu SLOT: cpu

View File

@ -44,7 +44,7 @@ IN: webapps.mason.version.source
: upload-source-release ( package version -- ) : upload-source-release ( package version -- )
"Uploading source release..." print flush "Uploading source release..." print flush
[ upload-username get upload-host get ] dip [ package-username get package-host get ] dip
remote-source-release-name remote-source-release-name
upload-safely ; upload-safely ;