Skip to content

Commit

Permalink
read the Registry from the tar ball
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 12, 2021
1 parent be98c6a commit 895bc9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/Registry/Registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Registry
import ..Pkg
using ..Pkg: depots1, printpkgstyle, DEFAULT_IO, isdir_nothrow, pathrepr, pkg_server,
GitTools, OFFLINE_MODE, UPDATED_REGISTRY_THIS_SESSION
using ..Pkg.PlatformEngines: download_verify_unpack, download
using ..Pkg.PlatformEngines: download_verify_unpack, download, download_verify
using UUIDs, LibGit2

include("tar_filesystem.jl")
Expand Down Expand Up @@ -170,12 +170,15 @@ function download_registries(io::IO, regs::Vector{RegistrySpec}, depot::String=d
end
# clone to tmpdir first
if registry_read_from_tarball()
regpath = joinpath(depot, "registries", registry.uuid, ".tar.gz")
url, registry_urls = pkg_server_registry_url(reg.uuid, registry_urls)
regpath = joinpath(depot, "registries", string(reg.uuid) * ".tar.gz")
tmp = tempname()
try
download_verify(url, nothing, regpath, ignore_existence = true)
download_verify(url, nothing, tmp)
catch err
Pkg.Types.pkgerror("could not download $url")
end
mv(tmp, regpath; force=true)
else
mktempdir() do tmp
url, registry_urls = pkg_server_registry_url(reg.uuid, registry_urls)
Expand Down
17 changes: 12 additions & 5 deletions src/Registry/registry_instance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,18 @@ function reachable_registries(; depots::Union{String, Vector{String}}=Base.DEPOT
for d in depots
isdir(d) || continue
reg_dir = joinpath(d, "registries")
isdir(reg_dir) || continue
for name in readdir(reg_dir)
file = joinpath(reg_dir, name, "Registry.toml")
isfile(file) || continue
push!(registries, RegistryInstance(joinpath(reg_dir, name); parse_packages))
ispath(reg_dir) || continue
if isfile(reg_dir)
elseif isdir(reg_dir)
for name in readdir(reg_dir)
if isfile(joinpath(reg_dir, name))
push!(registries, RegistryInstance(joinpath(reg_dir, name); parse_packages))
else
file = joinpath(reg_dir, name, "Registry.toml")
isfile(file) || continue
push!(registries, RegistryInstance(joinpath(reg_dir, name); parse_packages))
end
end
end
end
return registries
Expand Down

0 comments on commit 895bc9a

Please sign in to comment.