reading options and user phases in /etc/packaging.cfg
This commit is contained in:
parent
15ccc1518e
commit
42235d107d
@ -20,6 +20,9 @@ class Package::Context
|
|||||||
getter packaging_backends = Hash(String, Backend::Packaging).new
|
getter packaging_backends = Hash(String, Backend::Packaging).new
|
||||||
getter splitter_backends = Hash(String, Backend::Splitter).new
|
getter splitter_backends = Hash(String, Backend::Splitter).new
|
||||||
|
|
||||||
|
# General options, to add to the recipe before reading it.
|
||||||
|
getter options = Hash(String, String).new
|
||||||
|
|
||||||
getter all_phase_names = [
|
getter all_phase_names = [
|
||||||
"sources-split",
|
"sources-split",
|
||||||
"pre-configure", "configure",
|
"pre-configure", "configure",
|
||||||
@ -111,9 +114,11 @@ class Package::Context
|
|||||||
@sources_directory = value.as_s
|
@sources_directory = value.as_s
|
||||||
when "working-directory"
|
when "working-directory"
|
||||||
@working_directory = value.as_s
|
@working_directory = value.as_s
|
||||||
|
|
||||||
when "prefixes"
|
when "prefixes"
|
||||||
# Prefixes during the build process.
|
# Prefixes during the build process.
|
||||||
@prefixes = value.as_a_or_s
|
@prefixes = value.as_a_or_s
|
||||||
|
|
||||||
when "build-cores"
|
when "build-cores"
|
||||||
# NB of cores used to compile applications.
|
# NB of cores used to compile applications.
|
||||||
@build_cores = value.as_s.to_i
|
@build_cores = value.as_s.to_i
|
||||||
@ -136,6 +141,25 @@ class Package::Context
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
when "options"
|
||||||
|
value.as_a_or_s.each do |option|
|
||||||
|
match = option.split(':').map(&.strip)
|
||||||
|
|
||||||
|
if match.size != 2
|
||||||
|
STDERR.puts "WARNING: misformed option: #{option}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
key, value = match
|
||||||
|
|
||||||
|
@options[key] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
# (default) user instructions (for testing).
|
||||||
|
when /(?<phase>(pre-)?(configure|build|install)|post-install)/
|
||||||
|
phase = $~["phase"]
|
||||||
|
@user_instructions[phase] = Instructions.new(phase).<<(value.as_s_or_ls)
|
||||||
|
|
||||||
when "package-manager"
|
when "package-manager"
|
||||||
# Targeted package manager (default: package, for BaguetteOS).
|
# Targeted package manager (default: package, for BaguetteOS).
|
||||||
begin
|
begin
|
||||||
|
@ -80,6 +80,9 @@ class Package::Recipe
|
|||||||
property require_stripping = true
|
property require_stripping = true
|
||||||
|
|
||||||
def initialize(@context, @name, @version)
|
def initialize(@context, @name, @version)
|
||||||
|
@context.options.each do |k, v|
|
||||||
|
@options[k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new(context, name, version)
|
def self.new(context, name, version)
|
||||||
@ -91,6 +94,9 @@ class Package::Recipe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(@context, filename : String)
|
def initialize(@context, filename : String)
|
||||||
|
@context.options.each do |k, v|
|
||||||
|
@options[k] = v
|
||||||
|
end
|
||||||
specs = SpecParser.parse File.read(filename), {
|
specs = SpecParser.parse File.read(filename), {
|
||||||
"pkg" => fake_root_directory,
|
"pkg" => fake_root_directory,
|
||||||
"prefix" => prefix
|
"prefix" => prefix
|
||||||
|
Reference in New Issue
Block a user