Skip to content

Commit

Permalink
cli: add osdeps --system-info
Browse files Browse the repository at this point in the history
  • Loading branch information
doudou committed Aug 2, 2017
1 parent 86521f3 commit c963065
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/autoproj/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ def show(*packages)
end

desc 'osdeps [PACKAGES]', 'install/update OS dependencies that are required by the given package (or for the whole installation if no packages are given'
option :system_info, type: :boolean,
desc: 'show information about the osdep system and quit'
option :update, type: :boolean, default: true,
desc: 'whether already installed packages should be updated or not'
def osdeps(*packages)
run_autoproj_cli(:osdeps, :OSDeps, Hash[], *packages)
run_autoproj_cli(:osdeps, :OSDeps, Hash[silent: options[:system_info]], *packages)
end

desc 'versions [PACKAGES]', 'generate a version file for the given packages, or all packages if none are given'
Expand Down
14 changes: 14 additions & 0 deletions lib/autoproj/cli/osdeps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ module CLI
class OSDeps < InspectionTool
def run(user_selection, update: true, **options)
initialize_and_load
if options[:system_info]
os_names, os_versions = ws.os_package_resolver.operating_system
os_package_manager_names = OSPackageResolver::OS_PACKAGE_MANAGERS.values
os_indep_managers = ws.os_package_installer.package_managers.
each_key.find_all do |name, manager|
!os_package_manager_names.include?(name)
end
puts "OS Names: #{(os_names - ['default']).join(", ")}"
puts "OS Versions: #{(os_versions - ['default']).join(", ")}"
puts "OS Package Manager: #{ws.os_package_resolver.os_package_manager}"
puts "Available Package Managers: #{os_indep_managers.sort.join(", ")}"
return
end

_, osdep_packages, resolved_selection, _ =
finalize_setup(user_selection)

Expand Down

0 comments on commit c963065

Please sign in to comment.