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

Use RegistryInstances #201

Open
mortenpi opened this issue Sep 19, 2023 · 0 comments
Open

Use RegistryInstances #201

mortenpi opened this issue Sep 19, 2023 · 0 comments

Comments

@mortenpi
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant