director/lib/director/jobs/update_release.rb
# Resolves package dependencies, makes sure there are no cycles
# and all dependencies are present
# @return [void]
Resolves package dependencies, makes sure there are no cycles
and all dependencies are present
Resolves package dependencies makes sure there are no cycles and all dependencies are present
def resolve_package_dependencies(packages)
        packages_by_name = {}
        packages.each do |package|
          packages_by_name[package["name"]] = package
          package["dependencies"] ||= []
        end
        dependency_lookup = lambda do |package_name|
          packages_by_name[package_name]["dependencies"]
        end
        result = CycleHelper.check_for_cycle(packages_by_name.keys,
                                             :connected_vertices => true,
                                             &dependency_lookup)
        packages.each do |package|
          name = package["name"]
          dependencies = package["dependencies"]
          logger.info("Resolving package dependencies for `#{name}', " +
                      "found: #{dependencies.pretty_inspect}")
          package["dependencies"] = result[:connected_vertices][name]
          logger.info("Resolved package dependencies for `#{name}', " +
                      "to: #{dependencies.pretty_inspect}")
        end
      end
def resolve_package_dependencies ( packages ) packages_by_name = { } packages . each do | package | packages_by_name [ package [ "name" ] ] = package package [ "dependencies" ] ||= [ ] end dependency_lookup = lambda do | package_name | packages_by_name [ package_name ] [ "dependencies" ] end result = CycleHelper . check_for_cycle ( packages_by_name . keys , :connected_vertices => true , & dependency_lookup ) packages . each do | package | name = package [ "name" ] dependencies = package [ "dependencies" ] logger . info ( "Resolving package dependencies for `#{name}', " + "found: #{dependencies.pretty_inspect}" ) package [ "dependencies" ] = result [ :connected_vertices ] [ name ] logger . info ( "Resolved package dependencies for `#{name}', " + "to: #{dependencies.pretty_inspect}" ) end end
Resolves package dependencies, makes sure there are no cycles
and all dependencies are present
Resolves package dependencies makes sure there are no cycles and all dependencies are present
None
void
packages