Repository: JuliaLang/julia
File: test/stdlib_dependencies.jl (Julia)

Code before:
                continue
            end

            for prop_name in names(m)
                prop = getproperty(m, prop_name)
                if isa(prop, Libdl.LazyLibrary)
                    lib_path = dlpath(prop)
                    lazy_lib_deps = strip_soversion.(basename.(dlpath.(prop.dependencies)))
                    real_lib_deps = filter(!is_system_lib, get_deps_objectfile(lib_path))

                    # See if there are missing dependencies in the lazy library deps
                    missing_deps = setdiff(real_lib_deps, lazy_lib_deps)
                    extraneous_deps = setdiff(lazy_lib_deps, real_lib_deps)

                    # We expect there to be no missing or extraneous deps
                    deps_mismatch = !isempty(missing_deps) || !isempty(extraneous_deps)

                    # This is a manually-managed special case
                    if stdlib_name == "libblastrampoline_jll" &&
                       prop_name == :libblastrampoline &&
                       extraneous_deps in (["libopenblas64_"], ["libopenblas"])
                        deps_mismatch = false
                    end

                    @test !deps_mismatch

                    # Print out the deps mismatch if we find one
                    if deps_mismatch
                        @warn("Dependency mismatch",
                            jll = stdlib_name,
                            library = string(prop_name),
                            missing_deps = join(missing_deps, ", "),
                            extraneous_deps = join(extraneous_deps, ", "),
                            actual_deps = join(real_lib_deps, ", "),
                        )
                    end
                end
            end
            if isdefined(m, :eager_mode)
                # If the JLL has an eager_mode function, call it
                Base.invokelatest(getproperty(m, :eager_mode))
            end
        end
    end

finally
    if prev_env !== nothing
        Pkg.activate(prev_env)
    else
        # If no previous environment, activate the default one
        Pkg.activate()

Review comment (suggestion):
I'm not sure Windows has concept of soversion at all, libraries tend to append numbers to the basename to mimic soversions like in other platforms, but that's custom, not very standard.  Instead of special-casing `libpcre2` here, wouldn't it be possible to list multiple values of library name when `libpcre2` is used?  That's what [`BinaryBuilderBase.LibraryProduct`](https://docs.binarybuilder.org/stable/reference/#BinaryBuilderBase.LibraryProduct) does.

Code after:
                continue
            end

            for prop_name in names(m)
                prop = getproperty(m, prop_name)
                if isa(prop, Libdl.LazyLibrary)
                    lib_path = dlpath(prop)
                    lazy_lib_deps = strip_soversion.(basename.(dlpath.(prop.dependencies)))
                    real_lib_deps = filter(!is_system_lib, get_deps_objectfile(lib_path))

                    # See if there are missing dependencies in the lazy library deps
                    missing_deps = setdiff(real_lib_deps, lazy_lib_deps)
                    extraneous_deps = setdiff(lazy_lib_deps, real_lib_deps)

                    # The library name is `libpcre2-8`, with a dash in
                    # its name. That works fine on Unix. On Windows, a
                    # suffix starting with a dash denotes the
                    # library's soversion. So we think (on Windows)
                    # that this is the library `libpcre2`, soversion
                    # 8, and things don't match.
                    if Sys.iswindows()
                        if "libpcre2-8" in missing_deps && "libpcre2" in extraneous_deps
                            missing_deps = setdiff(missing_deps, ["libpcre2-8"])
                            extraneous_deps = setdiff(extraneous_deps, ["libpcre2"])
                        end
                    end

                    # We expect there to be no missing or extraneous deps
                    deps_mismatch = !isempty(missing_deps) || !isempty(extraneous_deps)

                    # This is a manually-managed special case
                    if stdlib_name == "libblastrampoline_jll" &&
                       prop_name == :libblastrampoline &&
                       extraneous_deps in (["libopenblas64_"], ["libopenblas"])
                        deps_mismatch = false
                    end

                    @test !deps_mismatch

                    # Print out the deps mismatch if we find one
                    if deps_mismatch
                        @warn("Dependency mismatch",
                            jll = stdlib_name,
                            library = string(prop_name),
                            missing_deps = join(missing_deps, ", "),
                            extraneous_deps = join(extraneous_deps, ", "),
                            actual_deps = join(real_lib_deps, ", "),
                        )
                    end
                end
            end