Support "depends_on name => :build" style

parent d47fad3f
......@@ -295,17 +295,22 @@ def resolveDependencies
@source_package = 0
def pushDeps
if @pkg.binary_url && @pkg.binary_url.has_key?(@device[:architecture])
@check_deps = @pkg.dependencies
if @pkg.is_binary?(@device[:architecture])
# retrieve name of dependencies that doesn't contain :build tag
@check_deps = @pkg.dependencies.select {|k, v| !v.include?(:build)}.map {|k, v| k}
elsif @pkg.is_fake?
# retrieve name of all dependencies
@check_deps = @pkg.dependencies.map {|k, v| k}
else
# Use source dependencies
@check_deps = @pkg.dependencies
# retrieve name of all dependencies
@check_deps = @pkg.dependencies.map {|k, v| k}
# count the number of source packages to add buildessential into dependencies later
@source_package += 1
end
if @check_deps && !@check_deps.empty?
@dependencies.unshift @check_deps
@pkg.dependencies.each do |dep|
@check_deps.each do |dep|
search dep, true
pushDeps
end
......
......@@ -2,15 +2,35 @@ require 'package_helpers'
class Package
property :version, :binary_url, :binary_sha1, :source_url, :source_sha1, :is_fake
class << self
attr_reader :dependencies, :is_fake
attr_reader :is_fake
attr_accessor :name, :in_build, :build_from_source
end
def self.dependencies
# Not sure how to initialize instance variable of not constructed class.
# Therefore, initialize it in reader function.
@dependencies = Hash.new unless @dependencies
@dependencies
end
def self.depends_on (dependency = nil)
@dependencies = [] unless @dependencies
@dependencies = Hash.new unless @dependencies
if dependency
@dependencies << dependency
# add element in "[ name, [ tag1, tag2, ... ] ]" format
if dependency.is_a?(Hash)
if dependency.first[1].is_a?(Array)
# parse "depends_on name => [ tag1, tag2 ]"
@dependencies.store(dependency.first[0], dependency.first[1])
else
# parse "depends_on name => tag"
@dependencies.store(dependency.first[0], [ dependency.first[1] ])
end
else
# parse "depends_on name"
@dependencies.store(dependency, [])
end
end
@dependencies
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment