Don't pass down basename in #extract_nested_tar.

This commit is contained in:
Markus Reiter 2018-07-19 12:45:50 +02:00
parent c6fa3fe8b4
commit 50855c98f0
2 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ describe UnpackStrategy do
}
it "does not pass down the basename of the archive" do
strategy.extract_nestedly(to: unpack_dir)
strategy.extract_nestedly(to: unpack_dir, basename: basename)
expect(unpack_dir/"file.txt").to be_a_file
end
end

View File

@ -197,10 +197,10 @@ class XzUnpackStrategy < UnpackStrategy
def extract_to_dir(unpack_dir, basename:)
super
safe_system Formula["xz"].opt_bin/"unxz", "-q", "-T0", unpack_dir/basename
extract_nested_tar(unpack_dir, basename: basename)
extract_nested_tar(unpack_dir)
end
def extract_nested_tar(unpack_dir, basename:)
def extract_nested_tar(unpack_dir)
return unless DependencyCollector.tar_needs_xz_dependency?
return if (children = unpack_dir.children).count != 1
return if (tar = children.first).extname != ".tar"
@ -208,7 +208,7 @@ class XzUnpackStrategy < UnpackStrategy
Dir.mktmpdir do |tmpdir|
tmpdir = Pathname(tmpdir)
FileUtils.mv tar, tmpdir/tar.basename
TarUnpackStrategy.new(tmpdir/tar.basename).extract(to: unpack_dir, basename: basename)
TarUnpackStrategy.new(tmpdir/tar.basename).extract(to: unpack_dir)
end
end
end