Skip to content

Commit 3eb83ae

Browse files
authored
[AutoBuild] Add revision on Yggdrasil to the registration PR (#993)
1 parent fe019a6 commit 3eb83ae

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

src/AutoBuild.jl

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export build_tarballs, autobuild, print_artifacts_toml, build, get_meta_json
22
import GitHub: gh_get_json, DEFAULT_API
33
import SHA: sha256, sha1
44
using Pkg.TOML, Dates, UUIDs
5-
using RegistryTools, Registrator
5+
using RegistryTools
66
import LibGit2
77
import PkgLicenses
88

@@ -447,6 +447,10 @@ function _package_is_registered(registry_url::AbstractString,
447447
return package in registered_packages
448448
end
449449

450+
is_yggdrasil() = get(ENV, "YGGDRASIL", "false") == "true"
451+
# Use an Azure Pipelines environment variable to get the current commit hash
452+
yggdrasil_head() = get(ENV, "BUILD_SOURCEVERSION", "")
453+
450454
function register_jll(name, build_version, dependencies, julia_compat;
451455
deploy_repo="JuliaBinaryWrappers/$(name)_jll.jl",
452456
code_dir=joinpath(Pkg.devdir(), "$(name)_jll"),
@@ -487,18 +491,24 @@ function register_jll(name, build_version, dependencies, julia_compat;
487491
pr_title = "New package: $(name_jll) v$(build_version)"
488492
end
489493
# Open pull request against JuliaRegistries/General
494+
body = """
495+
Autogenerated JLL package registration
496+
497+
* Registering JLL package $(basename(deploy_repo))
498+
* Repository: https://github.com/$(deploy_repo)
499+
* Version: v$(build_version)
500+
"""
501+
if is_yggdrasil()
502+
body *= """
503+
* Revision on Yggdrasil: https://github.com/JuliaPackaging/Yggdrasil/commit/$(yggdrasil_head())
504+
"""
505+
end
490506
params = Dict(
491507
"base" => "master",
492508
"head" => "$(reg_branch.branch)",
493509
"maintainer_can_modify" => true,
494510
"title" => pr_title,
495-
"body" => """
496-
Autogenerated JLL package registration
497-
498-
* Registering JLL package $(basename(deploy_repo))
499-
* Repository: https://github.com/$(deploy_repo)
500-
* Version: v$(build_version)
501-
"""
511+
"body" => body,
502512
)
503513
Wizard.create_or_update_pull_request("JuliaRegistries/General", params; auth=gh_auth)
504514
end
@@ -1195,23 +1205,20 @@ function build_jll_package(src_name::String,
11951205
""")
11961206
end
11971207

1198-
is_yggdrasil = get(ENV, "YGGDRASIL", "false") == "true"
1199-
# Use an Azure Pipelines environment variable to get the current commit hash
1200-
ygg_head = is_yggdrasil ? ENV["BUILD_SOURCEVERSION"] : ""
12011208
print_source(io, s::ArchiveSource) = println(io, "* compressed archive: ", s.url, " (SHA256 checksum: `", s.hash,"`)")
12021209
print_source(io, s::GitSource) = println(io, "* git repository: ", s.url, " (revision: `", s.hash,"`)")
12031210
print_source(io, s::FileSource) = println(io, "* file: ", s.url, " (SHA256 checksum: `", s.hash,"`)")
12041211
function print_source(io, s::DirectorySource)
12051212
print(io, "* files in directory, relative to originating `build_tarballs.jl`: ")
1206-
if is_yggdrasil
1207-
println(io, "[`", s.path, "`](https://github.com/JuliaPackaging/Yggdrasil/tree/", ygg_head, "/", ENV["PROJECT"], "/", basename(s.path), ")")
1213+
if is_yggdrasil()
1214+
println(io, "[`", s.path, "`](https://github.com/JuliaPackaging/Yggdrasil/tree/", yggdrasil_head(), "/", ENV["PROJECT"], "/", basename(s.path), ")")
12081215
else
12091216
println(io, "`", s.path, "`")
12101217
end
12111218
end
12121219
function print_jll(io, dep)
12131220
depname = getname(dep)
1214-
if is_yggdrasil
1221+
if is_yggdrasil()
12151222
# In this case we can easily add a direct link to the repo
12161223
println(io, "* [`", depname, "`](https://github.com/JuliaBinaryWrappers/", depname, ".jl)")
12171224
else
@@ -1226,8 +1233,8 @@ function build_jll_package(src_name::String,
12261233
# `$(src_name)_jll.jl` (v$(build_version))
12271234
12281235
This is an autogenerated package constructed using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl).""")
1229-
if is_yggdrasil
1230-
print(io, " The originating [`build_tarballs.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/$(ygg_head)/$(ENV["PROJECT"])/build_tarballs.jl) script can be found on [`Yggdrasil`](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree. If you have any issue, please report it to the Yggdrasil [bug tracker](https://github.com/JuliaPackaging/Yggdrasil/issues).")
1236+
if is_yggdrasil()
1237+
print(io, " The originating [`build_tarballs.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/$(yggdrasil_head())/$(ENV["PROJECT"])/build_tarballs.jl) script can be found on [`Yggdrasil`](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree. If you have any issue, please report it to the Yggdrasil [bug tracker](https://github.com/JuliaPackaging/Yggdrasil/issues).")
12311238
end
12321239
println(io)
12331240
println(io)

0 commit comments

Comments
 (0)