-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use Yggdrasil to host binary * remove unused file, put version selection to deps.jl * bring TagBot back, remove auto tag * use auto-generated build.jl * update build.jl * use original build.jl, select version in Libtask.jl * again, write deps.jl by ourselves * use products filter instead of deps.jl writer
- Loading branch information
Showing
8 changed files
with
70 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,58 @@ | ||
function find_prev_tag(tag) | ||
project_root = (@__DIR__) |> dirname |> abspath | ||
run(`git -C $project_root fetch --tags`) | ||
tags = readlines(`git -C $project_root tag`) | ||
sort!(tags) | ||
idx = indexin([tag], tags)[1] | ||
if idx == nothing return "NO-PREV-TAG" end | ||
return get(tags, idx - 1, "NO-PREV-TAG") | ||
end | ||
### | ||
### This file is generated by running | ||
### ` julia generate_buildjl.jl L/Libtask/build_tarballs.jl` | ||
### in the Yggdrasil root directory, with 2 updates: | ||
### 1. add prefix tp products, see https://github.com/JuliaPackaging/Yggdrasil#binaryproviderjl, | ||
### 2. products filter | ||
### | ||
|
||
using BinaryProvider # requires BinaryProvider 0.3.0 or later | ||
|
||
# Parse some basic command-line arguments | ||
const verbose = "--verbose" in ARGS | ||
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) | ||
products = [ | ||
LibraryProduct(prefix, ["libtask_v1_0"], :libtask_v1_0), | ||
LibraryProduct(prefix, ["libtask_v1_1"], :libtask_v1_1), | ||
LibraryProduct(prefix, ["libtask_v1_2"], :libtask_v1_2), | ||
LibraryProduct(prefix, ["libtask_v1_3"], :libtask_v1_3), | ||
] | ||
|
||
# modify build-tmp.jl to only check correct version libs | ||
function install_products_filter(build_file) | ||
prod_filter = raw"""products_tmp = filter(products) do prod | ||
products_tmp = filter(products) do prod | ||
endswith(prod.libnames[1], "$(VERSION.major)_$(VERSION.minor)") | ||
end | ||
length(products_tmp) == 0 && (products_tmp = [products[end]]) | ||
products = products_tmp | ||
""" | ||
lines = open(build_file) do io | ||
read(io, String) |> x -> split(x, "\n") | ||
end | ||
prod_in, prod_out, filter_written = false, false, false | ||
open(build_file, "w") do io | ||
for line in lines | ||
if occursin("products = [", line) | ||
prod_in = true | ||
end | ||
if prod_in && line == "]" | ||
prod_out = true | ||
end | ||
write(io, line * "\n") | ||
if prod_out && !filter_written | ||
write(io, prod_filter * "\n") | ||
filter_written = true | ||
end | ||
end | ||
end | ||
end | ||
|
||
function include_build_script(version_str, try_prev=false) | ||
build_script_url = "https://github.com/TuringLang/Libtask.jl/releases/download/v$(version_str)/build_LibtaskDylib.v$(version_str).jl" | ||
build_script = joinpath(@__DIR__, "tmp-build.jl") | ||
build_script = try download(build_script_url, build_script) catch end | ||
if build_script == nothing && try_prev # no such file | ||
version_str = find_prev_tag("v$version_str") |> strip |> (x) -> lstrip(x, ['v']) | ||
return include_build_script(version_str, false) | ||
end | ||
install_products_filter(build_script) | ||
include(build_script) | ||
# Download binaries from hosted location | ||
bin_prefix = "https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/releases/download/Libtask-v0.3.0+0" | ||
|
||
# Listing of files generated by BinaryBuilder: | ||
download_info = Dict( | ||
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.aarch64-linux-gnu.tar.gz", "e541c0df11d48b45e9334018c014ae0d012b75f92ffbc49fc4ab6eed35593731"), | ||
Linux(:i686, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.i686-linux-gnu.tar.gz", "7f68bd21609adf35878f9b16f56151ab5f6f609999a40291ed270c1a4d0331a0"), | ||
Windows(:i686) => ("$bin_prefix/Libtask.v0.3.0.i686-w64-mingw32.tar.gz", "62950b53a892fb8c699ddbb4ccc9f19b12681f64fbf85a546345d5b0f23dc8d7"), | ||
MacOS(:x86_64) => ("$bin_prefix/Libtask.v0.3.0.x86_64-apple-darwin14.tar.gz", "fff6523dde93e6dc12b96a8bf1e3c35a78d8dba7cdc95cd0e5dd13225d1972df"), | ||
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Libtask.v0.3.0.x86_64-linux-gnu.tar.gz", "be4c590e8f13df31855be20f31c1c4ce98f499fc5173cd35c8e8b72b79e0dc5a"), | ||
Windows(:x86_64) => ("$bin_prefix/Libtask.v0.3.0.x86_64-w64-mingw32.tar.gz", "267473eb211e5060b98cede7f30336d2a7453542617521f27941d353dcfe42e8"), | ||
) | ||
|
||
# Install unsatisfied or updated dependencies: | ||
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) | ||
dl_info = choose_download(download_info, platform_key_abi()) | ||
if dl_info === nothing && unsatisfied | ||
# If we don't have a compatible .tar.gz to download, complain. | ||
# Alternatively, you could attempt to install from a separate provider, | ||
# build from source or something even more ambitious here. | ||
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") | ||
end | ||
|
||
function get_version_str() | ||
path = joinpath(@__DIR__, "../Project.toml") | ||
version_reg = r"version\s*=\s*\"(.*)\"" | ||
open(path) do file | ||
lines = readlines(file) | ||
for line in lines | ||
m = match(version_reg, line) | ||
if isa(m, RegexMatch) return m.captures[1] end | ||
end | ||
end | ||
# If we have a download, and we are unsatisfied (or the version we're | ||
# trying to install is not itself installed) then load it up! | ||
if unsatisfied || !isinstalled(dl_info...; prefix=prefix) | ||
# Download and install binaries | ||
install(dl_info...; prefix=prefix, force=true, verbose=verbose) | ||
end | ||
|
||
version_str = get_version_str() |> strip |> (x) -> lstrip(x, ['v']) | ||
include_build_script(version_str, true) | ||
# Write out a deps.jl file that will contain mappings for our products | ||
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
806240c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
806240c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error while trying to register: "Tag with name
0.3.4
already exists and points to a different commit"806240c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
806240c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request updated: JuliaRegistries/General/11820
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: