Skip to content

Commit 291aa98

Browse files
committed
Use a layered depot for the compilation cache.
Now that precompile files are relocatable, we don't need to use overlays for this anymore.
1 parent 520b775 commit 291aa98

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/evaluate.jl

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,28 @@ function evaluate_test(config::Configuration, pkg::Package; use_cache::Bool=true
301301
# we create our own workdir so that we can reuse it
302302
workdir = mktempdir(prefix="pkgeval_$(pkg.name)_")
303303

304-
# caches are mutable, so they can get corrupted during a run. that's why it's possible
305-
# to run without them (in case of a retry), and is also why we set them up here rather
306-
# than in `sandboxed_julia` (because we know we've verified caches before entering here)
304+
local_depot_path = joinpath(config.home, ".julia")
305+
local_depot = joinpath(workdir, "depot")
306+
mkdir(local_depot)
307+
mounts[local_depot_path * ":rw"] = local_depot
308+
309+
# shared files are mounted using a layered depot
307310
if use_cache
308-
depot_dir = joinpath(config.home, ".julia")
311+
shared_depot_path = "/usr/local/share/julia"
309312

310313
shared_compilecache = get_compilecache(config)
311-
mounts[joinpath(depot_dir, "compiled")] = shared_compilecache
314+
mounts[joinpath(shared_depot_path, "compiled") * ":ro"] = shared_compilecache
312315

313316
shared_packages = joinpath(storage_dir, "packages")
314-
mounts[joinpath(depot_dir, "packages")] = shared_packages
317+
mounts[joinpath(shared_depot_path, "packages") * ":ro"] = shared_packages
315318

316319
shared_artifacts = joinpath(storage_dir, "artifacts")
317-
mounts[joinpath(depot_dir, "artifacts")] = shared_artifacts
320+
mounts[joinpath(shared_depot_path, "artifacts") * ":ro"] = shared_artifacts
321+
322+
# XXX: we also need to append the bundled depot path (JuliaLang/julia#51448)
323+
bundled_depot_path = joinpath(config.julia_install_dir, "share", "julia")
324+
env["JULIA_DEPOT_PATH"] =
325+
join([local_depot_path, shared_depot_path, bundled_depot_path], ":")
318326
end
319327

320328
# structured output will be written to the /output directory. this is to avoid having to
@@ -487,10 +495,9 @@ function evaluate_test(config::Configuration, pkg::Package; use_cache::Bool=true
487495

488496
# (cache and) clean-up output created by this package
489497
if use_cache
490-
depot_dir = joinpath(workdir, "upper", "home", "pkgeval", ".julia")
491-
local_compilecache = joinpath(depot_dir, "compiled")
492-
local_packages = joinpath(depot_dir, "packages")
493-
local_artifacts = joinpath(depot_dir, "artifacts")
498+
local_compilecache = joinpath(local_depot, "compiled")
499+
local_packages = joinpath(local_depot, "packages")
500+
local_artifacts = joinpath(local_depot, "artifacts")
494501

495502
# verify local resources
496503
registry_dir = get_registry(config)
@@ -507,8 +514,7 @@ function evaluate_test(config::Configuration, pkg::Package; use_cache::Bool=true
507514
(local_artifacts, shared_artifacts),
508515
(local_compilecache, shared_compilecache)]
509516
if isdir(src)
510-
# NOTE: removals (whiteouts) are represented as char devices
511-
run(`$(rsync()) --no-specials --no-devices --archive --quiet $(src)/ $(dst)/`)
517+
run(`$(rsync()) --archive --quiet $(src)/ $(dst)/`)
512518
end
513519
end
514520
end

0 commit comments

Comments
 (0)