Skip to content

Commit c024c83

Browse files
authored
Fix BBB to run on latest master (#97)
1 parent 940ce9b commit c024c83

File tree

9 files changed

+146
-152
lines changed

9 files changed

+146
-152
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737

3838
steps:
3939
- uses: actions/checkout@v2
40-
- name: Setup Julia
41-
run: |
42-
curl -LsS "https://github.com/JuliaPackaging/BinaryBuilderBase.jl/releases/download/tmp/julia-377aa809eb-linux64.tar.gz" | tar -xz
43-
echo "${PWD}/julia-377aa809eb/bin" >> ${GITHUB_PATH}
40+
- uses: julia-actions/setup-julia@v1
41+
with:
42+
version: "1.6-nightly"
43+
arch: x64
4444
- uses: julia-actions/julia-buildpkg@latest
4545
- name: System info
4646
run: julia --project=. --color=yes -e "using BinaryBuilderBase; BinaryBuilderBase.versioninfo()"
@@ -56,7 +56,7 @@ jobs:
5656
- uses: actions/checkout@v2
5757
- uses: julia-actions/setup-julia@latest
5858
with:
59-
version: nightly
59+
version: 1.6-nightly
6060
- name: Cache artifacts
6161
uses: actions/cache@v2
6262
env:

Artifacts.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,28 @@ os = "linux"
24762476
sha256 = "8b685aa858e864049c3d95b59a3763b2e6236d7af9f49f357287da4d4802aa47"
24772477
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Rootfs-v2021.1.12/Rootfs.v2021.1.12.x86_64-linux-musl.unpacked.tar.gz"
24782478

2479+
[["Rootfs.v2021.1.22.x86_64-linux-musl.squashfs"]]
2480+
arch = "x86_64"
2481+
git-tree-sha1 = "c00439a5aac2cd79e14acf22c6fd329297be0559"
2482+
lazy = true
2483+
libc = "musl"
2484+
os = "linux"
2485+
2486+
[["Rootfs.v2021.1.22.x86_64-linux-musl.squashfs".download]]
2487+
sha256 = "0ac9b959afd58282751e0ca04b13cf8fc090e18f43dee03d3b27a964318f5136"
2488+
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Rootfs-v2021.1.22/Rootfs.v2021.1.22.x86_64-linux-musl.squashfs.tar.gz"
2489+
2490+
[["Rootfs.v2021.1.22.x86_64-linux-musl.unpacked"]]
2491+
arch = "x86_64"
2492+
git-tree-sha1 = "e61855d1fe79df053c1d5ebfe0c7e75e8b899b23"
2493+
lazy = true
2494+
libc = "musl"
2495+
os = "linux"
2496+
2497+
[["Rootfs.v2021.1.22.x86_64-linux-musl.unpacked".download]]
2498+
sha256 = "aac80e9ba2f6551fe5eee54c23de2a5bb0bc3d3173a591df0a1c67bab5b9fd55"
2499+
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Rootfs-v2021.1.22/Rootfs.v2021.1.22.x86_64-linux-musl.unpacked.tar.gz"
2500+
24792501
[["RustBase.v1.43.0.x86_64-linux-musl.squashfs"]]
24802502
arch = "x86_64"
24812503
git-tree-sha1 = "bcd3deb4047a5fdae6abf9808da90e7de1be3924"

Manifest.toml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ deps = ["LibCURL_jll", "MozillaCACerts_jll"]
4343
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
4444

4545
[[LibCURL_jll]]
46-
deps = ["Libdl"]
46+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
4747
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
4848

4949
[[LibGit2]]
5050
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
5151
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
5252

53+
[[LibSSH2_jll]]
54+
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
55+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
56+
5357
[[Libdl]]
5458
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
5559

@@ -60,6 +64,10 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
6064
deps = ["Base64"]
6165
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
6266

67+
[[MbedTLS_jll]]
68+
deps = ["Artifacts", "Libdl"]
69+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
70+
6371
[[Mmap]]
6472
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
6573

@@ -99,6 +107,12 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
99107
[[SHA]]
100108
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
101109

110+
[[Scratch]]
111+
deps = ["Dates"]
112+
git-tree-sha1 = "ad4b278adb62d185bbcb6864dc24959ab0627bf6"
113+
uuid = "6c6a2e73-6563-6170-7368-637461726353"
114+
version = "1.0.3"
115+
102116
[[Serialization]]
103117
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
104118

@@ -136,16 +150,16 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
136150
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
137151

138152
[[Zlib_jll]]
139-
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
140-
git-tree-sha1 = "32085929ad61a5ed99abea288ec7242be392bb8b"
153+
deps = ["Libdl"]
141154
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
142-
version = "1.2.12+0"
155+
156+
[[nghttp2_jll]]
157+
deps = ["Artifacts", "Libdl"]
158+
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
143159

144160
[[p7zip_jll]]
145-
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
146-
git-tree-sha1 = "ee65cfa19bea645698a0224bfa216f2b1c8b559f"
161+
deps = ["Artifacts", "Libdl"]
147162
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
148-
version = "16.2.0+3"
149163

150164
[[pigz_jll]]
151165
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ OutputCollectors = "6c11c7d4-943b-4e2b-80de-f2cfc2930a8c"
1515
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1616
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1717
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
18+
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
1819
SimpleBufferStream = "777ac1f9-54b0-4bf8-805c-2214025038e7"
1920
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
2021
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"

src/BinaryBuilderBase.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module BinaryBuilderBase
33
using Pkg, Pkg.Artifacts, Random, Libdl, InteractiveUtils
44
using Base.BinaryPlatforms
55
using Downloads
6-
using JSON, OutputCollectors
6+
using JSON, OutputCollectors, Scratch
77

88
# Re-export useful stuff from Base.BinaryPlatforms:
99
export HostPlatform, platform_dlext, valid_dl_path, arch, libc,

src/Prefix.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -453,22 +453,23 @@ function setup_dependencies(prefix::Prefix, dependencies::Vector{PkgSpec}, platf
453453
Pkg.Types.PackageSpec(name=p.name, uuid=u, tree_hash=p.tree_hash) for (u, p) in ctx.env.manifest if endswith(p.name, "_jll")
454454
]
455455

456-
# Some JLLs are also standard libraries that may be present in the
457-
# manifest because pulled by other stdlibs. Filter them out if they're
458-
# present in the manifest but aren't direct dependencies or dependencies
459-
# of other JLLS.
456+
# Some JLLs are also standard libraries that may be present in the manifest because
457+
# they were pulled by other stdlibs (e.g. through dependence on `Pkg`), not beacuse
458+
# they were actually required for this package. Filter them out if they're present
459+
# in the manifest but aren't direct dependencies or dependencies of other JLLS.
460460
manifest = TOML.parsefile(ctx.env.manifest_file)
461461
dependencies_names = Set(getfield.(dependencies, :name))
462-
jlls = collect_jlls(manifest, dependencies_names)
463-
for jll in filter(s -> endswith(s, "_jll"), collect(values(Pkg.Types.stdlibs())))
464-
if jll jlls
465-
filter!(p -> p.name != jll, installed_jlls)
466-
end
467-
end
462+
jll_direct_deps = collect_jlls(manifest, dependencies_names)
463+
filter!(jll -> jll.name jll_direct_deps, installed_jlls)
468464

469465
# Load their Artifacts.toml files
470466
for dep in installed_jlls
471-
dep_path = Pkg.Operations.source_path(ctx, dep)
467+
local dep_path
468+
if dep.tree_hash === nothing
469+
dep_path = Pkg.Types.stdlib_path(dep.name)
470+
else
471+
dep_path = Pkg.Operations.find_installed(dep.name, dep.uuid, dep.tree_hash)
472+
end
472473
name = getname(dep)
473474

474475
# Skip dependencies that didn't get installed?
@@ -480,26 +481,25 @@ function setup_dependencies(prefix::Prefix, dependencies::Vector{PkgSpec}, platf
480481
# Load the Artifacts.toml file
481482
artifacts_toml = joinpath(dep_path, "Artifacts.toml")
482483
if !isfile(artifacts_toml)
483-
@warn("Dependency $(name) does not have an Artifacts.toml at $(artifacts_toml)!")
484-
continue
485-
end
486-
487-
# Get the path to the main artifact
488-
artifact_hash = Pkg.Artifacts.artifact_hash(name[1:end-4], artifacts_toml; platform=platform)
489-
if artifact_hash === nothing
490-
@warn("Dependency $(name) does not have a mapping for artifact $(name[1:end-4]) for platform $(platform)")
491-
continue
484+
# Try `StdlibArtifacts.toml` instead
485+
artifacts_toml = joinpath(dep_path, "StdlibArtifacts.toml")
486+
if !isfile(artifacts_toml)
487+
@warn("Dependency $(name) does not have an (Stdlib)Artifacts.toml in $(dep_path)!")
488+
continue
489+
end
492490
end
493491

494492
# If the artifact is available for the given platform, make sure it
495-
# is also installed. It may not be the case for lazy artifacts
493+
# is also installed. It may not be the case for lazy artifacts or stdlibs.
496494
meta = artifact_meta(name[1:end-4], artifacts_toml; platform=platform)
497-
if meta !== nothing
498-
ensure_artifact_installed(name[1:end-4], meta, artifacts_toml; platform=platform)
495+
if meta === nothing
496+
@warn("Dependency $(name) does not have a mapping for artifact $(name[1:end-4]) for platform $(triplet(platform))")
497+
continue
499498
end
499+
ensure_artifact_installed(name[1:end-4], meta, artifacts_toml; platform=platform)
500500

501501
# Copy the artifact from the global installation location into this build-specific artifacts collection
502-
src_path = Pkg.Artifacts.artifact_path(artifact_hash)
502+
src_path = Pkg.Artifacts.artifact_path(Base.SHA1(meta["git-tree-sha1"]))
503503
dest_path = joinpath(prefix, triplet(platform), "artifacts", basename(src_path))
504504
cp(src_path, dest_path)
505505

src/Rootfs.jl

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -121,33 +121,38 @@ function all_compiler_shards()
121121
return ALL_SHARDS[]
122122
end
123123

124+
function shard_source_artifact_hash(cs::CompilerShard)
125+
artifacts_toml = joinpath(dirname(@__DIR__), "Artifacts.toml")
126+
name = artifact_name(cs)
127+
hash = artifact_hash(
128+
name,
129+
artifacts_toml;
130+
platform=cs.host,
131+
)
132+
if hash === nothing
133+
error("Compiler shard $(name) for platform $(triplet(something(cs.target, cs.host))) not found in $(artifacts_toml)")
134+
end
135+
return hash
136+
end
137+
124138
"""
125139
shard_path(cs::CompilerShard)
126140
127141
Return the path to this shard on-disk; for unpacked shards, this is a directory.
128142
For squashfs shards, this is a file. This will not cause a shard to be downloaded.
129143
"""
130-
function shard_path(cs::CompilerShard)
131-
if cs.shard_type == :squashfs
132-
mutable_artifacts_toml = joinpath(dirname(@__DIR__), "MutableArtifacts.toml")
133-
artifacts_dict = artifact_meta(
134-
artifact_name(cs),
135-
artifacts_toml;
136-
platform=something(cs.target, cs.host),
137-
)
138-
end
144+
function shard_path(cs::CompilerShard; uid = getuid())
145+
hash = shard_source_artifact_hash(cs)
139146

140-
artifacts_toml = joinpath(dirname(@__DIR__), "Artifacts.toml")
141-
artifacts_dict = artifact_meta(
142-
artifact_name(cs),
143-
artifacts_toml;
144-
platform=something(cs.target, cs.host),
145-
)
146-
if artifacts_dict == nothing
147-
error("CompilerShard $(artifact_name(cs)) not registered in Artifacts.toml!")
147+
# .squashfs files get modified per-UID
148+
if cs.archive_type == :squashfs
149+
# Store the UID-altered .squashfs in a scratchspace specific to this artifact,
150+
# and keyed by the name/UUID. This allows old scratchspaces to be cleaned up
151+
# as artifacts are retired, and also for multiple users to share a scratchspace.
152+
return joinpath(@get_scratch!(bytes2hex(hash.bytes)), "$(artifact_name(cs))_$(getuid()).squashfs")
148153
end
149154

150-
return artifact_path(artifacts_dict["git-tree-sha1"])
155+
return artifact_path(hash)
151156
end
152157

153158
"""
@@ -481,7 +486,7 @@ consists of four shards, but that may not always be the case.
481486
"""
482487
function choose_shards(p::AbstractPlatform;
483488
compilers::Vector{Symbol} = [:c],
484-
rootfs_build::VersionNumber=v"2021.1.12",
489+
rootfs_build::VersionNumber=v"2021.1.22",
485490
ps_build::VersionNumber=v"2021.01.28",
486491
GCC_builds::Vector{GCCBuild}=available_gcc_builds,
487492
LLVM_builds::Vector{LLVMBuild}=available_llvm_builds,
@@ -931,33 +936,3 @@ function unmount_shards(ur::Runner; verbose::Bool = false)
931936
catch
932937
end
933938
end
934-
935-
936-
937-
"""
938-
create_and_bind_mutable_artifact!(f::Function, art_name::String)
939-
940-
Create (and bind) an artifact to `MutableArtifacts.toml` in one fell swoop.
941-
Used in things like .squashfs UID remapping and BB wizard state serialization.
942-
"""
943-
function create_and_bind_mutable_artifact!(f::Function, art_name::String)
944-
mutable_artifacts_toml = joinpath(dirname(@__DIR__), "MutableArtifacts.toml")
945-
art_hash = create_artifact(f)
946-
bind_artifact!(mutable_artifacts_toml, art_name, art_hash; force=true)
947-
end
948-
949-
"""
950-
get_mutable_artifact_path(art_name::String)
951-
952-
Convenience wrapper to get an artifact bound within `MutableArtifacts.toml`.
953-
Returns `nothing` if artifact not bound yet.
954-
"""
955-
function get_mutable_artifact_path(art_name::String)
956-
mutable_artifacts_toml = joinpath(dirname(@__DIR__), "MutableArtifacts.toml")
957-
hash = artifact_hash(art_name, mutable_artifacts_toml)
958-
if hash === nothing
959-
return nothing
960-
end
961-
962-
return artifact_path(hash)
963-
end

0 commit comments

Comments
 (0)