class Autoproj::Ops::PackageSetHierarchy
PackageSetHierachy be used to build the hierarchy of package set imports, as directed acyclic graph (DAG) so that they can be (topologically) sorted according to their dependencies
Attributes
Public Class Methods
Source
# File lib/autoproj/ops/configuration.rb, line 18 def initialize(package_sets, root_pkg_set) @dag = RGL::DirectedAdjacencyGraph.new package_sets.each do |p| p.imports.each do |dep| @dag.add_edge dep, p end end @dag.add_vertex root_pkg_set import_order = root_pkg_set.imports.to_a import_order.each_with_index do |p, index| if index + 1 < import_order.size @dag.add_edge p, import_order[index + 1] @dag.add_edge p, root_pkg_set end end end
Public Instance Methods
Source
# File lib/autoproj/ops/configuration.rb, line 56 def flatten @dag.topsort_iterator.to_a end
Flatten the hierarchy, a establish a sorting
Source
# File lib/autoproj/ops/configuration.rb, line 61 def to_png(path) @dag.write_to_graphic_file("png", path.gsub(".png", "")) end
Write the hierarchy to an image (png) file
Source
# File lib/autoproj/ops/configuration.rb, line 37 def verify_acyclic return if @dag.acyclic? Autoproj.fatal "The package sets form (a) cycle(s)" @dag.cycles.each_with_index do |cycle, index| Autoproj.fatal "== Cycle #{index}" (cycle + cycle[0, 1]).each_cons(2) do |a, b| if b.imports.include?(a) Autoproj.fatal " #{b.name} depends on #{a.name} in its source.yml" else Autoproj.fatal " #{b.name} is after #{a.name} in the package_sets section of the manifest" end end end raise ConfigError.new "cycles in package set dependencies" end