#! /usr/bin/env ruby require 'autoproj' require 'autoproj/cmdline' Autoproj.silent = true Autoproj::CmdLine.initialize_root_directory Autoproj::CmdLine.initialize_and_load(ARGV) require 'pp' default_packages = Autoproj.manifest.default_packages revdeps = Autoproj.manifest.compute_revdeps selected_packages = ARGV.map do |arg| if File.directory?(arg) File.expand_path(arg) else arg end end selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages) selected_packages.selection.each_key do |name| result = Autoproj.manifest.resolve_package_name(name) packages, osdeps = result.partition { |type, name| type == :package } packages = packages.map(&:last) osdeps = osdeps.map(&:last) packages.each do |pkg_name| puts "source package #{pkg_name}" if default_packages.include?(pkg_name) selection = default_packages.selection[pkg_name] selection.delete(pkg_name) if selection.empty? puts " is directly selected by the manifest" else puts " is directly selected by the manifest via #{selection.to_a.join(", ")}" end else puts " is not directly selected by the manifest" end all_reverse_dependencies = Set.new pkg_revdeps = revdeps[pkg_name].dup.to_a while !pkg_revdeps.empty? parent_name = pkg_revdeps.shift next if all_reverse_dependencies.include?(parent_name) all_reverse_dependencies << parent_name pkg_revdeps.concat(revdeps[parent_name].to_a) end selections = Set.new all_reverse_dependencies = all_reverse_dependencies.to_a.sort all_reverse_dependencies.each do |parent_name| if default_packages.include?(parent_name) selections |= default_packages.selection[parent_name] end end if !selections.empty? puts " selected by way of #{selections.to_a.join(", ")}" end end osdeps.each do |pkg_name| puts "the osdep '#{pkg_name}'" Autoproj.osdeps.resolve_os_dependencies(pkg_name).each do |manager, packages| puts " #{manager.names.first}: #{packages.map { |*subnames| subnames.join(" ") }.join(", ")}" end end end