Skip to content

Commit

Permalink
Remove yanked releases when collecting available version.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Sep 7, 2018
1 parent dfee552 commit 134368c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ function find_installed(name::String, uuid::UUID, sha1::SHA1)
return abspath(depots1(), "packages", name, slug_default)
end

function load_versions(path::String)
function load_versions(path::String; include_yanked = false)
toml = parse_toml(path, "Versions.toml")
return Dict{VersionNumber, SHA1}(VersionNumber(ver) => SHA1(info["git-tree-sha1"]) for (ver, info) in toml)
yanked = [VersionNumber(v) for v in get(toml, "yanked", String[])]
delete!(toml, "yanked")
d = Dict{VersionNumber, SHA1}(VersionNumber(ver) => SHA1(info["git-tree-sha1"]) for (ver, info) in toml)
include_yanked || foreach(v -> delete!(d, v), yanked)
return d
end

function load_package_data(f::Base.Callable, path::String, versions)
Expand Down Expand Up @@ -66,7 +70,7 @@ end
function set_maximum_version_registry!(env::EnvCache, pkg::PackageSpec)
pkgversions = Set{VersionNumber}()
for path in registered_paths(env, pkg.uuid)
pathvers = keys(load_versions(path))
pathvers = keys(load_versions(path); include_yanked = true) # ??
union!(pkgversions, pathvers)
end
if length(pkgversions) == 0
Expand Down Expand Up @@ -255,7 +259,7 @@ function deps_graph(ctx::Context, uuid_to_name::Dict{UUID,String}, reqs::Require
end
else
for path in registered_paths(ctx.env, uuid)
version_info = load_versions(path)
version_info = load_versions(path; include_yanked = false)
versions = sort!(collect(keys(version_info)))
deps_data = load_package_data_raw(UUID, joinpath(path, "Deps.toml"))
compat_data = load_package_data_raw(VersionSpec, joinpath(path, "Compat.toml"))
Expand Down Expand Up @@ -403,7 +407,7 @@ function version_data!(ctx::Context, pkgs::Vector{PackageSpec})
end
repo = info["repo"]
repo in clones[uuid] || push!(clones[uuid], repo)
vers = load_versions(path)
vers = load_versions(path; include_yanked = true)
if haskey(vers, ver)
h = vers[ver]
if haskey(hashes, uuid)
Expand Down

0 comments on commit 134368c

Please sign in to comment.