@@ -597,23 +597,37 @@ Given a JLL name and registered version, return a `PackageSpec` that, when passe
597597 ]
598598"""
599599function get_addable_spec (name:: AbstractString , version:: VersionNumber ;
600- ctx = Pkg . Types . Context (), verbose:: Bool = false )
600+ verbose:: Bool = false )
601601 @debug " Getting addable spec" name version
602602 # Zeroth, update the registry
603603 update_registry (verbose ? stdout : devnull )
604+
605+ # Get registries using RegistryInstances
606+ registries = reachable_registries ()
607+
604608 # First, resolve the UUID
605- uuid = first (Pkg. Types. registry_resolve! (ctx. registries, Pkg. Types. PackageSpec (;name))). uuid
609+ uuid = nothing
610+ for reg in registries
611+ uuids = uuids_from_name (reg, name)
612+ if ! isempty (uuids)
613+ uuid = first (uuids)
614+ break
615+ end
616+ end
617+ if uuid === nothing
618+ error (" Unable to find package $name in any registry" )
619+ end
606620 @debug " Resolved UUID" name uuid
607621
608622 # Next, determine the tree hash from the registry
609623 repo_urls = Set {String} ()
610624 tree_hashes = Set {Base.SHA1} ()
611- for reg in ctx . registries
625+ for reg in registries
612626 if ! haskey (reg, uuid)
613627 continue
614628 end
615629
616- pkg_info = registry_info (reg, reg [uuid])
630+ pkg_info = registry_info (reg[uuid])
617631 if pkg_info. repo != = nothing
618632 push! (repo_urls, pkg_info. repo)
619633 end
@@ -630,7 +644,7 @@ function get_addable_spec(name::AbstractString, version::VersionNumber;
630644 @error (" Unable to find dependency!" ,
631645 name,
632646 version,
633- registries= ctx . registries ,
647+ registries,
634648 )
635649 error (" Unable to find dependency!" )
636650 end
@@ -639,7 +653,7 @@ function get_addable_spec(name::AbstractString, version::VersionNumber;
639653 name,
640654 version,
641655 tree_hashes,
642- registries= ctx . registries ,
656+ registries,
643657 )
644658 error (" Multiple treehashes found!" )
645659 end
0 commit comments