From 9f633a546f7d5fcd98312b4d6aa45d37cd24b89c Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Wed, 21 Feb 2018 14:08:33 -0500 Subject: [PATCH] Pkg3: the great bikeshed rename --- stdlib/Pkg3/bin/generate.jl | 18 +++++++++--------- stdlib/Pkg3/bin/genstdlib.jl | 22 +++++++++++----------- stdlib/Pkg3/bin/gitmeta.jl | 4 ++-- stdlib/Pkg3/src/API.jl | 2 +- stdlib/Pkg3/src/Operations.jl | 28 ++++++++++++++-------------- stdlib/Pkg3/src/Types.jl | 8 ++++---- stdlib/Pkg3/test/pkg.jl | 2 +- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/stdlib/Pkg3/bin/generate.jl b/stdlib/Pkg3/bin/generate.jl index 826b86af98d44..01c51d71d91bb 100644 --- a/stdlib/Pkg3/bin/generate.jl +++ b/stdlib/Pkg3/bin/generate.jl @@ -2,7 +2,7 @@ prefix = joinpath(homedir(), ".julia", "registries", "Uncurated") -write_toml(prefix, "registry") do io +write_toml(prefix, "Registry") do io repo = "https://github.com/JuliaRegistries/Uncurated.git" uuid = string(uuid5(uuid_registry, repo)) println(io, "name = ", repr("Uncurated")) @@ -64,15 +64,15 @@ for (bucket, b_pkgs) in buckets, (pkg, p) in b_pkgs uuid = string(p.uuid) startswith(url, "git://github.com") && (url = "https"*url[4:end]) - # package.toml - write_toml(prefix, bucket, pkg, "package") do io + # Package.toml + write_toml(prefix, bucket, pkg, "Package") do io println(io, "name = ", repr(pkg)) println(io, "uuid = ", repr(uuid)) println(io, "repo = ", repr(url)) end - # versions.toml - write_toml(prefix, bucket, pkg, "versions") do io + # Versions.toml + write_toml(prefix, bucket, pkg, "Versions") do io for (i, (ver, v)) in enumerate(sort!(collect(p.versions), by=first)) i > 1 && println(io) println(io, "[", toml_key(string(ver)), "]") @@ -108,13 +108,13 @@ for (bucket, b_pkgs) in buckets, (pkg, p) in b_pkgs end end - # dependencies.toml - write_versions_data("dependencies") do dep, d + # Deps.toml + write_versions_data("Deps") do dep, d dep == "julia" ? nothing : repr(string(pkgs[dep].uuid)) end - # compatibility.toml - write_versions_data("compatibility", lt=packagelt) do dep, d + # Compat.toml + write_versions_data("Compat", lt=packagelt) do dep, d dep in STDLIBS ? nothing : versions_repr(compress_versions( d.versions, collect(keys(pkgs[dep].versions)) )) diff --git a/stdlib/Pkg3/bin/genstdlib.jl b/stdlib/Pkg3/bin/genstdlib.jl index 124096a0c9928..42d4dbea02689 100644 --- a/stdlib/Pkg3/bin/genstdlib.jl +++ b/stdlib/Pkg3/bin/genstdlib.jl @@ -27,7 +27,7 @@ for pkg in readdir(stdlibdir) end #= -write_toml(prefix, "registry") do io +write_toml(prefix, "Registry") do io repo = "https://github.com/JuliaRegistries/Stdlib.git" uuid = string(uuid5(uuid_registry, repo)) println(io, "name = ", repr("Stdlib")) @@ -50,24 +50,24 @@ for (pkg, uuid) in stdlib_uuids tree = stdlib_trees[pkg] deps = stdlib_deps[pkg] - # package.toml - write_toml(prefix, pkg, "package") do io + # Package.toml + write_toml(prefix, pkg, "Package") do io println(io, "name = ", repr(pkg)) println(io, "uuid = ", repr(uuid)) println(io, "repo = ", repr(url)) end - # versions.toml - write_toml(prefix, pkg, "versions") do io + # Versions.toml + write_toml(prefix, pkg, "Versions") do io println(io, "[", toml_key("0.7.0-DEV+r$(tree[1:8])"), "]") - println(io, "git-tree-sha1 = ", repr(tree)) + println(io, "tree.git.sha1 = ", repr(tree)) end - # dependencies.toml + # Deps.toml if isempty(deps) - rm(joinpath(prefix, pkg, "dependencies.toml"), force=true) + rm(joinpath(prefix, pkg, "Deps.toml"), force=true) else - write_toml(prefix, pkg, "dependencies") do io + write_toml(prefix, pkg, "Deps") do io println(io, "[", toml_key("0.7"), "]") for dep in sort!(deps, by=lowercase) println(io, "$dep = ", repr(stdlib_uuids[dep])) @@ -75,8 +75,8 @@ for (pkg, uuid) in stdlib_uuids end end - # compatibility.toml - write_toml(prefix, pkg, "compatibility") do io + # Compat.toml + write_toml(prefix, pkg, "Compat") do io println(io, "[", toml_key("0.7"), "]") println(io, "julia = \"0.7\"") end diff --git a/stdlib/Pkg3/bin/gitmeta.jl b/stdlib/Pkg3/bin/gitmeta.jl index d1b426523bcb4..3bf1062c4efd7 100644 --- a/stdlib/Pkg3/bin/gitmeta.jl +++ b/stdlib/Pkg3/bin/gitmeta.jl @@ -48,7 +48,7 @@ function gitmeta(pkgs::Dict{String,Package}) if ispath(fs) s = TOML.parsefile(fs) get(s, "STDLIBS", nothing) == STDLIBS || empty!(s) - mv(fs, "$fs.old", remove_destination=true) + mv(fs, "$fs.old", force=true) end s["STDLIBS"] = STDLIBS io = open(fs, "w") @@ -65,7 +65,7 @@ function gitmeta(pkgs::Dict{String,Package}) haskey(d, uuid) || (d[uuid] = Dict()) haskey(s, uuid) || (s[uuid] = Dict()) updated = false - repo_path = joinpath(homedir(), ".julia", "upstream", uuid) + repo_path = joinpath(homedir(), ".julia", "clones", uuid) repo = nothing for (ver, v) in p.versions haskey(d[uuid], v.sha1) && diff --git a/stdlib/Pkg3/src/API.jl b/stdlib/Pkg3/src/API.jl index e112ee5d20a97..4af4a9deec423 100644 --- a/stdlib/Pkg3/src/API.jl +++ b/stdlib/Pkg3/src/API.jl @@ -216,7 +216,7 @@ function gc(ctx::Context=Context(); period = Dates.Week(6), kwargs...) # If the manifest was not used gc_time = Dates.now() - period - usage_file = joinpath(logdir(), "usage.toml") + usage_file = joinpath(logdir(), "manifest_usage.toml") # Collect only the manifest that is least recently used manifest_date = Dict{String, Dates.DateTime}() diff --git a/stdlib/Pkg3/src/Operations.jl b/stdlib/Pkg3/src/Operations.jl index db2e8993b81db..73460cceb5b49 100644 --- a/stdlib/Pkg3/src/Operations.jl +++ b/stdlib/Pkg3/src/Operations.jl @@ -25,7 +25,7 @@ function find_installed(name::String, uuid::UUID, sha1::SHA1) end function load_versions(path::String) - toml = parse_toml(path, "versions.toml") + toml = parse_toml(path, "Versions.toml") return Dict{VersionNumber, SHA1}(VersionNumber(ver) => SHA1(info["git-tree-sha1"]) for (ver, info) in toml) end @@ -172,8 +172,8 @@ function deps_graph(ctx::Context, uuid_to_name::Dict{UUID,String}, reqs::Require for path in registered_paths(ctx.env, uuid) version_info = load_versions(path) versions = sort!(collect(keys(version_info))) - deps_data = load_package_data_raw(UUID, joinpath(path, "dependencies.toml")) - compatibility_data = load_package_data_raw(VersionSpec, joinpath(path, "compatibility.toml")) + deps_data = load_package_data_raw(UUID, joinpath(path, "Deps.toml")) + compat_data = load_package_data_raw(VersionSpec, joinpath(path, "Compat.toml")) union!(all_versions_u, versions) @@ -185,7 +185,7 @@ function deps_graph(ctx::Context, uuid_to_name::Dict{UUID,String}, reqs::Require other_uuid in uuids || push!(uuids, other_uuid) end end - for (vr, cd) in compatibility_data + for (vr, cd) in compat_data all_compat_u_vr = get_or_make!(all_compat_u, vr) for (name,vs) in cd # check conflicts?? @@ -260,15 +260,15 @@ end function version_data(ctx::Context, pkgs::Vector{PackageSpec}) names = Dict{UUID,String}() hashes = Dict{UUID,SHA1}() - upstreams = Dict{UUID,Vector{String}}() + clones = Dict{UUID,Vector{String}}() for pkg in pkgs pkg.uuid in ctx.stdlib_uuids && continue pkg.path == nothing || continue uuid = pkg.uuid ver = pkg.version::VersionNumber - upstreams[uuid] = String[] + clones[uuid] = String[] for path in registered_paths(ctx.env, uuid) - info = parse_toml(path, "package.toml") + info = parse_toml(path, "Package.toml") if haskey(names, uuid) names[uuid] == info["name"] || cmderror("$uuid: name mismatch between registries: ", @@ -277,7 +277,7 @@ function version_data(ctx::Context, pkgs::Vector{PackageSpec}) names[uuid] = info["name"] end repo = info["repo"] - repo in upstreams[uuid] || push!(upstreams[uuid], repo) + repo in clones[uuid] || push!(clones[uuid], repo) vers = load_versions(path) if haskey(vers, ver) h = vers[ver] @@ -291,8 +291,8 @@ function version_data(ctx::Context, pkgs::Vector{PackageSpec}) end @assert haskey(hashes, uuid) end - foreach(sort!, values(upstreams)) - return names, hashes, upstreams + foreach(sort!, values(clones)) + return names, hashes, clones end ######################## @@ -350,9 +350,9 @@ function install_git( version::Union{VersionNumber,Nothing}, version_path::String )::Nothing - upstream_dir = joinpath(depots()[1], "upstream") - ispath(upstream_dir) || mkpath(upstream_dir) - repo_path = joinpath(upstream_dir, string(uuid)) + clones_dir = joinpath(depots()[1], "clones") + ispath(clones_dir) || mkpath(clones_dir) + repo_path = joinpath(clones_dir, string(uuid)) repo = ispath(repo_path) ? LibGit2.GitRepo(repo_path) : begin @info("Cloning [$uuid] $name from $(urls[1])") LibGit2.clone(urls[1], repo_path, isbare=true) @@ -527,7 +527,7 @@ function update_manifest(env::EnvCache, pkg::PackageSpec, hash::Union{SHA1, Noth end else for path in registered_paths(env, uuid) - data = load_package_data(UUID, joinpath(path, "dependencies.toml"), version) + data = load_package_data(UUID, joinpath(path, "Deps.toml"), version) data == nothing && continue info["deps"] = Dict(string(k) => string(v) for (k,v) in data) break diff --git a/stdlib/Pkg3/src/Types.jl b/stdlib/Pkg3/src/Types.jl index ac6cead608c20..a0de53c0b560b 100644 --- a/stdlib/Pkg3/src/Types.jl +++ b/stdlib/Pkg3/src/Types.jl @@ -498,7 +498,7 @@ end function write_env_usage(manifest_file::AbstractString) !ispath(logdir()) && mkpath(logdir()) - usage_file = joinpath(logdir(), "usage.toml") + usage_file = joinpath(logdir(), "manifest_usage.toml") touch(usage_file) !isfile(manifest_file) && return # Do not rewrite as do syntax (no longer precompilable) @@ -657,7 +657,7 @@ function registries(depot::String)::Vector{String} d = joinpath(depot, "registries") ispath(d) || return String[] regs = filter!(readdir(d)) do r - isfile(joinpath(d, r, "registry.toml")) + isfile(joinpath(d, r, "Registry.toml")) end String[joinpath(depot, "registries", r) for r in regs] end @@ -759,7 +759,7 @@ function find_registered!( # search through all registries for registry in registries() - open(joinpath(registry, "registry.toml")) do io + open(joinpath(registry, "Registry.toml")) do io # skip forward until [packages] section for line in eachline(io) contains(line, r"^ \s* \[ \s* packages \s* \] \s* $"x) && break @@ -854,7 +854,7 @@ function registered_info(env::EnvCache, uuid::UUID, key::String) isempty(paths) && cmderror("`$uuid` is not registered") values = [] for path in paths - info = parse_toml(path, "package.toml") + info = parse_toml(path, "Package.toml") value = get(info, key, nothing) push!(values, (path, value)) end diff --git a/stdlib/Pkg3/test/pkg.jl b/stdlib/Pkg3/test/pkg.jl index 013650f4c6c68..b30aa0c66efb3 100644 --- a/stdlib/Pkg3/test/pkg.jl +++ b/stdlib/Pkg3/test/pkg.jl @@ -138,7 +138,7 @@ temp_pkg_dir() do project_path end @testset "check logging" begin - usage = Pkg3.TOML.parse(String(read(joinpath(Pkg3.logdir(), "usage.toml")))) + usage = Pkg3.TOML.parse(String(read(joinpath(Pkg3.logdir(), "manifest_usage.toml")))) @test any(x -> startswith(x, joinpath(project_path, "Manifest.toml")), keys(usage)) end