Class: Autoproj::CLI::Update
Direct Known Subclasses
Defined Under Namespace
Classes: AskUpdateFilter
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #finish_loading_configuration(selected_packages) ⇒ Object
- #normalize_osdeps_options(checkout_only: false, osdeps: true, osdeps_mode: nil, osdeps_filter_uptodate: true) ⇒ Object
- #run(selected_packages, run_hook: false, report: true, ask: false, **options) ⇒ Object
- #setup_update_from(other_root) ⇒ Object
- #update_packages(selected_packages, from: nil, checkout_only: false, only_local: false, reset: false, deps: true, keep_going: false, parallel: 1, retry_count: 0, osdeps: true, auto_exclude: false, osdeps_options: Hash.new, report: true, ask: false) ⇒ Object
- #validate_options(selection, options) ⇒ Object
Methods inherited from Base
#export_env_sh, #initialize, #normalize_command_line_package_selection, #notify_env_sh_updated, #resolve_selection, #resolve_user_selection, validate_options, #validate_user_selection
Methods included from Ops::Tools
#common_options, #create_autobuild_package, #load_autoprojrc, #load_main_initrb
Constructor Details
This class inherits a constructor from Autoproj::CLI::Base
Instance Method Details
#finish_loading_configuration(selected_packages) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/autoproj/cli/update.rb', line 165 def finish_loading_configuration(selected_packages) ws.setup_all_package_directories # Call resolve_user_selection once to auto-add packages resolve_user_selection(selected_packages) # Now we can finalize and re-resolve the selection since the # overrides.rb files might have changed it ws.finalize_package_setup # Finally, filter out exclusions resolved_selected_packages, = resolve_user_selection(selected_packages) validate_user_selection(selected_packages, resolved_selected_packages) if selected_packages.empty? command_line_selection = Array.new else command_line_selection = resolved_selected_packages.dup end [command_line_selection, resolved_selected_packages] end |
#normalize_osdeps_options(checkout_only: false, osdeps: true, osdeps_mode: nil, osdeps_filter_uptodate: true) ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/autoproj/cli/update.rb', line 185 def ( checkout_only: false, osdeps: true, osdeps_mode: nil, osdeps_filter_uptodate: true ) = Hash[install_only: checkout_only] if osdeps_mode [:osdeps_mode] = osdeps_mode elsif !osdeps [:osdeps_mode] = Array.new end ws.os_package_installer.filter_uptodate_packages = osdeps_filter_uptodate end |
#run(selected_packages, run_hook: false, report: true, ask: false, **options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/autoproj/cli/update.rb', line 66 def run(selected_packages, run_hook: false, report: true, ask: false, **) ws.manifest.accept_unavailable_osdeps = ![:osdeps] ws.setup ws.(force: true) if ask prompt = TTY::Prompt.new [:bundler] &&= prompt.yes?("Update bundler ?") [:autoproj] &&= prompt.yes?("Update autoproj ?") end ws.update_bundler if [:bundler] ws.update_autoproj if [:autoproj] begin ws.load_package_sets( mainline: [:mainline], only_local: [:only_local], checkout_only: ![:config] || [:checkout_only], reset: [:reset], keep_going: [:keep_going], retry_count: [:retry_count] ) rescue ImportFailed => configuration_import_failure raise unless [:keep_going] ensure ws.config.save end if [:packages] command_line_selection, selected_packages = finish_loading_configuration(selected_packages) else ws.setup_all_package_directories ws.finalize_package_setup command_line_selection = [] selected_packages = PackageSelection.new end = ( checkout_only: [:checkout_only], osdeps_mode: [:osdeps_mode], osdeps: [:osdeps], osdeps_filter_uptodate: [:osdeps_filter_uptodate] ) source_packages, osdep_packages, import_failure = update_packages( selected_packages, osdeps: [:osdeps], osdeps_options: , from: [:from], checkout_only: [:checkout_only], only_local: [:only_local], reset: [:reset], deps: [:deps], keep_going: [:keep_going], parallel: [:parallel] || ws.config.parallel_import_level, retry_count: [:retry_count], auto_exclude: [:auto_exclude], ask: ask, report: report ) ws.finalize_setup ws.export_installation_manifest if [:osdeps] && !osdep_packages.empty? ws.install_os_repositories ws.install_os_packages(osdep_packages, **) end if run_hook if [:osdeps] CLI::Main.run_post_command_hook(:update, ws, source_packages: source_packages, osdep_packages: osdep_packages) else CLI::Main.run_post_command_hook(:update, ws, source_packages: source_packages, osdep_packages: []) end end export_env_sh if ![:auto_exclude] && ![:ignore_errors] if import_failure && configuration_import_failure raise ImportFailed.new(configuration_import_failure.original_errors + import_failure.original_errors) elsif import_failure raise import_failure elsif configuration_import_failure raise configuration_import_failure end end [command_line_selection, source_packages, osdep_packages] end |
#setup_update_from(other_root) ⇒ Object
283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/autoproj/cli/update.rb', line 283 def setup_update_from(other_root) manifest.each_autobuild_package do |pkg| if pkg.importer.respond_to?(:pick_from_autoproj_root) unless pkg.importer.pick_from_autoproj_root(pkg, other_root) pkg.update = false end else pkg.update = false end end end |
#update_packages(selected_packages, from: nil, checkout_only: false, only_local: false, reset: false, deps: true, keep_going: false, parallel: 1, retry_count: 0, osdeps: true, auto_exclude: false, osdeps_options: Hash.new, report: true, ask: false) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/autoproj/cli/update.rb', line 239 def update_packages(selected_packages, from: nil, checkout_only: false, only_local: false, reset: false, deps: true, keep_going: false, parallel: 1, retry_count: 0, osdeps: true, auto_exclude: false, osdeps_options: Hash.new, report: true, ask: false) setup_update_from(from) if from filter = if ask prompt = TTY::Prompt.new filter = AskUpdateFilter.new( prompt, parallel: parallel, only_local: only_local ) else ->(pkg) { true } end ops = Autoproj::Ops::Import.new( ws, report_path: (ws.import_report_path if report) ) source_packages, osdep_packages = ops.import_packages(selected_packages, checkout_only: checkout_only, only_local: only_local, reset: reset, recursive: deps, keep_going: keep_going, parallel: parallel, retry_count: retry_count, install_vcs_packages: ( if osdeps), auto_exclude: auto_exclude, filter: filter) [source_packages, osdep_packages, nil] rescue ExcludedSelection => e raise CLIInvalidSelection, e., e.backtrace rescue PackageImportFailed => import_failure raise unless keep_going [import_failure.source_packages, import_failure.osdep_packages, import_failure] end |
#validate_options(selection, options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/autoproj/cli/update.rb', line 9 def (selection, ) selection, = super if (from = [:from]) [:from] = Autoproj::InstallationManifest.from_workspace_root(from) end [:deps] = false if [:no_deps_shortcut] if [:aup] && ![:config] && ![:all] && selection.empty? if Dir.pwd == ws.root_dir [:all] = true else selection = [Dir.pwd] end end [:reset] = :force if .delete(:force_reset) if (mainline = [:mainline]) if mainline == "mainline" || mainline == "true" [:mainline] = true end end has_explicit_selection = !selection.empty? selection, config_selected = normalize_command_line_package_selection(selection) # Autoproj and configuration are updated only if (1) it is # explicitely selected or (2) nothing is explicitely selected update_autoproj = ([:autoproj] || ( [:autoproj] != false && !has_explicit_selection && ![:config] && ![:checkout_only]) ) update_config = ([:config] || config_selected || ( [:config] != false && !has_explicit_selection && ![:autoproj])) update_packages = [:all] || (has_explicit_selection && !selection.empty?) || (!has_explicit_selection && ![:config] && ![:autoproj]) [:bundler] = update_autoproj [:autoproj] = update_autoproj [:config] = update_config [:packages] = update_packages [selection, ] end |