]> gitweb.factorcode.org Git - factor.git/commitdiff
zealot.factor: Use `arch -x86_64` on mac
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Apr 2022 00:51:34 +0000 (19:51 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Apr 2022 00:51:34 +0000 (19:51 -0500)
extra/zealot/factor/factor.factor

index f6cbe0476256f94095fe9a9a4cb053735649946f..ac9f8b4d482ed0d4c11466d96b31c9ebaefd4ba2 100644 (file)
@@ -2,14 +2,16 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs bootstrap.image calendar cli.git
 combinators combinators.short-circuit concurrency.combinators
-environment formatting http.client io io.directories io.launcher
-io.pathnames kernel math.parser memory modern.paths namespaces
-parser.notes prettyprint regexp.classes sequences
-sequences.extras sets splitting system system-info threads
-tools.test tools.test.private vocabs vocabs.hierarchy
-vocabs.hierarchy.private vocabs.loader vocabs.metadata zealot ;
+environment formatting http.client io io.directories
+io.encodings.utf8 io.launcher io.pathnames kernel math.parser
+memory modern.paths namespaces parser.notes prettyprint
+regexp.classes sequences sequences.extras sets splitting system
+system-info threads tools.test tools.test.private vocabs
+vocabs.hierarchy vocabs.hierarchy.private vocabs.loader
+vocabs.metadata zealot ;
 IN: zealot.factor
 
+! XXX: Could check if it's a branch instead with a git command
 : git-checksum? ( str -- ? )
     { [ length 40 = ] [ [ hex-digit? ] all? ] } 1&& ;
 
@@ -25,7 +27,7 @@ IN: zealot.factor
     [ download-boot-checksum-branch ] if ;
 
 : download-boot-image ( path url -- )
-    '[ _  download ] with-directory ;
+    '[ _ my-arch-name "boot.%s.image" sprintf download-to ] with-directory ;
 
 : arch-git-boot-image-path ( arch git-id -- str )
     "https://downloads.factorcode.org/images/build/boot.%s.image.%s" sprintf ;
@@ -37,6 +39,8 @@ IN: zealot.factor
     download-boot-image ;
 
 HOOK: compile-factor-command os ( -- array )
+M: macosx compile-factor-command ( -- array )
+    { "arch" "-x86_64" "make" "-j" } cpus number>string suffix ;
 M: unix compile-factor-command ( -- array )
     { "make" "-j" } cpus number>string suffix ;
 M: windows compile-factor-command ( -- array )
@@ -59,7 +63,9 @@ M: windows factor-path "./factor.com" ;
 : bootstrap-factor ( path -- )
     [
         <process>
-            factor-path "-i=" my-boot-image-name append "-no-user-init" 3array >>command
+            factor-path "-i=" my-boot-image-name append "-no-user-init" 3array
+            os macosx = [ { "arch" "-x86_64" } prepend ] when
+                >>command
             +closed+ >>stdin
             "./bootstrap-log" >>stdout
             +stdout+ >>stderr
@@ -152,7 +158,7 @@ M: windows factor-path "./factor.com" ;
 : zealot-test-commands ( path -- )
      [
         32 <iota> [
-             load-and-test-command
+            load-and-test-command
         ] map [ try-process ] parallel-each
      ] with-directory ;
 
@@ -170,7 +176,7 @@ M: windows factor-path "./factor.com" ;
         [ try-process ] parallel-each
     ] with-directory ;
 
-: build-new-factor ( branch/checksum -- )
+: checkout-new-factor ( branch/checksum -- path branch/checksum )
     "factor" "factor" zealot-github-ensure drop
 
     [ "factor" "factor" zealot-github-clone-paths nip ] dip
@@ -179,14 +185,35 @@ M: windows factor-path "./factor.com" ;
         [ drop "factor" "factor" zealot-github-add-build-remote drop ]
         [ drop [ git-fetch-all* ] with-directory drop ]
         [ zealot-build-checkout drop ]
+        [ ]
+    } 2cleave ;
+
+: bootstrap-new-factor ( path branch/checksum -- path branch/checksum )
+    {
         [ "ZEALOT DOWNLOADING BOOT IMAGE" print flush download-my-boot-image ]
         [ "ZEALOT DOWNLOADING CHECKSUMS" print flush download-boot-checksums ]
         [ "ZEALOT COMPILING" print flush drop compile-factor ]
         [ "ZEALOT BOOTSTRAPPING" print flush drop bootstrap-factor ]
+        [ ]
+    } 2cleave ;
+
+: test-new-factor ( path branch/checksum -- )
+    {
         [ "ZEALOT LOADING ROOTS" print flush drop zealot-load-commands ]
         [ "ZEALOT TESTING ROOTS" print flush drop zealot-test-commands ]
     } 2cleave ;
 
+: check-new-factor ( path branch/checksum cmd -- out )
+    nip [ factor-path "-i=factor.image" ] dip "-e=%s" sprintf 3array
+    "./test-bisect-log" zealot-test-command
+    '[ _ utf8 [ read-contents ] with-process-reader ] with-directory ;
+
+: build-new-factor ( branch/checksum -- )
+    checkout-new-factor bootstrap-new-factor test-new-factor ;
+
+: bisect-new-factor ( branch/checksum cmd -- out )
+    [ checkout-new-factor bootstrap-new-factor ] dip check-new-factor ;
+
 : factor-clean-branch ( -- str )
     os cpu [ name>> ] bi@ { { CHAR: . CHAR: - } } substitute
     "-" glue "origin/clean-" prepend ;