@@ -212,21 +212,24 @@ function diff_srcdir(state::WizardState, prefix::Prefix, ur::Runner)
212
212
return false
213
213
end
214
214
215
- function bb_add (client, state:: WizardState , prefix:: Prefix , platform:: AbstractPlatform , jll:: AbstractString )
215
+ function bb_add (client, state:: WizardState , prefix:: Prefix , prefix_artifacts :: Union{Dict{Prefix,Vector{String}}, Nothing} , platform:: AbstractPlatform , jll:: AbstractString )
216
216
if any (dep-> getpkg (dep). name == jll, state. dependencies)
217
217
println (client, " ERROR: Package was already added" )
218
218
return
219
219
end
220
+ if prefix_artifacts === nothing
221
+ println (client, " ERROR: `bb add` not available in this context (if you think it should be, file an issue)!" )
222
+ return
223
+ end
220
224
new_dep = Dependency (jll)
221
225
try
222
226
# This will redo some work, but that may be ok
223
227
concrete_platform = get_concrete_platform (platform, state)
224
228
# Clear out the prefix artifacts directory in case this change caused
225
229
# any previous dependencies to change
226
- let artifacts_dir = joinpath (prefix, " artifacts" )
227
- isdir (artifacts_dir) && rm (artifacts_dir; recursive= true )
228
- end
229
- setup_dependencies (prefix, getpkg .([state. dependencies; new_dep]), concrete_platform)
230
+ cleanup_dependencies (prefix, get (prefix_artifacts, prefix, String[]), concrete_platform)
231
+ pkgs = getpkg .([state. dependencies; new_dep])
232
+ prefix_artifacts[prefix] = setup_dependencies (prefix, pkgs, concrete_platform)
230
233
push! (state. dependencies, new_dep)
231
234
catch e
232
235
showerror (client, e)
@@ -253,7 +256,7 @@ function bb_parser()
253
256
s
254
257
end
255
258
256
- function setup_bb_service (state:: WizardState , prefix, platform)
259
+ function setup_bb_service (state:: WizardState , prefix, platform, prefix_artifacts :: Union{Dict{Prefix,Vector{String}}, Nothing} )
257
260
fpath = joinpath (prefix, " metadir" , " bb_service" )
258
261
server = listen (fpath)
259
262
@async begin
@@ -273,7 +276,7 @@ function setup_bb_service(state::WizardState, prefix, platform)
273
276
parsed = parse_args (ARGS , s)
274
277
if parsed == nothing
275
278
elseif parsed[" %COMMAND%" ] == " add"
276
- bb_add (client, state, prefix, platform, parsed[" add" ][" jll" ])
279
+ bb_add (client, state, prefix, prefix_artifacts, platform, parsed[" add" ][" jll" ])
277
280
end
278
281
close (client)
279
282
catch e
305
308
function interactive_build (state:: WizardState , prefix:: Prefix ,
306
309
ur:: Runner , build_path:: AbstractString ,
307
310
platform:: AbstractPlatform ;
311
+ prefix_artifacts:: Union{Dict{Prefix,Vector{String}}, Nothing} = nothing ,
308
312
hist_modify = string, srcdir_overlay = true )
309
313
histfile = joinpath (prefix, " metadir" , " .bash_history" )
310
314
cmd = ` /bin/bash -l`
@@ -325,7 +329,7 @@ function interactive_build(state::WizardState, prefix::Prefix,
325
329
cmd = ` /bin/bash -c $cmd `
326
330
end
327
331
328
- (fpath, server) = setup_bb_service (state, prefix, platform)
332
+ (fpath, server) = setup_bb_service (state, prefix, platform, prefix_artifacts )
329
333
330
334
script_successful = run_interactive (ur, ignorestatus (cmd), stdin = state. ins, stdout = state. outs, stderr = state. outs)
331
335
@@ -407,7 +411,7 @@ function step3_interactive(state::WizardState, prefix::Prefix,
407
411
ur:: Runner , build_path:: AbstractString , artifact_paths:: Vector{String} )
408
412
409
413
concrete_platform = get_concrete_platform (platform, state)
410
- if interactive_build (state, prefix, ur, build_path, platform)
414
+ if interactive_build (state, prefix, ur, build_path, platform; prefix_artifacts = Dict (prefix => artifact_paths) )
411
415
# Unsymlink all the deps from the dest_prefix before moving to the next step
412
416
cleanup_dependencies (prefix, artifact_paths, concrete_platform)
413
417
state. step = :step3_retry
@@ -617,6 +621,7 @@ function step5_internal(state::WizardState, platform::AbstractPlatform)
617
621
618
622
if choice == 1
619
623
if interactive_build (state, prefix, ur, build_path, platform;
624
+ prefix_artifacts = prefix_artifacts,
620
625
hist_modify = function (olds, s)
621
626
"""
622
627
$olds
@@ -658,6 +663,7 @@ function step5_internal(state::WizardState, platform::AbstractPlatform)
658
663
)
659
664
660
665
if interactive_build (state, prefix, ur, build_path, platform;
666
+ prefix_artifacts = prefix_artifacts,
661
667
hist_modify = function (olds, s)
662
668
"""
663
669
if [ \$ target != "$(triplet (platform)) " ]; then
0 commit comments