Skip to content

Commit c862ac8

Browse files
committed
Merge 95980158-tar-decompression to master
[Completes #95980158]
2 parents 81f993c + 0819957 commit c862ac8

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/java_buildpack/component/base_component.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def download_tar(version, uri, target_directory = @droplet.sandbox, name = @comp
122122
download(version, uri, name) do |file|
123123
with_timing "Expanding #{name} to #{target_directory.relative_path_from(@droplet.root)}" do
124124
FileUtils.mkdir_p target_directory
125-
shell "tar x#{gzipped?(file) ? 'x' : ''}f #{file.path} -C #{target_directory} --strip 1 2>&1"
125+
shell "tar x#{compression_flag(file)}f #{file.path} -C #{target_directory} --strip 1 2>&1"
126126
end
127127
end
128128
end
@@ -172,6 +172,20 @@ def gzipped?(file)
172172
file.path.end_with? '.gz'
173173
end
174174

175+
def bzipped?(file)
176+
file.path.end_with? '.bz2'
177+
end
178+
179+
def compression_flag(file)
180+
if gzipped?(file)
181+
'z'
182+
elsif bzipped?(file)
183+
'j'
184+
else
185+
''
186+
end
187+
end
188+
175189
end
176190

177191
end

0 commit comments

Comments
 (0)