Obsolete
/
packaging
Archived
3
0
Fork 0

Local files can be used in recipe sources.

file:// can be used as scheme to make it clearer, but URLs without
scheme will be assumed to be local files anyway.
master
Luka Vandervelden 2019-08-22 20:11:37 +02:00
parent 3700d5769d
commit e4ea6bcd11
1 changed files with 12 additions and 1 deletions

View File

@ -57,6 +57,8 @@ class Package::Recipe
getter sources = Sources.new getter sources = Sources.new
getter packages = Array(Package).new getter packages = Array(Package).new
property recipe_directory = "."
@working_uuid : UUID = UUID.random @working_uuid : UUID = UUID.random
def initialize(@context, @name, @version) def initialize(@context, @name, @version)
@ -78,6 +80,8 @@ class Package::Recipe
name : String? = nil name : String? = nil
version : String? = nil version : String? = nil
@recipe_directory = File.dirname filename
raise "Could not parse `#{filename}`" if specs.nil? raise "Could not parse `#{filename}`" if specs.nil?
specs.assignments.each do |key, value| specs.assignments.each do |key, value|
@ -209,7 +213,14 @@ class Package::Recipe
raise ExtractionError.new self, url unless status.success? raise ExtractionError.new self, url unless status.success?
else else
puts ":: Copying '#{url.filename}'" puts ":: Copying '#{url.filename}'"
FileUtils.cp "#{@context.sources_directory}/#{url.filename}",
directory = if url.scheme == "file"
@recipe_directory
else
@context.sources_directory
end
FileUtils.cp "#{directory}/#{url.filename}",
url.filename url.filename
end end
end end