Is there any function that given the uuid of a package resolves to its name and its git repository, default to the registry in use ?
1 Like
Maybe resolve_versions! (https://github.com/JuliaLang/Pkg.jl/blob/13b7861518dcfceebfc01566c329a2b2faa62623/src/Operations.jl) is what you are looking for. But it looks like this function is not exported, unfortunately.
I was thinking more to something like this:
using PkgDeps
using UUIDs
struct PkgMetadata
uuid::UUID
name::String
repo::String
registry::String
path::String
end
function getPkgMetadata(uuid::UUID;registry_names::Array=[],depots::Union{String, Vector{String}}=Base.DEPOT_PATH)
registries = reachable_registries(registry_names;depots=depots)
for rego in registries
for (pkg_name, pkg_entry) in rego.pkgs
if pkg_entry.uuid == uuid
return PkgMetadata(pkg_entry.uuid,pkg_entry.name,pkg_entry.repo,pkg_entry.registry_path,pkg_entry.path)
end
end
end
return PkgMetadata(uuid,missing,missing,missing,missing)
end
getPkgMetadata(uuid::String;registry_names::Array=[],depots::Union{String, Vector{String}}=Base.DEPOT_PATH) = getPkgMetadata(UUID(uuid);registry_names=registry_names,depots=depots)
myPkgData = getPkgMetadata("024491cd-cc6b-443e-8034-08ea7eb7db2b")
(not tested on registries other than “General”)