]> gitweb.factorcode.org Git - factor.git/commitdiff
build-from-source: use github api to get versions
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 18 Apr 2023 01:54:37 +0000 (20:54 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 18 Apr 2023 01:54:37 +0000 (20:54 -0500)
extra/build-from-source/build-from-source-tests.factor
extra/build-from-source/build-from-source.factor
extra/build-from-source/macosx/macosx.factor

index 97dad79e702d29fec86f24250ccdfb37b08f0bba..cead5dae6e9173a21398529bf432d67813420b20 100644 (file)
@@ -12,7 +12,7 @@ IN: build-from-source.tests
         "v3.11.0a7"
         "v3.11.0b1"
         "v3.11.0b5"
-    } latest-python3
+    } tags>latest-python3
 ] unit-test
 
 { "v3.11.0a2" } [
@@ -20,7 +20,7 @@ IN: build-from-source.tests
         "v3.10.10"
         "v3.11.0a1"
         "v3.11.0a2"
-    } latest-python3
+    } tags>latest-python3
 ] unit-test
 
 { "v3.11.0b5" } [
@@ -31,7 +31,7 @@ IN: build-from-source.tests
         "v3.11.0a7"
         "v3.11.0b1"
         "v3.11.0b5"
-    } latest-python3
+    } tags>latest-python3
 ] unit-test
 
 { "v3.11.0rc5" } [
@@ -44,7 +44,7 @@ IN: build-from-source.tests
         "v3.11.0b5"
         "v3.11.0rc5"
         "v3.11.0rc1"
-    } latest-python3
+    } tags>latest-python3
 ] unit-test
 
 { "v3.11.0" } [
@@ -58,5 +58,5 @@ IN: build-from-source.tests
         "v3.11.0b5"
         "v3.11.0rc5"
         "v3.11.0rc1"
-    } latest-python3
+    } tags>latest-python3
 ] unit-test
index fb5c465b83585cb08ec9328d10f1693324b8e0ac..f005193278c436d6472d7544f6345f13f981b8b1 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2023 Doug Coleman.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs cli.git combinators
-combinators.short-circuit formatting http.client io.directories
-io.files io.files.info io.files.temp io.launcher io.pathnames
-kernel layouts math namespaces sequences sorting.human
+combinators.short-circuit continuations formatting github
+http.client io.directories io.files io.files.info io.files.temp
+io.launcher io.pathnames json kernel layouts math namespaces
+semver sequences sequences.extras sorting sorting.human
 sorting.specification splitting system unicode ;
 IN: build-from-source
 
@@ -100,8 +101,20 @@ ERROR: no-output-file path ;
     { human<=> } sort-keys-with-spec
     last second human-sort last fourth ;
 
-: latest-python2 ( tags -- tag )
-    [ "v2." head? ] filter latest-python ;
+: latest-semver-tags-matching ( owner repo tag-head -- ref-json/f semver/f )
+    list-repository-tags-matching
+    [ "ref" of "/" split1-last nip [ >semver ] [ 2drop f ] recover ] zip-with
+    sift-values sort-values ?last ?first2 ;
 
-: latest-python3 ( tags -- tag )
-    [ "v3." head? ] filter latest-python ;
+: latest-solr ( -- tag-json semver ) "apache" "solr" "releases/solr" latest-semver-tags-matching ;
+: latest-lucene ( -- tag-json semver ) "apache" "lucene" "releases/lucene" latest-semver-tags-matching ;
+
+: python-tags ( -- tags )
+    "python" "cpython" "v" list-repository-tags-matching
+    [ "ref" of ] map
+    [ "refs/tags/" ?head drop ] map ;
+
+: tags>latest-python2 ( tags -- tag ) [ "v2." head? ] filter latest-python ;
+: latest-python2 ( -- tag ) python-tags tags>latest-python2 ;
+: tags>latest-python3 ( tags -- tag ) [ "v3." head? ] filter latest-python ;
+: latest-python3 ( -- tag ) python-tags tags>latest-python3 ;
index 893e76c7ac78d8f5ecc55797cdd4bcfab2fcffd5..8615e89ae6e551cc6499b7acff1b3b4691dedea8 100644 (file)
@@ -8,7 +8,7 @@ IN: build-from-source.macosx
 ! brew install pkg-config openssl@1.1 xz gdbm tcl-tk
 : build-python3-lib ( -- )
     "https://github.com/python/cpython" "cpython3" [
-        git-tag* latest-python3 git-checkout-existing* drop
+        latest-python3 git-checkout-existing* drop
         H{ } clone
         { "brew" "--prefix" "gdbm" } process-contents
         { "brew" "--prefix" "xz" } process-contents