Reuse UncompressedUnpackStrategy#extract_to_dir.
This commit is contained in:
parent
ec7e22e16f
commit
5dfa4ded43
@ -151,7 +151,7 @@ class CompressUnpackStrategy < TarUnpackStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class XzUnpackStrategy < UnpackStrategy
|
class XzUnpackStrategy < UncompressedUnpackStrategy
|
||||||
def self.can_extract?(path:, magic_number:)
|
def self.can_extract?(path:, magic_number:)
|
||||||
magic_number.match?(/\A\xFD7zXZ\x00/n)
|
magic_number.match?(/\A\xFD7zXZ\x00/n)
|
||||||
end
|
end
|
||||||
@ -159,11 +159,8 @@ class XzUnpackStrategy < UnpackStrategy
|
|||||||
private
|
private
|
||||||
|
|
||||||
def extract_to_dir(unpack_dir, basename:)
|
def extract_to_dir(unpack_dir, basename:)
|
||||||
unpack_path = unpack_dir/path.basename
|
super
|
||||||
FileUtils.cp path, unpack_path, preserve: true
|
safe_system Formula["xz"].opt_bin/"xz", "-d", "-q", "-T0", unpack_dir/basename
|
||||||
|
|
||||||
safe_system Formula["xz"].opt_bin/"xz", "-d", "-q", "-T0", unpack_path
|
|
||||||
|
|
||||||
extract_nested_tar(unpack_dir, basename: basename)
|
extract_nested_tar(unpack_dir, basename: basename)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -180,7 +177,7 @@ class XzUnpackStrategy < UnpackStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Bzip2UnpackStrategy < UnpackStrategy
|
class Bzip2UnpackStrategy < UncompressedUnpackStrategy
|
||||||
def self.can_extract?(path:, magic_number:)
|
def self.can_extract?(path:, magic_number:)
|
||||||
magic_number.match?(/\ABZh/n)
|
magic_number.match?(/\ABZh/n)
|
||||||
end
|
end
|
||||||
@ -188,14 +185,12 @@ class Bzip2UnpackStrategy < UnpackStrategy
|
|||||||
private
|
private
|
||||||
|
|
||||||
def extract_to_dir(unpack_dir, basename:)
|
def extract_to_dir(unpack_dir, basename:)
|
||||||
unpack_path = unpack_dir/path.basename
|
super
|
||||||
FileUtils.cp path, unpack_path, preserve: true
|
safe_system "bunzip2", "-q", unpack_dir/basename
|
||||||
|
|
||||||
safe_system "bunzip2", "-q", unpack_path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GzipUnpackStrategy < UnpackStrategy
|
class GzipUnpackStrategy < UncompressedUnpackStrategy
|
||||||
def self.can_extract?(path:, magic_number:)
|
def self.can_extract?(path:, magic_number:)
|
||||||
magic_number.match?(/\A\037\213/n)
|
magic_number.match?(/\A\037\213/n)
|
||||||
end
|
end
|
||||||
@ -203,14 +198,12 @@ class GzipUnpackStrategy < UnpackStrategy
|
|||||||
private
|
private
|
||||||
|
|
||||||
def extract_to_dir(unpack_dir, basename:)
|
def extract_to_dir(unpack_dir, basename:)
|
||||||
unpack_path = unpack_dir/path.basename
|
super
|
||||||
FileUtils.cp path, unpack_path, preserve: true
|
safe_system "gunzip", "-q", "-N", unpack_dir/basename
|
||||||
|
|
||||||
safe_system "gunzip", "-q", "-N", unpack_path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class LzipUnpackStrategy < UnpackStrategy
|
class LzipUnpackStrategy < UncompressedUnpackStrategy
|
||||||
def self.can_extract?(path:, magic_number:)
|
def self.can_extract?(path:, magic_number:)
|
||||||
magic_number.match?(/\ALZIP/n)
|
magic_number.match?(/\ALZIP/n)
|
||||||
end
|
end
|
||||||
@ -218,10 +211,8 @@ class LzipUnpackStrategy < UnpackStrategy
|
|||||||
private
|
private
|
||||||
|
|
||||||
def extract_to_dir(unpack_dir, basename:)
|
def extract_to_dir(unpack_dir, basename:)
|
||||||
unpack_path = unpack_dir/path.basename
|
super
|
||||||
FileUtils.cp path, unpack_path, preserve: true
|
safe_system Formula["lzip"].opt_bin/"lzip", "-d", "-q", unpack_dir/basename
|
||||||
|
|
||||||
safe_system Formula["lzip"].opt_bin/"lzip", "-d", "-q", unpack_path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user