Change crew to remove already installed packages and the target package from the dependencies.

Change crew to hide `buildessential` from dependencies list since it is a fake package.
Change crew to not check :build dependencies if a target is already installed.
Chagen crew to remove unnecessary push_dependency call.
Change package.rb to update comments
parent adee0e73
......@@ -336,7 +336,8 @@ def resolveDependencies
@source_package = 0
def push_dependencies
if @pkg.is_binary?(@device[:architecture])
if @pkg.is_binary?(@device[:architecture]) ||
(!@pkg.in_upgrade && @device[:installed_packages].any? { |pkg| pkg[:name] == @pkg.name })
# 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?
......@@ -348,13 +349,17 @@ def resolveDependencies
# 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
@check_deps.each do |dep|
search dep, true
push_dependencies
end
# remove a dependent package which is equal to the target
@check_deps.select! {|name| @pkgName != name}
# insert only not installed packages into dependencies
@dependencies = @check_deps.select {|name| @device[:installed_packages].none? {|pkg| pkg[:name] == name}}.concat(@dependencies)
# check all dependencies recursively
@check_deps.each do |dep|
search dep, true
push_dependencies
end
end
......@@ -363,16 +368,15 @@ def resolveDependencies
# Add buildessential and solve its dependencies if any of dependent
# packages are made from source
if @source_package > 0
@dependencies.unshift 'buildessential'
search 'buildessential', true
push_dependencies
end
push_dependencies
return if @dependencies.empty?
puts "Following packages also need to be installed: "
@dependencies.flatten!.uniq!
@dependencies.uniq!
@dependencies.each do |dep|
print dep + " "
end
......
......@@ -12,8 +12,9 @@ class Package
@@debug_symbol = ENV['CREW_DEBUG_SYMBOL'] || false
def self.dependencies
# Not sure how to initialize instance variable of not constructed class.
# Therefore, initialize it in reader function.
# We need instance variable in derived class, so not define it here,
# base class. Instead of define it, we initialize it in a function
# called from derived classees.
@dependencies = Hash.new unless @dependencies
@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