Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that a registry has the correct versions of stripped packages #35

Merged
merged 1 commit into from
May 3, 2024
Merged
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
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