Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JLLs] Cap JLLs to Libtiff_jll v4.4 #86099

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Conversation

visr
Copy link
Contributor

@visr visr commented Jun 22, 2023

As mentioned in JuliaPackaging/Yggdrasil#6929, it looks like the upgrade from libtiff 4.4 to 4.5 was breaking at least on Windows.

I looked at #84160 for an example of what to do. All existing compat bounds were Libtiff_jll = "4.3.0-4" or none, this avoids 4.5.1 by making it Libtiff_jll = "4.3.0-4.4".

Besides running the code I didn't make further edits. It looks fine to me, but please look carefully.
EDIT: I manually still needed to remove overlapping version ranges in 3345c71

Code used based on #84160

# code based on https://github.com/JuliaRegistries/General/pull/84160
# with minor edits, adding pkg and compat arguments

using TOML

function find_jll(query::String)
    compat_dict = Dict{String,Dict{String,Bool}}()
    for (root, dirs, files) in walkdir(".")
        for file in files
            if file == "Deps.toml" || file == "Compat.toml"
                fullfile = joinpath(root, file)
                lines = filter(contains(query), readlines(fullfile))
                if !isempty(lines)
                    printstyled(fullfile, ": "; color=:green)
                    println.(lines)
                    compat_dict[root] = get(compat_dict, root, Dict{String,Bool}())
                    if file == "Deps.toml"
                        deps_toml = TOML.parsefile(fullfile)
                        for v in keys(deps_toml)
                            compat_dict[root][v] = haskey(deps_toml[v], query)
                        end
                    elseif file == "Compat.toml"
                        compat_toml = TOML.parsefile(fullfile)
                        for v in keys(compat_toml)
                            compat_dict[root][v] = haskey(compat_toml[v], query)
                        end
                    end
                end
            end
        end
    end
    return compat_dict
end

function process_compat_toml(d, deps_dict, pkg::String, compat::String)
    fullfile = joinpath(d, "Compat.toml")
    toml_dict = TOML.parsefile(fullfile)
    for (k, v) in deps_dict
        if v
            if !haskey(toml_dict, k)
                toml_dict[k] = Dict{String,Any}()
            end
            toml_dict[k][pkg] = compat
        end
    end
    toml_dict
end

# Different from the OpenSSL code is that I set sorted = true for TOML.print
function edit_compat_tomls(compat_dict, pkg::String, compat::String; do_not_write=false)
    for d in keys(compat_dict)
        toml_dict = process_compat_toml(d, compat_dict[d], pkg, compat)
        if !do_not_write
            open(joinpath(d, "Compat.toml"), "w") do io
                TOML.print(io, toml_dict; sorted=true)
            end
        end
        TOML.print(toml_dict; sorted=true)
    end
end

function cap(pkg::String, compat::String; do_not_write=false)
    dict = find_jll(pkg)
    edit_compat_tomls(dict, pkg, compat; do_not_write)
end

# cap("Libtiff_jll", "4.3.0-4.4")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants