Skip to content

Commit 8d34d65

Browse files
DilumAluthgestaticfloat
authored andcommitted
Enable automerging of JLL packages
1 parent 6cd9d55 commit 8d34d65

File tree

3 files changed

+38
-31
lines changed

3 files changed

+38
-31
lines changed

Manifest.toml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ git-tree-sha1 = "05916673a2627dd91b4969ff8ba6941bc85a960e"
2626
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
2727
version = "0.6.0"
2828

29-
[[ColorTypes]]
30-
deps = ["FixedPointNumbers", "Random"]
31-
git-tree-sha1 = "10050a24b09e8e41b951e9976b109871ce98d965"
32-
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
33-
version = "0.8.0"
34-
3529
[[DataAPI]]
3630
git-tree-sha1 = "674b67f344687a88310213ddfa8a2b3c76cc4252"
3731
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
@@ -58,19 +52,13 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
5852

5953
[[FileIO]]
6054
deps = ["Pkg"]
61-
git-tree-sha1 = "6c976460b85527d22d979682222d36767d95e27f"
55+
git-tree-sha1 = "80c17c711c41416eb0ac68347dc036be68b37682"
6256
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
63-
version = "1.1.0"
57+
version = "1.2.0"
6458

6559
[[FileWatching]]
6660
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
6761

68-
[[FixedPointNumbers]]
69-
deps = ["Test"]
70-
git-tree-sha1 = "b8045033701c3b10bf2324d7203404be7aef88ba"
71-
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
72-
version = "0.5.3"
73-
7462
[[GitForge]]
7563
deps = ["Dates", "HTTP", "JSON2"]
7664
git-tree-sha1 = "4469573ba6e4c262ba3c3018de2166c063ec5c2d"
@@ -112,9 +100,9 @@ version = "1.0.0"
112100

113101
[[JLD2]]
114102
deps = ["CodecZlib", "DataStructures", "FileIO", "Mmap", "Pkg", "Printf", "UUIDs"]
115-
git-tree-sha1 = "bce3df72340c8e03607b118028de22f3e3104f5d"
103+
git-tree-sha1 = "2c1a6d672f2b85a520d59e63851bc67226b06ba8"
116104
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
117-
version = "0.1.8"
105+
version = "0.1.10"
118106

119107
[[JSON]]
120108
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@@ -244,9 +232,9 @@ version = "1.1.0"
244232

245233
[[RegistryTools]]
246234
deps = ["AutoHashEquals", "LibGit2", "Pkg", "UUIDs"]
247-
git-tree-sha1 = "a3b6433e9ae527443cdec10ea868d3b98a463c23"
235+
git-tree-sha1 = "f9333ef8731c656815f3cc52cf73e2d56c4de6f4"
248236
uuid = "d1eb7eb1-105f-429d-abf5-b0f65cb9e2c4"
249-
version = "1.0.0"
237+
version = "1.1.0"
250238

251239
[[SHA]]
252240
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
@@ -298,12 +286,6 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
298286
[[Unicode]]
299287
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
300288

301-
[[VT100]]
302-
deps = ["ColorTypes", "FixedPointNumbers", "REPL", "Test"]
303-
git-tree-sha1 = "b15606f470e02061183738dd8d6d3ad5e115ed76"
304-
uuid = "7774df62-37c0-5c21-b34d-f6d7f98f54bc"
305-
version = "0.3.2"
306-
307289
[[WebSockets]]
308290
deps = ["Base64", "Dates", "Distributed", "HTTP", "Logging", "Random", "Sockets", "Test"]
309291
git-tree-sha1 = "13f763d38c7a05688938808b49cb29b18b60c8c8"

Project.toml

Lines changed: 1 addition & 1 deletion
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.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/AutoBuild.jl

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import GitHub: gh_get_json, DEFAULT_API
33
import SHA: sha256
44
using Pkg.TOML, Dates
55
using RegistryTools, Registrator
6+
import LibGit2
67

78
"""
89
build_tarballs(ARGS, src_name, src_version, sources, script, platforms,
@@ -420,21 +421,38 @@ function download_sources(sources::Vector; verbose::Bool = false)
420421
return output_sources
421422
end
422423

424+
function _registered_packages(registry_url::AbstractString)
425+
tmp_dir = mktempdir()
426+
atexit(() -> rm(tmp_dir; force = true, recursive = true))
427+
registry_dir = joinpath(tmp_dir, "REGISTRY")
428+
LibGit2.clone(registry_url, registry_dir)
429+
registry = TOML.parsefile(joinpath(registry_dir, "Registry.toml"))
430+
packages = Vector{String}(undef, 0)
431+
for p in registry["packages"]
432+
push!(packages, p[2]["name"])
433+
end
434+
rm(tmp_dir; force = true, recursive = true)
435+
return packages
436+
end
437+
438+
function _package_is_registered(registry_url::AbstractString,
439+
package::AbstractString)
440+
registered_packages = _registered_packages(registry_url)
441+
return package in registered_packages
442+
end
443+
423444
function register_jll(name, build_version, dependencies;
424445
deploy_repo="JuliaBinaryWrappers/$(name)_jll.jl",
425446
code_dir=joinpath(Pkg.devdir(), "$(name)_jll"),
426447
gh_auth=github_auth(;allow_anonymous=false),
427448
gh_username=gh_get_json(DEFAULT_API, "/user"; auth=gh_auth)["login"])
428-
# Create fork (if it does not already exist)
429-
fork = GitHub.create_fork("JuliaRegistries/General"; auth=gh_auth)
430-
431449
# Calculate tree hash of wrapper code
432450
wrapper_tree_hash = bytes2hex(Pkg.GitTools.tree_hash(code_dir))
433451

434452
# Use RegistryTools to push up a new `General` branch with this JLL package registered within it
435453
# TODO: Update our fork periodically from upstream `General`.
436454
cache = RegistryTools.RegistryCache(joinpath(Pkg.depots1(), "registries_binarybuilder"))
437-
registry_url = "https://$(gh_username):$(gh_auth.token)@github.com/$(gh_username)/General"
455+
registry_url = "https://$(gh_username):$(gh_auth.token)@github.com/JuliaRegistries/General"
438456
cache.registries[registry_url] = Base.UUID("23338594-aafe-5451-b93e-139f81909106")
439457
project = Pkg.Types.Project(build_project_dict(name, build_version, dependencies))
440458
reg_branch = RegistryTools.register(
@@ -448,12 +466,19 @@ function register_jll(name, build_version, dependencies;
448466
if haskey(reg_branch.metadata, "error")
449467
@error(reg_branch.metadata["error"])
450468
else
469+
upstream_registry_url = "https://github.com/JuliaRegistries/General"
470+
name_jll = "$(name)_jll"
471+
if _package_is_registered(upstream_registry_url, name_jll)
472+
pr_title = "New version: $(name_jll) v$(build_version)"
473+
else
474+
pr_title = "New package: $(name_jll) v$(build_version)"
475+
end
451476
# Open pull request against JuliaRegistries/General
452477
params = Dict(
453478
"base" => "master",
454-
"head" => "$(gh_username):$(reg_branch.branch)",
479+
"head" => "$(reg_branch.branch)",
455480
"maintainer_can_modify" => true,
456-
"title" => "JLL Registration: $(deploy_repo)-v$(build_version)",
481+
"title" => pr_title,
457482
"body" => """
458483
Autogenerated JLL package registration
459484

0 commit comments

Comments
 (0)