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
2 changes: 1 addition & 1 deletion 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 = "297ab27881cec0a85c719648b28381580e85162c"
project_hash = "55efac5eb5e37942e9cd8fef54ac706b62080e7c"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
WebCacheUtilities = "0c1c26de-fc5f-47ff-87a8-a157289a9bac"

Expand Down
6 changes: 0 additions & 6 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
"sha256": {
"type": "string"
},
"git-tree-sha1": {
"type": "string"
},
"git-tree-sha256": {
"type": "string"
},
"size": {
"type": "integer"
},
Expand Down
63 changes: 15 additions & 48 deletions src/VersionsJSONUtil.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module VersionsJSONUtil

using HTTP, JSON, Pkg.BinaryPlatforms, WebCacheUtilities, SHA, Lazy
using Tar: Tar
import Pkg.BinaryPlatforms: triplet, arch
import Pkg.PlatformEngines: exe7z

"Wrapper types to define three jlext methods for portable, tarball and installer Windows"
struct WindowsPortable
Expand Down Expand Up @@ -111,11 +109,6 @@ julia_platforms = [
FreeBSD(:x86_64),
]

const tarball_git_tree_hash_skiplist = [
# Corrupt gzip stream: `7z` reports a CRC failure for the embedded tarball.
"https://julialang-s3.julialang.org/bin/linux/x86/0.7/julia-0.7.0-alpha-linux-i686.tar.gz",
]

function vnum_maybe(x::AbstractString)
try
return VersionNumber(x)
Expand All @@ -129,10 +122,6 @@ function is_stable(v::VersionNumber)
return v.prerelease == () && v.build == ()
end

function tarball_git_tree_hash(; tarball_path::AbstractString, algorithm::AbstractString)
return open(io -> Tar.tree_hash(io; algorithm), `$(exe7z()) x $tarball_path -so`)
end

# Get list of tags from the Julia repo
function get_tags()
@info("Probing for tag list...")
Expand Down Expand Up @@ -171,22 +160,6 @@ function main(out_path)
number_urls_success += 1
println(stdout, " ✓")

if endswith(filename, ".dmg")
kind = "archive"
extension = "dmg"
elseif endswith(filename, ".exe")
kind = "installer"
extension = "exe"
elseif endswith(filename, ".tar.gz")
kind = "archive"
extension = "tar.gz"
elseif endswith(filename, ".zip")
kind = "archive"
extension = "zip"
else
error("Unsupported file extension in filename: $(filename)")
end

tarball_hash_path = hit_file_cache("$(filename).sha256") do tarball_hash_path
open(filepath, "r") do io
open(tarball_hash_path, "w") do hash_io
Expand All @@ -196,24 +169,6 @@ function main(out_path)
end
tarball_hash = String(read(tarball_hash_path))

if extension == "tar.gz" && !(url in tarball_git_tree_hash_skiplist)
tarball_git_tree_hashes = Dict{String, String}()
tree_hash_path_sha1 = hit_file_cache("$(filename).git-tree-sha1") do tree_hash_path
open(tree_hash_path, "w") do hash_io
write(hash_io, tarball_git_tree_hash(; tarball_path=filepath, algorithm="git-sha1"))
end
end
tree_hash_path_sha256 = hit_file_cache("$(filename).git-tree-sha256") do tree_hash_path
open(tree_hash_path, "w") do hash_io
write(hash_io, tarball_git_tree_hash(; tarball_path=filepath, algorithm="git-sha256"))
end
end
tarball_git_tree_hashes["git-tree-sha1"] = String(read(tree_hash_path_sha1))
tarball_git_tree_hashes["git-tree-sha256"] = String(read(tree_hash_path_sha256))
else
tarball_git_tree_hashes = nothing
end

# Initialize overall version key, if needed
if !haskey(meta, version)
meta[version] = Dict(
Expand Down Expand Up @@ -241,6 +196,21 @@ function main(out_path)
end

# Build up metadata about this file
if endswith(filename, ".dmg")
kind = "archive"
extension = "dmg"
elseif endswith(filename, ".exe")
kind = "installer"
extension = "exe"
elseif endswith(filename, ".tar.gz")
kind = "archive"
extension = "tar.gz"
elseif endswith(filename, ".zip")
kind = "archive"
extension = "zip"
else
error("Unsupported file extension in filename: $(filename)")
end
file_dict = Dict(
"triplet" => triplet(platform),
"os" => meta_os(platform),
Expand All @@ -252,9 +222,6 @@ function main(out_path)
"extension" => extension,
"url" => url,
)
if tarball_git_tree_hashes !== nothing
merge!(file_dict, tarball_git_tree_hashes)
end
# Add in `.asc` signature content, if applicable
if asc_signature !== nothing
file_dict["asc"] = asc_signature
Expand Down
Loading