]> gitweb.factorcode.org Git - factor.git/commitdiff
boostrap.image.upload: if we are in master or main, upload boot images to both
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 16 Mar 2023 23:39:28 +0000 (18:39 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 16 Mar 2023 23:39:28 +0000 (18:39 -0500)
basis/bootstrap/image/upload/upload.factor

index 4061ffc098595563acb7af2ff4b79a30e8d9e2fd..0ca221eddb8bca37e8771ce7b42e5e9198887fb7 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! Copyright (C) 2015 Doug Coleman.
 ! See https://factorcode.org/license.txt for BSD license.
-USING: bootstrap.image checksums checksums.openssl io
+USING: arrays bootstrap.image checksums checksums.openssl io
 io.directories io.encodings.ascii io.encodings.utf8 io.files
 io.files.temp io.files.unique io.launcher io.pathnames kernel
 make math.parser namespaces sequences splitting system unicode ;
@@ -27,11 +27,13 @@ SYMBOL: build-images-destination
         [ unicode:blank? ] trim-tail
     ] with-directory ;
 
-: git-branch-destination ( -- dest )
+: git-branch-destinations ( -- dests )
     build-images-destination get
     "sheeple@downloads.factorcode.org:downloads.factorcode.org/images/"
     or
-    factor-git-branch "/" 3append ;
+    factor-git-branch dup { "master" "main" } member?
+    [ drop { "master" "main" } ] [ 1array ] if
+    [ "/" 3append ] with map ;
 
 : checksums-path ( -- temp ) "checksums.txt" temp-file ;
 
@@ -51,13 +53,16 @@ SYMBOL: build-images-destination
 : scp-name ( -- path ) "scp" ;
 
 : upload-images ( -- )
-    [
-        \ scp-name get-global scp-name or ,
-        "-4" , ! force ipv4
-        boot-image-names %
-        checksums-path ,
-        git-branch-destination [ print flush ] [ , ] bi
-    ] { } make try-process ;
+    git-branch-destinations [
+        [
+            [
+                \ scp-name get-global scp-name or ,
+                "-4" , ! force ipv4
+                boot-image-names %
+                checksums-path ,
+            ] { } make
+        ] dip suffix try-process
+    ] each ;
 
 : append-build ( path -- path' )
     vm-git-id "." glue ;