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

[POC] Selectively override compat entries #2285

Closed
wants to merge 2 commits into from
Closed
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
33 changes: 33 additions & 0 deletions src/Registry/registry_instance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,42 @@ function init_package_info!(pkg::PkgEntry)

@init! pkg.info = PkgInfo(repo, subdir, version_info, compat, deps)

override_compat!(pkg)

return pkg.info
end

function override_compat!(pkg::PkgEntry)
filename = compat_override_filename()
if isfile(filename)
@info "Using compat override file at \"$(filename)\"" maxlog = 1
@warn "You are using the compat override feature. Use of this feature may cause packages to break. It is the responsibility of the user (not the maintainers of any packages) to solve any problems that arise from the use of this feature." maxlog = 1
all_overrides = TOML.parsefile(filename)
if haskey(all_overrides, string(pkg.uuid))
pkg_override = all_overrides[string(pkg.uuid)]
initialize_uncompressed!(pkg.info)
version_info = pkg.info.version_info
for version_number in keys(version_info)
version_number_info = version_info[version_number]
if haskey(pkg_override, string(version_number))
override = pkg_override[string(version_number)]
uncompressed_compat = version_number_info.uncompressed_compat
for uuid in keys(uncompressed_compat)
if haskey(override, string(uuid))
new_compat = Pkg.Types.semver_spec(override[string(uuid)])
uncompressed_compat[uuid] = new_compat
end
end
end
end
end
end
return pkg
end

function compat_override_filename()
return joinpath(homedir(), ".julia", "config", "compat-overrides.toml")
end

struct RegistryInstance
path::String
Expand Down