Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ jobs:
- run: rm -f versions.json

- name: Build versions.json
run: |
using VersionsJSONUtil

VersionsJSONUtil.main("versions.json")
shell: julia --project {0}
run: make versions.json

- name: Validate versions.json against schema
run: npx -p ajv-cli@3.3.0 ajv -s schema.json -d versions.json
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Usage: make versions.json

JULIA ?= julia +1.10

# This is the default target:
# It's a phony target because you might want to re-build versions.json even if none of the
# files in this repo have changed.
.PHONY: versions.json
versions.json:
JULIA_LOAD_PATH='@:@stdlib' $(JULIA) --startup-file=no --project -e 'import Pkg; Pkg.instantiate(); Pkg.precompile()'
JULIA_LOAD_PATH='@' $(JULIA) --startup-file=no --project -e 'import VersionsJSONUtil; VersionsJSONUtil.main("versions.json")'
58 changes: 29 additions & 29 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.11"
manifest_format = "2.0"
project_hash = "55efac5eb5e37942e9cd8fef54ac706b62080e7c"
project_hash = "cd1e7f27b424fe3225fdd0934f3bacdc1278b230"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand All @@ -22,9 +22,9 @@ version = "0.4.5"

[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "35ea197a51ce46fcd01c4a44befce0578a1aaeca"
git-tree-sha1 = "0761717147821d696c9470a7a86364b2fbd22fd8"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "4.5.0"
version = "4.5.2"
weakdeps = ["SparseArrays", "StaticArrays"]

[deps.Adapt.extensions]
Expand Down Expand Up @@ -193,9 +193,9 @@ version = "1.16.0"

[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "d8928e9169ff76c6281f39a659f9bca3a573f24c"
git-tree-sha1 = "5fab31e2e01e70ad66e3e24c968c264d1cf166d6"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.8.1"
version = "1.8.2"

[[deps.DataStructures]]
deps = ["OrderedCollections"]
Expand Down Expand Up @@ -241,9 +241,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.Distributions]]
deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"]
git-tree-sha1 = "fbcc7610f6d8348428f722ecbe0e6cfe22e672c6"
git-tree-sha1 = "12184a8cf11c7cbd90a4db8b2cb2f7b6f057cc46"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.123"
version = "0.25.124"

[deps.Distributions.extensions]
DistributionsChainRulesCoreExt = "ChainRulesCore"
Expand Down Expand Up @@ -368,9 +368,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"

[[deps.GLFW_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll", "libdecor_jll", "xkbcommon_jll"]
git-tree-sha1 = "b7bfd56fa66616138dfe5237da4dc13bbd83c67f"
git-tree-sha1 = "9e0fb9e54594c47f278d75063980e43066e26e20"
uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89"
version = "3.4.1+0"
version = "3.4.1+1"

[[deps.GR]]
deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Preferences", "Printf", "Qt6Wayland_jll", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "p7zip_jll"]
Expand Down Expand Up @@ -526,9 +526,9 @@ version = "1.5.0"

[[deps.JpegTurbo_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "b6893345fd6658c8e475d40155789f4860ac3b21"
git-tree-sha1 = "c0c9b76f3520863909825cbecdef58cd63de705a"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "3.1.4+0"
version = "3.1.5+0"

[[deps.JuliaInterpreter]]
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
Expand All @@ -550,9 +550,9 @@ version = "3.100.3+0"

[[deps.LERC_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "aaafe88dccbd957a8d82f7d05be9b69172e0cee3"
git-tree-sha1 = "17b94ecafcfa45e8360a4fc9ca6b583b049e4e37"
uuid = "88015f11-f218-50d7-93a8-a6af411a945d"
version = "4.0.1+0"
version = "4.1.0+0"

[[deps.LLVMOpenMP_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
Expand Down Expand Up @@ -636,9 +636,9 @@ version = "1.18.0+0"

[[deps.Libmount_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "97bbca976196f2a1eb9607131cb108c69ec3f8a6"
git-tree-sha1 = "cc3ad4faf30015a3e8094c9b5b7f19e85bdf2386"
uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9"
version = "2.41.3+0"
version = "2.42.0+0"

[[deps.Libtiff_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"]
Expand All @@ -648,9 +648,9 @@ version = "4.7.2+0"

[[deps.Libuuid_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "d0205286d9eceadc518742860bf23f703779a3d6"
git-tree-sha1 = "d620582b1f0cbe2c72dd1d5bd195a9ce73370ab1"
uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700"
version = "2.41.3+0"
version = "2.42.0+0"

[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
Expand Down Expand Up @@ -796,9 +796,9 @@ version = "1.6.1"

[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "c9cbeda6aceffc52d8a0017e71db27c7a7c0beaf"
git-tree-sha1 = "2ac022577e5eac7da040de17776d51bb770cd895"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.5.5+0"
version = "3.5.6+0"

[[deps.OpenSpecFun_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"]
Expand Down Expand Up @@ -1023,9 +1023,9 @@ version = "1.3.1"

[[deps.Revise]]
deps = ["CodeTracking", "FileWatching", "InteractiveUtils", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Preferences", "REPL", "UUIDs"]
git-tree-sha1 = "a44fc6ab46efc588f122ee71d6e2ca83b8645ff7"
git-tree-sha1 = "5f4f629c085b87e71125eec6773f5f872c74a47a"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.14.1"
version = "3.14.2"
weakdeps = ["Distributed"]

[deps.Revise.extensions]
Expand Down Expand Up @@ -1168,9 +1168,9 @@ version = "0.4.4"

[[deps.StructUtils]]
deps = ["Dates", "UUIDs"]
git-tree-sha1 = "fa95b3b097bcef5845c142ea2e085f1b2591e92c"
git-tree-sha1 = "aab80fbf866600f3299dd7f6656d80e7be177cfe"
uuid = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42"
version = "2.7.1"
version = "2.7.2"

[deps.StructUtils.extensions]
StructUtilsMeasurementsExt = ["Measurements"]
Expand Down Expand Up @@ -1318,9 +1318,9 @@ version = "1.6.1"

[[deps.XZ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "9cce64c0fdd1960b597ba7ecda2950b5ed957438"
git-tree-sha1 = "b29c22e245d092b8b4e8d3c09ad7baa586d9f573"
uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800"
version = "5.8.2+0"
version = "5.8.3+0"

[[deps.Xorg_libICE_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
Expand Down Expand Up @@ -1491,9 +1491,9 @@ version = "0.61.1+0"

[[deps.libaom_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "371cc681c00a3ccc3fbc5c0fb91f58ba9bec1ecf"
git-tree-sha1 = "850b06095ee71f0135d644ffd8a52850699581ed"
uuid = "a4ae2306-e953-59d6-aa16-d00cac43593b"
version = "3.13.1+0"
version = "3.13.3+0"

[[deps.libass_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Zlib_jll"]
Expand Down Expand Up @@ -1538,9 +1538,9 @@ version = "1.28.1+0"

[[deps.libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"]
git-tree-sha1 = "e2a7072fc0cdd7949528c1455a3e5da4122e1153"
git-tree-sha1 = "e51150d5ab85cee6fc36726850f0e627ad2e4aba"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.56+0"
version = "1.6.58+0"

[[deps.libva_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll", "Xorg_libXext_jll", "Xorg_libXfixes_jll", "libdrm_jll"]
Expand Down
9 changes: 8 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
name = "VersionsJSONUtil"
uuid = "a00667fb-7e89-46d8-a4ce-9a732f2f8be9"
authors = ["Elliot Saba <staticfloat@gmail.com>", "Sascha Mann <git@mail.saschamann.eu>"]
version = "0.1.0"
version = "0.1.0-DEV"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
WebCacheUtilities = "0c1c26de-fc5f-47ff-87a8-a157289a9bac"

[compat]
HTTP = "1"
JSON = "1"
Lazy = "0.15"
OrderedCollections = "1"
TimeZones = "1"
WebCacheUtilities = "0.1"
julia = "1.6"

[extras]
Expand Down
50 changes: 31 additions & 19 deletions src/VersionsJSONUtil.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
module VersionsJSONUtil

using HTTP, JSON, Pkg.BinaryPlatforms, WebCacheUtilities, SHA, Lazy
using HTTP: HTTP
using JSON: JSON
using Lazy: Lazy, @forward
using Pkg.BinaryPlatforms: Windows, MacOS, Linux, FreeBSD, libc, wordsize
using SHA: SHA, sha256
using WebCacheUtilities: WebCacheUtilities, hit_file_cache

# These two need to be `import` (not `using`), because we add methods to them:
import Pkg.BinaryPlatforms: triplet, arch
using OrderedCollections: OrderedDict

"Wrapper types to define three jlext methods for portable, tarball and installer Windows"
struct WindowsPortable
Expand Down Expand Up @@ -84,7 +92,7 @@ end
# We're going to collect the combinatorial explosion of version/os-arch possible downloads.
# We don't have a nice, neat list of what is or is not available, and so we're just going to
# try and download each file, and if it exists, yay. Otherwise, bleh.
julia_platforms = [
const julia_platforms = [
# *-linux-gnu
Linux(:x86_64; libc = :glibc),
Linux(:i686; libc = :glibc),
Expand Down Expand Up @@ -135,8 +143,10 @@ end
function main(out_path)
tags = get_tags()
tag_versions = filter(x -> x !== nothing, [vnum_maybe(basename(t["ref"])) for t in tags])
unique!(tag_versions)
sort!(tag_versions)

meta = Dict()
meta = OrderedDict()
number_urls_tried = 0
number_urls_success = 0
for version in tag_versions
Expand Down Expand Up @@ -171,10 +181,10 @@ function main(out_path)

# Initialize overall version key, if needed
if !haskey(meta, version)
meta[version] = Dict(
"stable" => is_stable(version),
"files" => Vector{Dict}(),
)
meta[version] = OrderedDict()
meta[version]["stable"] = is_stable(version)
meta[version]["files"] = Vector{OrderedDict}()
sort!(meta[version])
end

# Test to see if there is an asc signature:
Expand Down Expand Up @@ -211,29 +221,31 @@ function main(out_path)
else
error("Unsupported file extension in filename: $(filename)")
end
file_dict = Dict(
"triplet" => triplet(platform),
"os" => meta_os(platform),
"arch" => string(arch(platform)),
"version" => string(version),
"sha256" => tarball_hash,
"size" => filesize(filepath),
"kind" => kind,
"extension" => extension,
"url" => url,
)
file_dict = OrderedDict()
file_dict["triplet"] = triplet(platform)
file_dict["os"] = meta_os(platform)
file_dict["arch"] = string(arch(platform))
file_dict["version"] = string(version)
file_dict["sha256"] = tarball_hash
file_dict["size"] = filesize(filepath)
file_dict["kind"] = kind
file_dict["extension"] = extension
file_dict["url"] = url
# Add in `.asc` signature content, if applicable
if asc_signature !== nothing
file_dict["asc"] = asc_signature
end

# Explicitly sort the file_dict
sort!(file_dict)

# Right now, all we have are archives, but let's be forward-thinking
# and make this an array of dictionaries that is easy to extensibly match
push!(meta[version]["files"], file_dict)

# Write out new versions of our versions.json as we go
open(out_path, "w") do io
JSON.print(io, meta, 2)
JSON.print(io, meta; pretty_print = true, sort_keys = false)
end

# Delete downloaded file
Expand Down
Loading