Skip to content

Use RegistryInstances #201

@mortenpi

Description

@mortenpi

I'm not actually that knowledgeable about RegistryInstances, but I think (hope) that it would allow us to get rid of all the custom registry parsing we do here:

function installable_on_version(reg::UnifiedRegistryInfo, version)
allpkgs = Dict()
pkgpaths = map(x -> x.metadir, collect(values(reg.info)))
filter!(isdir, pkgpaths)
if isempty(pkgpaths)
@error "No package folders found inside the registry"
return allpkgs
end
for pkg in pkgpaths
"Compat.toml" in readdir(pkg) || continue
pkgtoml = Pkg.TOML.parsefile(joinpath(pkg, "Package.toml"))
versions = Pkg.TOML.parsefile(joinpath(pkg, "Versions.toml"))
compat = Pkg.TOML.parsefile(joinpath(pkg, "Compat.toml"))
compatible_versions = VersionNumber[]
for pkgver in keys(compat)
try
if haskey(compat[pkgver], "julia")
if any(in.(version, Pkg.Types.VersionRange.(compat[pkgver]["julia"])))
append!(compatible_versions, [
VersionNumber(v) for v in keys(versions) if
VersionNumber(v) in Pkg.Types.VersionRange(pkgver)
])
end
else
append!(compatible_versions, [
VersionNumber(v) for v in keys(versions) if
VersionNumber(v) in Pkg.Types.VersionRange(pkgver)
])
end
catch err
@error err
end
end
allpkgs[pkgtoml["uuid"]] = (
name = pkgtoml["name"],
url = pkgtoml["repo"],
uuid = pkgtoml["uuid"],
path = pkg,
versions = compatible_versions,
)
end
allpkgs
end

And also it would hopefully support the zipped up registry format out of the box as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions