- 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
-! 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.
USING: accessors arrays calendar combinators.short-circuit fry
continuations debugger io.directories io.files io.launcher
-io.pathnames io.encodings.ascii kernel make mason.common mason.config
-mason.platform mason.report mason.notify namespaces sequences
-quotations macros system combinators splitting ;
+io.pathnames io.encodings.ascii kernel make mason.common
+mason.config mason.platform mason.report mason.notify namespaces
+sequences quotations macros system combinators splitting ;
IN: mason.child
: nmake-cmd ( -- args )
target-cpu get name>> "." split "-" join suffix ;
: gnu-make-cmd ( -- args )
- gnu-make platform 2array ;
+ gnu-make
+ target-os get name>> target-cpu get name>> (platform)
+ 2array ;
: make-cmd ( -- args )
{
factor-vm ,
"-i=" boot-image-name append ,
"-no-user-init" ,
+ boot-flags get %
] { } make ;
: boot ( -- )
-! 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.
USING: calendar system io.files io.pathnames namespaces kernel
accessors assocs ;
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?
SYMBOL: builder-debug
docs-update-url [ "http://builds.factorcode.org/docs-update" ] initialize
-! Boolean. Do we release binaries and update the clean branch?
-SYMBOL: upload-to-factorcode?
+! Boolean. Do we upload package binaries?
+SYMBOL: upload-package?
+
+! Host to upload binary package to.
+SYMBOL: package-host
+
+! Username to log in.
+SYMBOL: package-username
+
+! Directory with binary packages.
+SYMBOL: package-directory
-! The below are only needed if upload-to-factorcode? is true.
+! 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.
SYMBOL: branch-host
! Directory with clean images.
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
SYMBOL: upload-timeout
1 hours upload-timeout set-global
-! Copyright (C) 2009, 2010 Slava Pestov.
+! Copyright (C) 2009, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors fry http.client io io.encodings.utf8 io.files
kernel mason.common mason.config mason.email mason.twitter
namespaces prettyprint sequences debugger continuations ;
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 -- )
- '[
- 5 [
- [
- 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
- ] H{ } make-assoc
- status-url get http-post 2drop
- ] retry
- ] [
- "STATUS NOTIFY FAILED:" print
- error. flush
- ] recover ;
+ status-notify? [
+ '[
+ 5 [
+ _ _ _ status-params status-url get
+ http-post 2drop
+ ] retry
+ ] [
+ "STATUS NOTIFY FAILED:" print
+ error. flush
+ ] recover
+ ] [ 3drop ] if ;
: notify-heartbeat ( -- )
f f "heartbeat" status-notify ;
-USING: tools.test strings mason.platform ;
+USING: mason.config mason.platform namespaces tools.test
+strings system ;
IN: mason.platform.tests
[ 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
-! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel system accessors namespaces splitting sequences
mason.config bootstrap.image assocs ;
{ { CHAR: . CHAR: - } } substitute "-" glue ;
: 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 )
target-os get { freebsd openbsd netbsd } member? "gmake" "make" ? ;
: upload-clean-image ( -- )
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 ( -- )
- upload-to-factorcode? get [ (update-clean-branch) ] when ;
+ update-clean-branch? get [
+ "factor" [
+ push-to-clean-branch
+ upload-clean-image
+ ] with-directory
+ ] when ;
-! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces make sequences arrays io io.files
io.launcher mason.common mason.platform
IN: mason.release.upload
: remote-location ( -- dest )
- upload-directory get "/" platform 3append ;
+ package-directory get "/" platform 3append ;
: remote-archive-name ( archive-name -- dest )
[ remote-location "/" ] dip 3append ;
: upload ( archive-name -- )
- upload-to-factorcode? get [
- upload-username get
- upload-host get
+ upload-package? get [
+ package-username get
+ package-host get
pick remote-archive-name
upload-safely
] [ drop ] if ;
IN: webapps.mason.version.common
: execute-on-server ( string -- )
- [ "ssh" , upload-host get , "-l" , upload-username get , ] { } make
+ [ "ssh" , package-host get , "-l" , package-username get , ] { } make
<process>
swap >>command
5 minutes >>timeout
[ "releases/" % % "/" % % ] "" make ;
: remote-directory ( string -- string' )
- [ upload-directory get ] dip "/" glue ;
+ [ package-directory get ] dip "/" glue ;
SLOT: os
SLOT: cpu
: upload-source-release ( package version -- )
"Uploading source release..." print flush
- [ upload-username get upload-host get ] dip
+ [ package-username get package-host get ] dip
remote-source-release-name
upload-safely ;