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

[PkgServer] use Tar.jl to extract tarballs #34

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/PkgServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ using Base.Threads: Event, @spawn
using Random
using LibGit2

using Tar
using CodecZlib

decompress(io::IO) = GzipDecompressorStream(io)

include("resource.jl")
include("meta.jl")

Expand Down
4 changes: 3 additions & 1 deletion src/resource.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ end
function tarball_git_hash(tarball::String)
local tree_hash
mktempdir() do tmp_dir
run(`tar -C $tmp_dir -zxf $tarball`)
open(tarball) do io
Tar.extract(decompress(io), tmp_dir)
end
tree_hash = bytes2hex(Pkg.GitTools.tree_hash(tmp_dir))
chmod(tmp_dir, 0o777, recursive=true)
end
Expand Down