Skip to content

Commit d4cb3d7

Browse files
authored
Save log files to logdir(prefix; subdir=src_name) (#1059)
This avoids clash between log files of different packages when mounting all of them together for a build.
1 parent 8b4e44a commit d4cb3d7

File tree

8 files changed

+52
-39
lines changed

8 files changed

+52
-39
lines changed

.github/workflows/documentation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
tags: '*'
88
pull_request:
99

10+
env:
11+
JULIA_PKG_SERVER: ""
12+
1013
jobs:
1114
build:
1215
runs-on: ubuntu-latest

Manifest.toml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
2828

2929
[[BinaryBuilderBase]]
3030
deps = ["CodecZlib", "Downloads", "InteractiveUtils", "JSON", "LibGit2", "Libdl", "Logging", "OutputCollectors", "Pkg", "Random", "SHA", "Scratch", "SimpleBufferStream", "TOML", "Tar", "UUIDs", "p7zip_jll", "pigz_jll"]
31-
git-tree-sha1 = "e3f4db24195c438d88e8753bab588a5385de2c6b"
31+
git-tree-sha1 = "56393545b3506aba0211c24d0de873e00788d3b8"
32+
repo-rev = "master"
33+
repo-url = "https://github.com/JuliaPackaging/BinaryBuilderBase.jl.git"
3234
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
33-
version = "0.6.3"
35+
version = "0.6.5"
3436

3537
[[CodecZlib]]
3638
deps = ["TranscodingStreams", "Zlib_jll"]
@@ -40,9 +42,9 @@ version = "0.7.0"
4042

4143
[[Compat]]
4244
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
43-
git-tree-sha1 = "0a817fbe51c976de090aa8c997b7b719b786118d"
45+
git-tree-sha1 = "0900bc19193b8e672d9cd477e6cd92d9e7c02f99"
4446
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
45-
version = "3.28.0"
47+
version = "3.29.0"
4648

4749
[[DataAPI]]
4850
git-tree-sha1 = "dfb3b7e89e395be1e25c2ad6d7690dc29cc53b1d"
@@ -86,9 +88,9 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
8688

8789
[[GitForge]]
8890
deps = ["Dates", "HTTP", "JSON2"]
89-
git-tree-sha1 = "ded1b4ce9518e7568bad8dc20171a34684e8c6d2"
91+
git-tree-sha1 = "0e6b8635059d6ac9e421825e75f8fca170f557d2"
9092
uuid = "8f6bce27-0656-5410-875b-07a5572985df"
91-
version = "0.1.6"
93+
version = "0.1.7"
9294

9395
[[GitHub]]
9496
deps = ["Base64", "Dates", "HTTP", "JSON", "MbedTLS", "Sockets", "SodiumSeal"]
@@ -233,9 +235,9 @@ uuid = "d8793406-e978-5875-9003-1fc021f44a92"
233235
version = "0.3.6"
234236

235237
[[OrderedCollections]]
236-
git-tree-sha1 = "4fa2ba51070ec13fcc7517db714445b4ab986bdf"
238+
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
237239
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
238-
version = "1.4.0"
240+
version = "1.4.1"
239241

240242
[[OutputCollectors]]
241243
git-tree-sha1 = "d86c19b7fa8ad6a4dc8ec2c726642cc6291b2941"
@@ -266,19 +268,19 @@ version = "0.2.0"
266268

267269
[[Preferences]]
268270
deps = ["TOML"]
269-
git-tree-sha1 = "ea79e4c9077208cd3bc5d29631a26bc0cff78902"
271+
git-tree-sha1 = "00cfd92944ca9c760982747e9a1d0d5d86ab1e5a"
270272
uuid = "21216c6a-2e73-6563-6e65-726566657250"
271-
version = "1.2.1"
273+
version = "1.2.2"
272274

273275
[[Printf]]
274276
deps = ["Unicode"]
275277
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
276278

277279
[[ProgressMeter]]
278280
deps = ["Distributed", "Printf"]
279-
git-tree-sha1 = "d85d8f0339a9937afac93e152c76f4745b386202"
281+
git-tree-sha1 = "1be8800271c86f572d334fef6e3b8364eaece7d9"
280282
uuid = "92933f4c-e287-5a05-a399-4b506db050ca"
281-
version = "1.6.0"
283+
version = "1.6.2"
282284

283285
[[REPL]]
284286
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
@@ -296,9 +298,9 @@ version = "0.2.0"
296298

297299
[[Registrator]]
298300
deps = ["AutoHashEquals", "Base64", "Dates", "Distributed", "FileWatching", "GitForge", "GitHub", "HTTP", "JSON", "LibGit2", "Logging", "MbedTLS", "Mocking", "Mustache", "Mux", "Pkg", "RegistryTools", "Serialization", "Sockets", "TimeToLive", "UUIDs", "ZMQ"]
299-
git-tree-sha1 = "fc49368213d6dcbacdc444120efa4babcf248dcc"
301+
git-tree-sha1 = "c7e033175c3b9b466fb2cc8beab47042878a66b0"
300302
uuid = "4418983a-e44d-11e8-3aec-9789530b3b3e"
301-
version = "1.2.3"
303+
version = "1.2.4"
302304

303305
[[RegistryTools]]
304306
deps = ["AutoHashEquals", "LibGit2", "Pkg", "UUIDs"]

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilder"
22
uuid = "12aac903-9f7c-5d81-afc2-d9565ea332ae"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "0.3.4"
4+
version = "0.3.5"
55

66
[deps]
77
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
@@ -33,7 +33,7 @@ ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"
3333

3434
[compat]
3535
ArgParse = "1.1"
36-
BinaryBuilderBase = "0.6.1"
36+
BinaryBuilderBase = "0.6.5"
3737
GitHub = "5.1"
3838
HTTP = "0.8, 0.9"
3939
JLD2 = "0.1.6, 0.2, 0.3, 0.4"

src/Auditor.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ include("auditor/codesigning.jl")
2424
# something can't be opened. Possibly use that within BinaryProvider too?
2525

2626
"""
27-
audit(prefix::Prefix; platform::AbstractPlatform = HostPlatform();
27+
audit(prefix::Prefix, src_name::AbstractString = "";
28+
io=stderr,
29+
platform::AbstractPlatform = HostPlatform(),
2830
verbose::Bool = false,
2931
silent::Bool = false,
3032
autofix::Bool = false,
31-
require_license::Bool = true)
33+
has_csl::Bool = true,
34+
require_license::Bool = true,
35+
)
3236
3337
Audits a prefix to attempt to find deployability issues with the binary objects
3438
that have been installed within. This auditing will check for relocatability
@@ -47,7 +51,8 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
4751
silent::Bool = false,
4852
autofix::Bool = false,
4953
has_csl::Bool = true,
50-
require_license::Bool = true)
54+
require_license::Bool = true,
55+
)
5156
# This would be really weird, but don't let someone set `silent` and `verbose` to true
5257
if silent
5358
verbose = false
@@ -107,13 +112,13 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
107112
# DO THIS ONE LAST as it can actually mutate the file, which causes the previous
108113
# checks to freak out a little bit.
109114
all_ok &= check_dynamic_linkage(oh, prefix, bin_files;
110-
platform, silent, verbose, autofix)
115+
platform, silent, verbose, autofix, src_name)
111116
end
112117
end
113118
end
114119

115120
# Ensure this file is codesigned (currently only does something on Apple platforms)
116-
all_ok &= ensure_codesigned(f, prefix, platform; verbose)
121+
all_ok &= ensure_codesigned(f, prefix, platform; verbose, subdir=src_name)
117122
catch e
118123
if !isa(e, ObjectFile.MagicMismatch)
119124
rethrow(e)
@@ -172,7 +177,7 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
172177
# Ensure that all libraries have at least some kind of SONAME, if we're
173178
# on that kind of platform
174179
if !Sys.iswindows(platform)
175-
all_ok &= ensure_soname(prefix, f, platform; verbose=verbose, autofix=autofix)
180+
all_ok &= ensure_soname(prefix, f, platform; verbose, autofix, subdir=src_name)
176181
end
177182

178183
# Ensure that this library is available at its own SONAME
@@ -306,7 +311,9 @@ function check_dynamic_linkage(oh, prefix, bin_files;
306311
platform::AbstractPlatform = HostPlatform(),
307312
verbose::Bool = false,
308313
silent::Bool = false,
309-
autofix::Bool = true)
314+
autofix::Bool = true,
315+
src_name::AbstractString = "",
316+
)
310317
all_ok = true
311318
# If it's a dynamic binary, check its linkage
312319
if isdynamic(oh)
@@ -331,7 +338,7 @@ function check_dynamic_linkage(oh, prefix, bin_files;
331338
if verbose
332339
@info("Rpathify'ing default library $(libname)")
333340
end
334-
relink_to_rpath(prefix, platform, path(oh), libs[libname]; verbose=verbose)
341+
relink_to_rpath(prefix, platform, path(oh), libs[libname]; verbose, subdir=src_name)
335342
end
336343
continue
337344
end
@@ -345,7 +352,7 @@ function check_dynamic_linkage(oh, prefix, bin_files;
345352
kidx = findfirst(known_bins .== lowercase(basename(libname)))
346353
if kidx !== nothing
347354
# If it is, point to that file instead!
348-
new_link = update_linkage(prefix, platform, path(oh), libs[libname], bin_files[kidx]; verbose=verbose)
355+
new_link = update_linkage(prefix, platform, path(oh), libs[libname], bin_files[kidx]; verbose, subdir=src_name)
349356

350357
if verbose && new_link !== nothing
351358
@info("Linked library $(libname) has been auto-mapped to $(new_link)")
@@ -379,7 +386,7 @@ function check_dynamic_linkage(oh, prefix, bin_files;
379386

380387
# If there is an identity mismatch (which only happens on macOS) fix it
381388
if autofix
382-
fix_identity_mismatch(prefix, platform, path(oh), oh; verbose=verbose)
389+
fix_identity_mismatch(prefix, platform, path(oh), oh; verbose, subdir=src_name)
383390
end
384391
end
385392
return all_ok

src/AutoBuild.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ function autobuild(dir::AbstractString,
747747
"""
748748

749749
dest_prefix = Prefix(BinaryBuilderBase.destdir(prefix.path, concrete_platform))
750-
did_succeed = with_logfile(dest_prefix, "$(src_name).log") do io
750+
did_succeed = with_logfile(dest_prefix, "$(src_name).log"; subdir=src_name) do io
751751
# Let's start the presentations with BinaryBuilder.jl
752752
write(io, "BinaryBuilder.jl version: $(get_bb_version())\n\n")
753753
# Get the list of compilers...
@@ -837,7 +837,7 @@ function autobuild(dir::AbstractString,
837837
end
838838

839839
# Compress log files
840-
compress_dir(joinpath(dest_prefix.path, "logs"), verbose=verbose)
840+
compress_dir(logdir(dest_prefix; subdir=src_name); verbose)
841841

842842
# Once we're built up, go ahead and package this dest_prefix out
843843
tarball_path, tarball_hash, git_hash = package(

src/auditor/codesigning.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ function check_codesigned(path::AbstractString, platform::AbstractPlatform)
88
return run(ur, `/usr/local/bin/ldid -d $(basename(path))`)
99
end
1010

11-
function ensure_codesigned(path::AbstractString, prefix::Prefix, platform::AbstractPlatform; verbose::Bool = false)
11+
function ensure_codesigned(path::AbstractString, prefix::Prefix, platform::AbstractPlatform;
12+
verbose::Bool = false, subdir::AbstractString="")
1213
# We only perform ad-hoc codesigning on Apple platforms
1314
if !Sys.isapple(platform)
1415
return true
1516
end
1617

1718
rel_path = relpath(path, prefix.path)
1819
ur = preferred_runner()(prefix.path; cwd="/workspace/", platform=platform)
19-
with_logfile(prefix, "ldid_$(basename(rel_path)).log") do io
20+
with_logfile(prefix, "ldid_$(basename(rel_path)).log"; subdir) do io
2021
run(ur, `/usr/local/bin/ldid -S -d $(rel_path)`, io; verbose=verbose)
2122
end
2223
end

src/auditor/dynamic_linkage.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function patchelf_flags(p::AbstractPlatform)
296296
end
297297

298298
function relink_to_rpath(prefix::Prefix, platform::AbstractPlatform, path::AbstractString,
299-
old_libpath::AbstractString; verbose::Bool = false)
299+
old_libpath::AbstractString; verbose::Bool=false, subdir::AbstractString="")
300300
ur = preferred_runner()(prefix.path; cwd="/workspace/", platform=platform)
301301
rel_path = relpath(path, prefix.path)
302302
libname = basename(old_libpath)
@@ -311,13 +311,13 @@ function relink_to_rpath(prefix::Prefix, platform::AbstractPlatform, path::Abstr
311311
end
312312

313313
# Create a new linkage that looks like @rpath/$lib on OSX
314-
with_logfile(prefix, "relink_to_rpath_$(basename(rel_path)).log") do io
314+
with_logfile(prefix, "relink_to_rpath_$(basename(rel_path)).log"; subdir) do io
315315
run(ur, relink_cmd, io; verbose=verbose)
316316
end
317317
end
318318

319319
function fix_identity_mismatch(prefix::Prefix, platform::AbstractPlatform, path::AbstractString,
320-
oh::ObjectHandle; verbose::Bool = false)
320+
oh::ObjectHandle; verbose::Bool=false, subdir::AbstractString="")
321321
# Only macOS needs to fix identity mismatches
322322
if !Sys.isapple(platform)
323323
return nothing
@@ -344,7 +344,7 @@ function fix_identity_mismatch(prefix::Prefix, platform::AbstractPlatform, path:
344344
id_cmd = `$install_name_tool -id $(new_id) $(rel_path)`
345345

346346
# Create a new linkage that looks like @rpath/$lib on OSX,
347-
with_logfile(prefix, "fix_identity_mismatch_$(basename(rel_path)).log") do io
347+
with_logfile(prefix, "fix_identity_mismatch_$(basename(rel_path)).log"; subdir) do io
348348
run(ur, id_cmd, io; verbose=verbose)
349349
end
350350
end
@@ -361,7 +361,7 @@ MacOS or `patchelf` on Linux. Windows platforms are completely skipped, as
361361
they do not encode paths or RPaths within their executables.
362362
"""
363363
function update_linkage(prefix::Prefix, platform::AbstractPlatform, path::AbstractString,
364-
old_libpath, new_libpath; verbose::Bool = false)
364+
old_libpath, new_libpath; verbose::Bool=false, subdir::AbstractString="")
365365
# Windows doesn't do updating of linkage
366366
if Sys.iswindows(platform)
367367
return
@@ -421,7 +421,7 @@ function update_linkage(prefix::Prefix, platform::AbstractPlatform, path::Abstra
421421
if !(new_libdir in canonical_rpaths(path))
422422
libname = basename(old_libpath)
423423
cmd = add_rpath(normalize_rpath(relpath(new_libdir, dirname(path))))
424-
with_logfile(prefix, "update_rpath_$(basename(path))_$(libname).log") do io
424+
with_logfile(prefix, "update_rpath_$(basename(path))_$(libname).log"; subdir) do io
425425
run(ur, cmd, io; verbose=verbose)
426426
end
427427
end
@@ -440,7 +440,7 @@ function update_linkage(prefix::Prefix, platform::AbstractPlatform, path::Abstra
440440
new_libpath = basename(new_libpath)
441441
end
442442
cmd = relink(old_libpath, new_libpath)
443-
with_logfile(prefix, "update_linkage_$(basename(path))_$(basename(old_libpath)).log") do io
443+
with_logfile(prefix, "update_linkage_$(basename(path))_$(basename(old_libpath)).log"; subdir) do io
444444
run(ur, cmd, io; verbose=verbose)
445445
end
446446

src/auditor/soname_matching.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ end
3939

4040

4141
function ensure_soname(prefix::Prefix, path::AbstractString, platform::AbstractPlatform;
42-
verbose::Bool = false, autofix::Bool = false)
42+
verbose::Bool = false, autofix::Bool = false, subdir::AbstractString="")
4343
# Skip any kind of Windows platforms
4444
if Sys.iswindows(platform)
4545
return true
@@ -75,7 +75,7 @@ function ensure_soname(prefix::Prefix, path::AbstractString, platform::AbstractP
7575
end
7676

7777
# Create a new linkage that looks like @rpath/$lib on OSX,
78-
retval = with_logfile(prefix, "set_soname_$(basename(rel_path))_$(soname).log") do io
78+
retval = with_logfile(prefix, "set_soname_$(basename(rel_path))_$(soname).log"; subdir) do io
7979
run(ur, set_soname_cmd, io; verbose=verbose)
8080
end
8181

0 commit comments

Comments
 (0)