Skip to content

Commit

Permalink
Merge pull request #1966 from JuliaLang/backports-release-1.5
Browse files Browse the repository at this point in the history
Backports release 1.5
  • Loading branch information
KristofferC committed Aug 19, 2020
2 parents edc31a2 + 6671851 commit aaf4e6e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -2,7 +2,7 @@ language: julia

julia:
# - 1.0
- 1.4
- 1.5
- nightly

os:
Expand Down
12 changes: 10 additions & 2 deletions src/API.jl
Expand Up @@ -828,9 +828,17 @@ function instantiate(ctx::Context; manifest::Union{Bool, Nothing}=nothing,
# check if all source code and artifacts are downloaded to exit early
Operations.is_instantiated(ctx) && return

Types.update_registries(ctx)
pkgs = Operations.load_all_deps(ctx)
Operations.check_registered(ctx, pkgs)
try
# First try without updating the registry
Operations.check_registered(ctx, pkgs)
catch e
if !(e isa PkgError) || update_registries == false
rethrow(e)
end
Types.update_registries(ctx)
Operations.check_registered(ctx, pkgs)
end
new_git = UUID[]
# Handling packages tracking repos
for pkg in pkgs
Expand Down
19 changes: 17 additions & 2 deletions src/Operations.jl
Expand Up @@ -116,11 +116,18 @@ end
function update_manifest!(ctx::Context, pkgs::Vector{PackageSpec}, deps_map)
manifest = ctx.env.manifest
empty!(manifest)
if ctx.env.pkg !== nothing
pkgs = [pkgs; ctx.env.pkg]
end
for pkg in pkgs
entry = PackageEntry(;name = pkg.name, version = pkg.version, pinned = pkg.pinned,
tree_hash = pkg.tree_hash, path = pkg.path, repo = pkg.repo)
is_stdlib(pkg.uuid) && (entry.version = nothing) # do not set version for stdlibs
entry.deps = deps_map[pkg.uuid]
if Types.is_project(ctx, pkg)
entry.deps = ctx.env.project.deps
else
entry.deps = deps_map[pkg.uuid]
end
ctx.env.manifest[pkg.uuid] = entry
end
prune_manifest(ctx)
Expand Down Expand Up @@ -1245,6 +1252,10 @@ function update_package_pin!(ctx::Context, pkg::PackageSpec, entry::PackageEntry
end
end

function update_package_pin!(ctx::Context, pkg::PackageSpec, ::Nothing)
pkgerror("package $(err_rep(pkg)) not found in the manifest, run `Pkg.resolve()` and retry.")
end

function pin(ctx::Context, pkgs::Vector{PackageSpec})
foreach(pkg -> update_package_pin!(ctx, pkg, manifest_info(ctx, pkg.uuid)), pkgs)
pkgs = load_direct_deps(ctx, pkgs)
Expand Down Expand Up @@ -1322,6 +1333,7 @@ function gen_test_code(testfile::String;
--inline=$(Bool(Base.JLOptions().can_inline) ? "yes" : "no")
--startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no")
--track-allocation=$(("none", "user", "all")[Base.JLOptions().malloc_log + 1])
--threads=$(Threads.nthreads())
$(julia_args)
--eval $(code)
```
Expand Down Expand Up @@ -1690,6 +1702,9 @@ function print_status(ctx::Context, old_ctx::Union{Nothing,Context}, header::Sym
xs = sort!(xs, by = (x -> (is_stdlib(x[1]), something(x[3], x[2]).name, x[1])))
all_packages_downloaded = true
for (uuid, old, new) in xs
if Types.is_project_uuid(ctx, uuid)
continue
end
pkg_downloaded = !is_instantiated(new) || is_package_downloaded(ctx, new)
all_packages_downloaded &= pkg_downloaded
print(ctx.io, pkg_downloaded ? " " : not_installed_indicator)
Expand Down Expand Up @@ -1731,7 +1746,7 @@ end
function status(ctx::Context, pkgs::Vector{PackageSpec}=PackageSpec[];
header=nothing, mode::PackageMode=PKGMODE_PROJECT, git_diff::Bool=false, env_diff=nothing)
ctx.io == Base.devnull && return
# if a packge, print header
# if a package, print header
if header === nothing && ctx.env.pkg !== nothing
printstyled(ctx.io, "Project "; color=Base.info_color(), bold=true)
println(ctx.io, ctx.env.pkg.name, " v", ctx.env.pkg.version)
Expand Down
2 changes: 1 addition & 1 deletion src/PlatformEngines.jl
Expand Up @@ -947,7 +947,7 @@ Given a `.tar.gz` filepath, return a dictionary of symlinks in the archive
function list_tarball_symlinks(tarball_path::AbstractString)
output = get_tarball_contents(tarball_path; verbose_tar = true)
mm = [m.captures for m in eachmatch(parse_symlinks(), output)]
symlinks = [m[1] => joinpath(dirname(m[1]), m[2]) for m in mm]
symlinks = [String(m[1]) => joinpath(dirname(m[1]), m[2]) for m in mm if m[1] !== nothing && m[2] !== nothing]
return symlinks
end

Expand Down
31 changes: 24 additions & 7 deletions test/new.jl
Expand Up @@ -2376,13 +2376,30 @@ end

@testset "not collecting multiple package instances #1570" begin
isolate(loaded_depot=true) do
Pkg.generate("A")
Pkg.generate("B")
Pkg.activate("B")
Pkg.develop(Pkg.PackageSpec(path="A"))
Pkg.activate(".")
Pkg.develop(Pkg.PackageSpec(path="A"))
Pkg.develop(Pkg.PackageSpec(path="B"))
cd_tempdir() do dir
Pkg.generate("A")
Pkg.generate("B")
Pkg.activate("B")
Pkg.develop(Pkg.PackageSpec(path="A"))
Pkg.activate(".")
Pkg.develop(Pkg.PackageSpec(path="A"))
Pkg.develop(Pkg.PackageSpec(path="B"))
end
end
end

@testset "cyclic dependency graph" begin
isolate(loaded_depot=true) do
cd_tempdir() do dir
Pkg.generate("A")
Pkg.generate("B")
Pkg.activate("A")
Pkg.develop(path="B")
git_init_and_commit("A")
Pkg.activate("B")
# This shouldn't error even though A has a dependency on B
Pkg.add(path="A")
end
end
end

Expand Down

0 comments on commit aaf4e6e

Please sign in to comment.