@@ -18,22 +18,35 @@ function general_registry_exists()
1818 if isfile (general_registry_tarball) && isfile (registry_toml_file)
1919 return true
2020 end
21+
2122 general_registry_dir, registry_toml_file = cloned_general_registry_location ()
22- if ! isdir (general_registry_dir)
23- return false
24- elseif ! isfile (registry_toml_file)
25- return false
26- else
23+ if isdir (general_registry_dir) && isfile (registry_toml_file)
2724 return true
2825 end
26+
27+ return false
2928end
3029
3130function add_general_registry ()
32- @info (" Attempting to clone the General registry" )
33- general_registry_dir, registry_toml_file = general_registry_location ()
31+ @info (" Attempting to install the General registry" )
32+
33+ general_registry_tarball, registry_toml_file = tarball_general_registry_location ()
34+ rm (general_registry_tarball; force = true , recursive = true )
35+ rm (registry_toml_file; force = true , recursive = true )
36+
37+ general_registry_dir, registry_toml_file = cloned_general_registry_location ()
3438 rm (general_registry_dir; force = true , recursive = true )
35- Pkg. Registry. add (" General" )
36- isfile (registry_toml_file) || throw (ErrorException (" the Registry.toml file does not exist" ))
39+
40+ # If not already set, We set `JULIA_PKG_SERVER` to enforce
41+ # `Pkg.Registry.add` to use Git. This way, Pkg.jl can send
42+ # the request metadata to pkg.julialang.org when installing
43+ # packages via `Pkg.test`.
44+ pkg_server = get (ENV , " JULIA_PKG_SERVER" , " " )
45+ withenv (" JULIA_PKG_SERVER" => pkg_server) do
46+ Pkg. Registry. add (" General" )
47+ end
48+
49+ general_registry_exists () || throw (ErrorException (" The Registry was not intalled properly" ))
3750 return nothing
3851end
3952
0 commit comments