@@ -55,7 +55,9 @@ function step4(state::WizardState, ur::Runner, platform::Platform,
55
55
println (state. outs)
56
56
57
57
if choice == 1
58
- return step3_interactive (state, prefix, platform, ur, build_path)
58
+ # Link dependencies into the prefix again
59
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
60
+ return step3_interactive (state, prefix, platform, ur, build_path, artifact_paths)
59
61
elseif choice == 2
60
62
state. step = :step3
61
63
return
@@ -183,13 +185,16 @@ script or proceed to step 4.
183
185
"""
184
186
function step3_interactive (state:: WizardState , prefix:: Prefix ,
185
187
platform:: Platform ,
186
- ur:: Runner , build_path:: AbstractString )
188
+ ur:: Runner , build_path:: AbstractString , artifact_paths :: Vector{String} )
187
189
188
190
if interactive_build (state, prefix, ur, build_path)
191
+ # Unsymlink all the deps from the dest_prefix before moving to the next step
192
+ cleanup_dependencies (prefix, artifact_paths)
189
193
state. step = :step3_retry
190
194
else
191
195
step3_audit (state, platform, joinpath (prefix, " destdir" ))
192
-
196
+ # Unsymlink all the deps from the dest_prefix before moving to the next step
197
+ cleanup_dependencies (prefix, artifact_paths)
193
198
return step4 (state, ur, platform, build_path, prefix)
194
199
end
195
200
end
@@ -209,7 +214,7 @@ function step3_retry(state::WizardState)
209
214
build_path = tempname ()
210
215
mkpath (build_path)
211
216
prefix = setup_workspace (build_path, state. source_files, state. source_hashes; verbose= false )
212
- setup_dependencies (prefix, state. dependencies, platform)
217
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
213
218
214
219
ur = preferred_runner ()(
215
220
prefix. path;
@@ -221,6 +226,8 @@ function step3_retry(state::WizardState)
221
226
run (ur, ` /bin/bash -c $(state. history) ` , io; verbose= true , tee_stream= state. outs)
222
227
end
223
228
step3_audit (state, platform, joinpath (prefix, " destdir" ))
229
+ # Unsymlink all the deps from the dest_prefix before moving to the next step
230
+ cleanup_dependencies (prefix, artifact_paths)
224
231
225
232
return step4 (state, ur, platform, build_path, prefix)
226
233
end
@@ -290,7 +297,7 @@ function step34(state::WizardState)
290
297
state. source_hashes;
291
298
verbose= false ,
292
299
)
293
- setup_dependencies (prefix, state. dependencies, platform)
300
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
294
301
295
302
provide_hints (state, joinpath (prefix. path, " srcdir" ))
296
303
@@ -303,7 +310,7 @@ function step34(state::WizardState)
303
310
platform= platform,
304
311
src_name= state. name,
305
312
)
306
- return step3_interactive (state, prefix, platform, ur, build_path)
313
+ return step3_interactive (state, prefix, platform, ur, build_path, artifact_paths )
307
314
end
308
315
309
316
function step5_internal (state:: WizardState , platform:: Platform )
@@ -321,10 +328,19 @@ function step5_internal(state::WizardState, platform::Platform)
321
328
build_path = tempname ()
322
329
mkpath (build_path)
323
330
local ok = false
331
+ # The code path in this function is rather complex (and unpredictable)
332
+ # due to the fact that the user makes the choices. Therefore we keep
333
+ # track of all the linked artifacts in a dictionary, and make sure to
334
+ # unlink them before setting up a new build prefix
335
+ prefix_artifacts = Dict {Prefix,Vector{String}} ()
324
336
while ! ok
325
337
cd (build_path) do
326
338
prefix = setup_workspace (build_path, state. source_files, state. source_hashes; verbose= true )
327
- setup_dependencies (prefix, state. dependencies, platform)
339
+ # Clean up artifacts in case there are some
340
+ cleanup_dependencies (prefix, get (prefix_artifacts, prefix, String[]))
341
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
342
+ # Record newly added artifacts for this prefix
343
+ prefix_artifacts[prefix] = artifact_paths
328
344
ur = preferred_runner ()(
329
345
prefix. path;
330
346
cwd= " /workspace/srcdir" ,
@@ -385,7 +401,12 @@ function step5_internal(state::WizardState, platform::Platform)
385
401
state. source_hashes;
386
402
verbose= true ,
387
403
)
388
- setup_dependencies (prefix, state. dependencies, platform)
404
+ # Clean up artifacts in case there are some
405
+ cleanup_dependencies (prefix, get (prefix_artifacts, prefix, String[]))
406
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
407
+ # Record newly added artifacts for this prefix
408
+ prefix_artifacts[prefix] = artifact_paths
409
+
389
410
ur = preferred_runner ()(
390
411
prefix. path;
391
412
cwd= " /workspace/srcdir" ,
@@ -432,6 +453,10 @@ function step5_internal(state::WizardState, platform::Platform)
432
453
println (state. outs)
433
454
end
434
455
end
456
+ # Unsymlink all the deps from the prefixes before moving to the next step
457
+ for (prefix, paths) in prefix_artifacts
458
+ cleanup_dependencies (prefix, paths)
459
+ end
435
460
return ok
436
461
end
437
462
@@ -507,7 +532,7 @@ function step5c(state::WizardState)
507
532
state. source_hashes;
508
533
verbose= false ,
509
534
)
510
- setup_dependencies (prefix, state. dependencies, platform)
535
+ artifact_paths = setup_dependencies (prefix, state. dependencies, platform)
511
536
ur = preferred_runner ()(
512
537
prefix. path;
513
538
cwd= " /workspace/srcdir" ,
@@ -535,6 +560,9 @@ function step5c(state::WizardState)
535
560
silent = true
536
561
))
537
562
563
+ # Unsymlink all the deps from the prefix before moving to the next platform
564
+ cleanup_dependencies (prefix, artifact_paths)
565
+
538
566
print (state. outs, " [" )
539
567
if ok
540
568
printstyled (state. outs, " ✓" , color= :green )
0 commit comments