Archived
3
0

Non-tar files in sources are copied and not extracted.

This commit is contained in:
Luka Vandervelden 2019-08-22 20:09:15 +02:00
parent 8322c78e30
commit 3700d5769d

View File

@ -180,6 +180,8 @@ class Package::Recipe
def download
sources.each do |url|
next if url.scheme == "file"
unless File.exists? url.filename
status = @context.run @context.sources_directory, "wget", [ url.to_s, "-O", url.filename ]
@ -194,15 +196,22 @@ class Package::Recipe
sources.each do |url|
basename = url.filename
status = @context.run(
building_directory,
"bsdtar", [
"xvf",
@context.sources_directory + "/" + url.filename
]
)
if basename.match /\.(tar\.(gz|xz|bz2|lzma)|tgz)$/
puts ":: Extracting '#{url.filename}'"
status = @context.run(
building_directory,
"bsdtar", [
"xf",
@context.sources_directory + "/" + url.filename
]
)
raise ExtractionError.new self, url unless status.success?
raise ExtractionError.new self, url unless status.success?
else
puts ":: Copying '#{url.filename}'"
FileUtils.cp "#{@context.sources_directory}/#{url.filename}",
url.filename
end
end
end