diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index 69edf79f2d..26bc872286 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -30,6 +30,7 @@ module UnpackStrategy def self.strategies @strategies ||= [ Tar, # needs to be before Bzip2/Gzip/Xz/Lzma + Pax, Gzip, Lzma, Xz, @@ -78,7 +79,7 @@ module UnpackStrategy end def self.from_extension(extension) - strategies.sort_by { |s| s.extensions.map(&:length).max(0) } + strategies.sort_by { |s| s.extensions.map(&:length).max || 0 } .reverse .find { |s| s.extensions.any? { |ext| extension.end_with?(ext) } } end @@ -165,6 +166,7 @@ require "unpack_strategy/mercurial" require "unpack_strategy/microsoft_office_xml" require "unpack_strategy/otf" require "unpack_strategy/p7zip" +require "unpack_strategy/pax" require "unpack_strategy/pkg" require "unpack_strategy/rar" require "unpack_strategy/self_extracting_executable" diff --git a/Library/Homebrew/unpack_strategy/pax.rb b/Library/Homebrew/unpack_strategy/pax.rb new file mode 100644 index 0000000000..9ad4354c53 --- /dev/null +++ b/Library/Homebrew/unpack_strategy/pax.rb @@ -0,0 +1,24 @@ +module UnpackStrategy + class Pax + include UnpackStrategy + + using Magic + + def self.extensions + [".pax"] + end + + def self.can_extract?(_path) + false + end + + private + + def extract_to_dir(unpack_dir, basename:, verbose:) + system_command! "pax", + args: ["-rf", path], + chdir: unpack_dir, + verbose: verbose + end + end +end