Skip to content

Commit

Permalink
Merge pull request #35 from PumasAI/mh/multi-reg-handling
Browse files Browse the repository at this point in the history
Check that a registry has the correct versions of stripped packages
  • Loading branch information
MichaelHatherly authored May 3, 2024
2 parents 929a8a4 + a5f240e commit e1feef0
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/code_stripping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,28 +153,39 @@ function _generate_stripped_registry(;
found = false
for reg in registries
if haskey(reg, package_uuid)
found = true

info = get!(() -> _process_reg_info(reg), registry_info, reg.uuid)
pkg_entry = reg[package_uuid]
pkg_path = pkg_entry.path

stripped_info = get!(Dict, registry_contents, pkg_path)
for (k, v) in info[pkg_path]
k == "Versions.toml" && continue
stripped_info[k] = v
end
# Package versions may be split across multiple registries
# if they have been migrated from closed source to open, for
# example. We verify that the registry we're currently
# looking through has the package version that we want.
if haskey(
get(Dict{String,Any}, info[pkg_path], "Versions.toml"),
version,
)
found = true

versions_toml = get!(Dict{String,Any}, stripped_info, "Versions.toml")
versions_toml[version] = Dict{String,Any}("git-tree-sha1" => tree_hash)
stripped_info = get!(Dict, registry_contents, pkg_path)
for (k, v) in info[pkg_path]
k == "Versions.toml" && continue
stripped_info[k] = v
end

project_toml = get!(Dict{String,Any}, stripped_info, "Package.toml")
project_toml["repo"] = "{{PACKAGES}}/$package_name"
versions_toml =
get!(Dict{String,Any}, stripped_info, "Versions.toml")
versions_toml[version] =
Dict{String,Any}("git-tree-sha1" => tree_hash)

packages[string(package_uuid)] =
Dict("name" => pkg_entry.name, "path" => pkg_path)
project_toml = get!(Dict{String,Any}, stripped_info, "Package.toml")
project_toml["repo"] = "{{PACKAGES}}/$package_name"

break
packages[string(package_uuid)] =
Dict("name" => pkg_entry.name, "path" => pkg_path)

break
end
end
end
if !found
Expand Down

0 comments on commit e1feef0

Please sign in to comment.