Skip to content

Commit 727c9f0

Browse files
giordanowsmoses
andauthored
[AutoBuild] Allow for registering JLLs outside of Yggdrasil (#1408)
* [AutoBuild] Add some debugging messages when pushing the JLL * [AutoBuild] Allow passing fork of registry repo * [AutoBuild] Allow passing different token for creating PR to registry * print * reg * remove unused print * Apply suggestions from code review * Update AutoBuild.jl --------- Co-authored-by: William S. Moses <[email protected]>
1 parent d6c93e3 commit 727c9f0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/AutoBuild.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ function register_jll(name, build_version, dependencies, julia_compat;
609609
gh_username=gh_get_json(DEFAULT_API, "/user"; auth=gh_auth)["login"],
610610
augment_platform_block::String="",
611611
lazy_artifacts::Bool=!isempty(augment_platform_block) && minimum_compat(julia_compat) < v"1.7",
612+
registry_url = "https://$(gh_username):$(gh_auth.token)@github.com/JuliaRegistries/General",
613+
registry_fork_url = registry_url,
614+
registry_fork_org = "JuliaRegistries",
615+
gh_auth_pr=gh_auth, # To open a PR we may in principle need a different token.
612616
kwargs...)
613617
if !isempty(augment_platform_block) && minimum_compat(julia_compat) < v"1.6"
614618
error("Augmentation blocks cannot be used with Julia v1.5-.\nChange `julia_compat` to require at least Julia v1.6")
@@ -621,7 +625,6 @@ function register_jll(name, build_version, dependencies, julia_compat;
621625
# Use RegistryTools to push up a new `General` branch with this JLL package registered within it
622626
# TODO: Update our fork periodically from upstream `General`.
623627
cache = RegistryTools.RegistryCache(joinpath(Pkg.depots1(), "registries_binarybuilder"))
624-
registry_url = "https://$(gh_username):$(gh_auth.token)@github.com/JuliaRegistries/General"
625628
cache.registries[registry_url] = Base.UUID("23338594-aafe-5451-b93e-139f81909106")
626629
jllwrappers_compat = DEFAULT_JLLWRAPPERS_VERSION_SPEC
627630
project = Pkg.Types.Project(build_project_dict(name, build_version, dependencies, julia_compat; jllwrappers_compat, lazy_artifacts, augment_platform_block))
@@ -633,6 +636,7 @@ function register_jll(name, build_version, dependencies, julia_compat;
633636
project_file,
634637
wrapper_tree_hash;
635638
registry=registry_url,
639+
registry_fork=registry_fork_url,
636640
cache=cache,
637641
push=true,
638642
checks_triggering_error = errors,
@@ -665,12 +669,13 @@ function register_jll(name, build_version, dependencies, julia_compat;
665669
end
666670
params = Dict(
667671
"base" => "master",
668-
"head" => "$(reg_branch.branch)",
672+
"head" => "$(registry_fork_org):$(reg_branch.branch)",
669673
"maintainer_can_modify" => true,
670674
"title" => pr_title,
671675
"body" => body,
672676
)
673-
Wizard.create_or_update_pull_request("JuliaRegistries/General", params; auth=gh_auth)
677+
@debug "Opening pull request" params reg_branch deploy_repo
678+
Wizard.create_or_update_pull_request("JuliaRegistries/General", params; auth=gh_auth_pr)
674679
end
675680
end
676681

@@ -1771,8 +1776,10 @@ function push_jll_package(name, build_version;
17711776
wrapper_repo = LibGit2.GitRepo(code_dir)
17721777
LibGit2.add!(wrapper_repo, ".")
17731778
commit = LibGit2.commit(wrapper_repo, "$(namejll(name)) build $(build_version)")
1779+
refspecs = ["refs/heads/main"]
1780+
remoteurl = "https://github.com/$(deploy_repo).git"
1781+
@debug "Pushing the JLL" wrapper_repo refspecs commit remoteurl
17741782
Wizard.with_gitcreds("x-access-token", gh_auth.token) do creds
1775-
refspecs = ["refs/heads/main"]
17761783
# Fetch the remote repository, to have the relevant refspecs up to date.
17771784
LibGit2.fetch(
17781785
wrapper_repo;
@@ -1783,7 +1790,7 @@ function push_jll_package(name, build_version;
17831790
LibGit2.push(
17841791
wrapper_repo;
17851792
refspecs=refspecs,
1786-
remoteurl="https://github.com/$(deploy_repo).git",
1793+
remoteurl,
17871794
credentials=creds,
17881795
)
17891796
end

0 commit comments

Comments
 (0)