Skip to content

Instantly share code, notes, and snippets.

@terasakisatoshi
Created December 26, 2024 03:26
Show Gist options
  • Save terasakisatoshi/9beb7fd5a878ef2151e55489d5c89689 to your computer and use it in GitHub Desktop.
Save terasakisatoshi/9beb7fd5a878ef2151e55489d5c89689 to your computer and use it in GitHub Desktop.
General に登録済みのパッケージリポジトリを(可能な限り)クローンする方法
module GeneralRegistryCollector
using Pkg
using TOML
using ProgressMeter
using IOCapture
function main()
general_registry = filter(Pkg.Registry.reachable_registries()) do r
r.name == "General"
end |> only
general_in_memory_registry = general_registry.in_memory_registry
rootdirectory = joinpath(pkgdir(@__MODULE__, "repositories"))
@show rootdirectory
@showprogress for p in collect(values(general_registry.pkgs))
try
occursin("_jll", p.name) && continue
toml = TOML.parse(
general_in_memory_registry[joinpath(p.path, "Package.toml")]
)
repo = toml["repo"]
repo_path = joinpath(rootdirectory, p.path)
if isdir(repo_path)
continue
end
IOCapture.capture() do
run(`git clone --quiet --depth 1 $(repo) $(repo_path)`, wait=false) |> read
end
catch e
@show e
end
end
end
end # module GeneralRegistryCollector
@terasakisatoshi
Copy link
Author

添付のソースコード内にある main 関数を実行すれば良い.ローカル環境は数十GB消費するので事前にストレージに余裕を持たせておくことを推奨します.

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