]> gitweb.factorcode.org Git - factor.git/commitdiff
Some mason improvements:
authorSlava Pestov <slava@factorcode.org>
Sat, 10 Sep 2011 02:13:06 +0000 (19:13 -0700)
committerSlava Pestov <slava@factorcode.org>
Sat, 10 Sep 2011 02:54:47 +0000 (19:54 -0700)
- 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

extra/mason/child/child.factor
extra/mason/config/config.factor
extra/mason/notify/notify.factor
extra/mason/platform/platform-tests.factor
extra/mason/platform/platform.factor
extra/mason/release/branch/branch.factor
extra/mason/release/upload/upload.factor
extra/webapps/mason/version/common/common.factor
extra/webapps/mason/version/files/files.factor
extra/webapps/mason/version/source/source.factor

index 3a7e88ac9b3746ce0ae6b3fbb27064e01660db0f..4191d2e25a0094b768b4ef2b2c19466dec15c5e0 100644 (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.
 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 )
@@ -12,7 +12,9 @@ IN: mason.child
     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 )
     {
@@ -37,6 +39,7 @@ IN: mason.child
         factor-vm ,
         "-i=" boot-image-name append ,
         "-no-user-init" ,
+        boot-flags get %
     ] { } make ;
 
 : boot ( -- )
index 5e0ad51b4fdc6d7ab354fb8ce6dc457884362c48..2442d0054b4ce480e78f1a00cea99fb2963b5352 100644 (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.
 USING: calendar system io.files io.pathnames namespaces kernel
 accessors assocs ;
@@ -27,6 +27,12 @@ SYMBOL: target-os
 
 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
 
@@ -61,10 +67,22 @@ SYMBOL: docs-update-url
 
 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
@@ -84,15 +102,6 @@ SYMBOL: image-username
 ! 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
index cdde08f9798f406f13b29740435593399fc57433..89ddce590d85d7da124937c57e936100547d7922 100644 (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.
 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 ;
index 8a5c00f9435d575d927a627572695666be86d4ce..b3f58b31a122a2e18ed339af34d97981327dda1b 100644 (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
 
 [ 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
index ad5e313d3080f3ffc112d864cce3a78d2f95d28a..4564815cc0b671467f28e89bc656c9eadb99af50 100644 (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.
 USING: kernel system accessors namespaces splitting sequences
 mason.config bootstrap.image assocs ;
@@ -8,7 +8,8 @@ IN: mason.platform
     { { 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" ? ;
index 06923b5d2b9df86648581eb9f76d5ca96d79447b..9f7a413f31bcb782c16c75334ddf6de38a2af6cd 100644 (file)
@@ -38,11 +38,10 @@ IN: mason.release.branch
 : 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 ;
index d3e11c3fc339f03b1a9474c5f6d0a650f3c061c8..8058c8f561018b06b44d9a2d15dd2b96254396ad 100644 (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.
 USING: kernel namespaces make sequences arrays io io.files
 io.launcher mason.common mason.platform
@@ -6,15 +6,15 @@ mason.release.archive mason.config ;
 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 ;
index 035cee92ca5075ffbb429fbcff9c1455efadaeac..e9a37e9bd119d19fe4ff850d6e01a6a13169db75 100644 (file)
@@ -5,7 +5,7 @@ kernel make mason.config namespaces ;
 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
index 9302b4d1bd0113bf75938c07cd24fbbb5bd2b311..db7b329f5245b13b11d920df452d66e5a2b1ce56 100644 (file)
@@ -8,7 +8,7 @@ IN: webapps.mason.version.files
     [ "releases/" % % "/" % % ] "" make ;
 
 : remote-directory ( string -- string' )
-    [ upload-directory get ] dip "/" glue ;
+    [ package-directory get ] dip "/" glue ;
 
 SLOT: os
 SLOT: cpu
index 7050950614350cb1f0bc8734c8b515aa1a15a635..6e5559c3b1c62f488b953e203a932760f67d21e2 100644 (file)
@@ -44,7 +44,7 @@ IN: webapps.mason.version.source
 
 : 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 ;