autoproj 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +79 -91
  5. data/.rubocop_todo.yml +1473 -0
  6. data/Gemfile +9 -9
  7. data/Rakefile +24 -24
  8. data/autoproj.gemspec +22 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +6 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +2 -2
  14. data/bin/autoproj_bootstrap +186 -183
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +185 -182
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +5 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +61 -44
  22. data/lib/autoproj/autobuild_extensions/git.rb +27 -26
  23. data/lib/autoproj/autobuild_extensions/package.rb +23 -22
  24. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  25. data/lib/autoproj/base.rb +1 -1
  26. data/lib/autoproj/bash_completion.rb +5 -6
  27. data/lib/autoproj/build_option.rb +22 -24
  28. data/lib/autoproj/cli/base.rb +27 -27
  29. data/lib/autoproj/cli/bootstrap.rb +14 -16
  30. data/lib/autoproj/cli/build.rb +18 -10
  31. data/lib/autoproj/cli/cache.rb +51 -8
  32. data/lib/autoproj/cli/clean.rb +10 -10
  33. data/lib/autoproj/cli/commit.rb +7 -8
  34. data/lib/autoproj/cli/doc.rb +2 -2
  35. data/lib/autoproj/cli/envsh.rb +1 -2
  36. data/lib/autoproj/cli/exec.rb +60 -20
  37. data/lib/autoproj/cli/inspection_tool.rb +18 -13
  38. data/lib/autoproj/cli/locate.rb +30 -41
  39. data/lib/autoproj/cli/log.rb +7 -7
  40. data/lib/autoproj/cli/main.rb +217 -205
  41. data/lib/autoproj/cli/main_doc.rb +22 -21
  42. data/lib/autoproj/cli/main_global.rb +44 -19
  43. data/lib/autoproj/cli/main_plugin.rb +18 -18
  44. data/lib/autoproj/cli/main_test.rb +28 -27
  45. data/lib/autoproj/cli/manifest.rb +7 -7
  46. data/lib/autoproj/cli/osdeps.rb +12 -11
  47. data/lib/autoproj/cli/patcher.rb +2 -3
  48. data/lib/autoproj/cli/query.rb +17 -18
  49. data/lib/autoproj/cli/reconfigure.rb +1 -2
  50. data/lib/autoproj/cli/reset.rb +9 -12
  51. data/lib/autoproj/cli/show.rb +48 -55
  52. data/lib/autoproj/cli/status.rb +56 -44
  53. data/lib/autoproj/cli/switch_config.rb +5 -6
  54. data/lib/autoproj/cli/tag.rb +12 -11
  55. data/lib/autoproj/cli/test.rb +7 -7
  56. data/lib/autoproj/cli/update.rb +104 -51
  57. data/lib/autoproj/cli/utility.rb +14 -12
  58. data/lib/autoproj/cli/version.rb +42 -40
  59. data/lib/autoproj/cli/versions.rb +14 -15
  60. data/lib/autoproj/cli/watch.rb +33 -37
  61. data/lib/autoproj/cli/which.rb +16 -20
  62. data/lib/autoproj/cli.rb +4 -2
  63. data/lib/autoproj/configuration.rb +78 -85
  64. data/lib/autoproj/default.osdeps +29 -3
  65. data/lib/autoproj/environment.rb +42 -23
  66. data/lib/autoproj/exceptions.rb +9 -3
  67. data/lib/autoproj/find_workspace.rb +20 -25
  68. data/lib/autoproj/git_server_configuration.rb +40 -44
  69. data/lib/autoproj/gitorious.rb +1 -1
  70. data/lib/autoproj/installation_manifest.rb +64 -29
  71. data/lib/autoproj/local_package_set.rb +13 -11
  72. data/lib/autoproj/manifest.rb +145 -135
  73. data/lib/autoproj/metapackage.rb +2 -6
  74. data/lib/autoproj/ops/atomic_write.rb +7 -6
  75. data/lib/autoproj/ops/build.rb +4 -6
  76. data/lib/autoproj/ops/cache.rb +64 -53
  77. data/lib/autoproj/ops/cached_env.rb +7 -6
  78. data/lib/autoproj/ops/configuration.rb +511 -506
  79. data/lib/autoproj/ops/import.rb +90 -61
  80. data/lib/autoproj/ops/install.rb +179 -175
  81. data/lib/autoproj/ops/loader.rb +77 -76
  82. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  83. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  84. data/lib/autoproj/ops/snapshot.rb +250 -247
  85. data/lib/autoproj/ops/tools.rb +76 -78
  86. data/lib/autoproj/ops/watch.rb +6 -6
  87. data/lib/autoproj/ops/which.rb +17 -14
  88. data/lib/autoproj/options.rb +13 -2
  89. data/lib/autoproj/os_package_installer.rb +102 -92
  90. data/lib/autoproj/os_package_query.rb +7 -13
  91. data/lib/autoproj/os_package_resolver.rb +189 -140
  92. data/lib/autoproj/os_repository_installer.rb +4 -4
  93. data/lib/autoproj/os_repository_resolver.rb +8 -6
  94. data/lib/autoproj/package_definition.rb +12 -13
  95. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +46 -31
  96. data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
  97. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  98. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  99. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  100. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  101. data/lib/autoproj/package_managers/manager.rb +8 -3
  102. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  103. data/lib/autoproj/package_managers/pip_manager.rb +37 -27
  104. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  105. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  106. data/lib/autoproj/package_managers/shell_script_manager.rb +66 -36
  107. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  108. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  109. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  110. data/lib/autoproj/package_manifest.rb +66 -53
  111. data/lib/autoproj/package_selection.rb +187 -187
  112. data/lib/autoproj/package_set.rb +128 -114
  113. data/lib/autoproj/python.rb +285 -0
  114. data/lib/autoproj/query_base.rb +20 -14
  115. data/lib/autoproj/reporter.rb +19 -19
  116. data/lib/autoproj/repository_managers/apt.rb +101 -67
  117. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  118. data/lib/autoproj/shell_completion.rb +16 -13
  119. data/lib/autoproj/source_package_query.rb +29 -36
  120. data/lib/autoproj/system.rb +32 -21
  121. data/lib/autoproj/test.rb +131 -106
  122. data/lib/autoproj/variable_expansion.rb +10 -10
  123. data/lib/autoproj/vcs_definition.rb +53 -37
  124. data/lib/autoproj/version.rb +1 -1
  125. data/lib/autoproj/workspace.rb +162 -117
  126. data/lib/autoproj/zsh_completion.rb +8 -9
  127. data/lib/autoproj.rb +53 -53
  128. data/samples/autoproj/init.rb +1 -2
  129. metadata +62 -72
  130. data/.travis.yml +0 -22
@@ -1,627 +1,632 @@
1
1
  module Autoproj
2
2
  module Ops
3
- #--
4
- # NOTE: indentation is wrong to let git track the history properly
5
- #+++
6
-
7
- # Implementation of the operations to manage the configuration
8
- class Configuration
9
- attr_reader :ws
10
-
11
- # The autoproj install we should update from (if any)
12
- #
13
- # @return [nil,InstallationManifest]
14
- attr_reader :update_from
15
-
16
- # The path in which remote package sets should be exposed to the
17
- # user
18
- #
19
- # @return [String]
20
- def remotes_dir
21
- ws.remotes_dir
22
- end
3
+ #--
4
+ # NOTE: indentation is wrong to let git track the history properly
5
+ #+++
6
+
7
+ # Implementation of the operations to manage the configuration
8
+ class Configuration
9
+ attr_reader :ws
10
+
11
+ # The autoproj install we should update from (if any)
12
+ #
13
+ # @return [nil,InstallationManifest]
14
+ attr_reader :update_from
15
+
16
+ # The path in which remote package sets should be exposed to the
17
+ # user
18
+ #
19
+ # @return [String]
20
+ def remotes_dir
21
+ ws.remotes_dir
22
+ end
23
23
 
24
- # The path in which remote package sets should be exposed to the
25
- # user
26
- #
27
- # @return [String]
28
- def remotes_user_dir
29
- File.join(ws.config_dir, "remotes")
30
- end
24
+ # The path in which remote package sets should be exposed to the
25
+ # user
26
+ #
27
+ # @return [String]
28
+ def remotes_user_dir
29
+ File.join(ws.config_dir, "remotes")
30
+ end
31
31
 
32
- # The path to the main manifest file
33
- #
34
- # @return [String]
35
- def manifest_path
36
- ws.manifest_file_path
37
- end
32
+ # The path to the main manifest file
33
+ #
34
+ # @return [String]
35
+ def manifest_path
36
+ ws.manifest_file_path
37
+ end
38
38
 
39
- # @param [Manifest] manifest
40
- # @param [Loader] loader
41
- # @option options [InstallationManifest] :update_from
42
- # another autoproj installation from which we
43
- # should update (instead of the normal VCS)
44
- def initialize(workspace, update_from: nil)
45
- @ws = workspace
46
- @update_from = update_from
47
- @remote_update_message_displayed = false
48
- end
39
+ # @param [Manifest] manifest
40
+ # @param [Loader] loader
41
+ # @option options [InstallationManifest] :update_from
42
+ # another autoproj installation from which we
43
+ # should update (instead of the normal VCS)
44
+ def initialize(workspace, update_from: nil)
45
+ @ws = workspace
46
+ @update_from = update_from
47
+ @remote_update_message_displayed = false
48
+ end
49
49
 
50
- # Imports or updates a source (remote or otherwise).
51
- #
52
- # See create_autobuild_package for informations about the arguments.
53
- def update_configuration_repository(vcs, name, into,
50
+ # Imports or updates a source (remote or otherwise).
51
+ #
52
+ # See create_autobuild_package for informations about the arguments.
53
+ def update_configuration_repository(vcs, name, into,
54
54
  only_local: false,
55
55
  reset: false,
56
56
  retry_count: nil)
57
57
 
58
- fake_package = Tools.create_autobuild_package(vcs, name, into)
59
- if update_from
60
- # Define a package in the installation manifest that points to
61
- # the desired folder in other_root
62
- relative_path = Pathname.new(into).
63
- relative_path_from(Pathname.new(ws.root_dir)).to_s
64
- other_dir = File.join(update_from.path, relative_path)
65
- if File.directory?(other_dir)
66
- update_from.packages.unshift(
67
- InstallationManifest::Package.new(fake_package.name, other_dir, File.join(other_dir, 'install')))
68
- end
58
+ fake_package = Tools.create_autobuild_package(vcs, name, into)
59
+ if update_from
60
+ # Define a package in the installation manifest that points to
61
+ # the desired folder in other_root
62
+ relative_path = Pathname.new(into)
63
+ .relative_path_from(Pathname.new(ws.root_dir)).to_s
64
+ other_dir = File.join(update_from.path, relative_path)
65
+ if File.directory?(other_dir)
66
+ update_from.packages.unshift(
67
+ InstallationManifest::Package.new(fake_package.name, other_dir, File.join(other_dir, "install"))
68
+ )
69
+ end
69
70
 
70
- # Then move the importer there if possible
71
- if fake_package.importer.respond_to?(:pick_from_autoproj_root)
72
- if !fake_package.importer.pick_from_autoproj_root(fake_package, update_from)
71
+ # Then move the importer there if possible
72
+ if fake_package.importer.respond_to?(:pick_from_autoproj_root)
73
+ unless fake_package.importer.pick_from_autoproj_root(fake_package, update_from)
74
+ fake_package.update = false
75
+ end
76
+ else
73
77
  fake_package.update = false
74
78
  end
75
- else
76
- fake_package.update = false
77
79
  end
78
- end
79
- if retry_count
80
- fake_package.importer.retry_count = retry_count
81
- end
82
- fake_package.import(only_local: only_local, reset: reset)
83
-
84
- rescue Autobuild::ConfigException => e
85
- raise ConfigError.new, "cannot import #{name}: #{e.message}", e.backtrace
86
- end
87
-
88
- # Update the main configuration repository
89
- #
90
- # @return [Boolean] true if something got updated or checked out,
91
- # and false otherwise
92
- def update_main_configuration(keep_going: false, checkout_only: !Autobuild.do_update, only_local: false, reset: false, retry_count: nil)
93
- if checkout_only && File.exist?(ws.config_dir)
94
- return []
80
+ fake_package.importer.retry_count = retry_count if retry_count
81
+ fake_package.import(only_local: only_local, reset: reset)
82
+ rescue Autobuild::ConfigException => e
83
+ raise ConfigError.new, "cannot import #{name}: #{e.message}", e.backtrace
95
84
  end
96
85
 
97
- update_configuration_repository(
98
- ws.manifest.vcs, "autoproj main configuration", ws.config_dir,
99
- only_local: only_local, reset: reset, retry_count: retry_count
100
- )
101
- []
102
- rescue Interrupt
103
- raise
104
- rescue Exception => e
105
- if keep_going
106
- [e]
107
- else
108
- raise e
86
+ # Update the main configuration repository
87
+ #
88
+ # @return [Boolean] true if something got updated or checked out,
89
+ # and false otherwise
90
+ def update_main_configuration(keep_going: false, checkout_only: !Autobuild.do_update, only_local: false, reset: false, retry_count: nil)
91
+ return [] if checkout_only && File.exist?(ws.config_dir)
92
+
93
+ update_configuration_repository(
94
+ ws.manifest.vcs, "autoproj main configuration", ws.config_dir,
95
+ only_local: only_local, reset: reset, retry_count: retry_count
96
+ )
97
+ []
98
+ rescue Interrupt
99
+ raise
100
+ rescue Exception => e
101
+ if keep_going
102
+ [e]
103
+ else
104
+ raise e
105
+ end
109
106
  end
110
- end
111
107
 
112
- # Update or checkout a remote package set, based on its VCS definition
113
- #
114
- # @param [VCSDefinition] vcs the package set VCS
115
- # @return [Boolean] true if something got updated or checked out,
116
- # and false otherwise
117
- def update_remote_package_set(vcs,
108
+ # Update or checkout a remote package set, based on its VCS definition
109
+ #
110
+ # @param [VCSDefinition] vcs the package set VCS
111
+ # @return [Boolean] true if something got updated or checked out,
112
+ # and false otherwise
113
+ def update_remote_package_set(vcs,
118
114
  checkout_only: !Autobuild.do_update,
119
115
  only_local: false,
120
116
  reset: false,
121
117
  retry_count: nil)
122
118
 
123
- raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
124
- if checkout_only && File.exist?(raw_local_dir)
125
- return
126
- end
119
+ raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
120
+ return if checkout_only && File.exist?(raw_local_dir)
127
121
 
128
- # name_of does minimal validation of source.yml, so do it here
129
- # even though we don't really need it
130
- name = PackageSet.name_of(ws, vcs, ignore_load_errors: true)
131
- ws.install_os_packages([vcs.type], all: nil)
132
- update_configuration_repository(
133
- vcs, name, raw_local_dir,
134
- only_local: only_local,
135
- reset: reset,
136
- retry_count: retry_count)
137
- end
122
+ # name_of does minimal validation of source.yml, so do it here
123
+ # even though we don't really need it
124
+ name = PackageSet.name_of(ws, vcs, ignore_load_errors: true)
125
+ ws.install_os_packages([vcs.type], all: nil)
126
+ update_configuration_repository(
127
+ vcs, name, raw_local_dir,
128
+ only_local: only_local,
129
+ reset: reset,
130
+ retry_count: retry_count
131
+ )
132
+ end
138
133
 
139
- # Create the user-visible directory for a remote package set
140
- #
141
- # @param [VCSDefinition] vcs the package set VCS
142
- # @return [String] the full path to the created user dir
143
- def create_remote_set_user_dir(vcs)
144
- name = PackageSet.name_of(ws, vcs)
145
- raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
146
- FileUtils.mkdir_p(remotes_user_dir)
147
- symlink_dest = File.join(remotes_user_dir, name)
148
-
149
- # Check if the current symlink is valid, and recreate it if it
150
- # is not
151
- if File.symlink?(symlink_dest)
152
- dest = File.readlink(symlink_dest)
153
- if dest != raw_local_dir
134
+ # Create the user-visible directory for a remote package set
135
+ #
136
+ # @param [VCSDefinition] vcs the package set VCS
137
+ # @return [String] the full path to the created user dir
138
+ def create_remote_set_user_dir(vcs)
139
+ name = PackageSet.name_of(ws, vcs)
140
+ raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
141
+ FileUtils.mkdir_p(remotes_user_dir)
142
+ symlink_dest = File.join(remotes_user_dir, name)
143
+
144
+ # Check if the current symlink is valid, and recreate it if it
145
+ # is not
146
+ if File.symlink?(symlink_dest)
147
+ dest = File.readlink(symlink_dest)
148
+ if dest != raw_local_dir
149
+ FileUtils.rm_f symlink_dest
150
+ Autoproj.create_symlink(raw_local_dir, symlink_dest)
151
+ end
152
+ else
154
153
  FileUtils.rm_f symlink_dest
155
154
  Autoproj.create_symlink(raw_local_dir, symlink_dest)
156
155
  end
157
- else
158
- FileUtils.rm_f symlink_dest
159
- Autoproj.create_symlink(raw_local_dir, symlink_dest)
160
- end
161
156
 
162
- symlink_dest
163
- end
164
-
165
- def load_package_set(vcs, options, imported_from)
166
- pkg_set = PackageSet.new(ws, vcs)
167
- pkg_set.auto_imports = options[:auto_imports]
168
- ws.load_if_present(pkg_set, pkg_set.local_dir, 'init.rb')
169
- pkg_set.load_description_file
170
- if imported_from
171
- pkg_set.imported_from << imported_from
172
- imported_from.imports << pkg_set
157
+ symlink_dest
173
158
  end
174
- pkg_set
175
- end
176
159
 
177
- def queue_auto_imports_if_needed(queue, pkg_set, root_set)
178
- if pkg_set.auto_imports?
179
- pkg_set.each_raw_imported_set do |import_vcs, import_options|
180
- vcs_overrides_key = import_vcs.overrides_key
181
- import_vcs = root_set.resolve_overrides("pkg_set:#{vcs_overrides_key}", import_vcs)
182
- queue << [import_vcs, import_options, pkg_set]
160
+ def load_package_set(vcs, options, imported_from)
161
+ pkg_set = PackageSet.new(ws, vcs)
162
+ pkg_set.auto_imports = options[:auto_imports]
163
+ ws.load_if_present(pkg_set, pkg_set.local_dir, "init.rb")
164
+ pkg_set.load_description_file
165
+ if imported_from
166
+ pkg_set.imported_from << imported_from
167
+ imported_from.imports << pkg_set
183
168
  end
169
+ pkg_set
184
170
  end
185
- queue
186
- end
187
171
 
188
- # Load the package set information
189
- #
190
- # It loads the package set information as required by {manifest} and
191
- # makes sure that they are either updated (if Autobuild.do_update is
192
- # true), or at least checked out.
193
- #
194
- # @yieldparam [String] osdep the name of an osdep required to import the
195
- # package sets
196
- def load_and_update_package_sets(root_pkg_set,
197
- only_local: false,
198
- checkout_only: !Autobuild.do_update,
199
- keep_going: false,
200
- reset: false,
201
- retry_count: nil)
202
- package_sets = [root_pkg_set]
203
- by_repository_id = Hash.new
204
- by_name = Hash.new
205
- failures = Array.new
206
-
207
- required_remotes_dirs = Array.new
208
-
209
- queue = queue_auto_imports_if_needed(Array.new, root_pkg_set, root_pkg_set)
210
- while !queue.empty?
211
- vcs, import_options, imported_from = queue.shift
212
- repository_id = vcs.overrides_key
213
- if already_processed = by_repository_id[repository_id]
214
- already_processed_vcs, already_processed_from, pkg_set = *already_processed
215
- if (already_processed_from != root_pkg_set) && (already_processed_vcs != vcs)
216
- Autoproj.warn "already loaded the package set from #{already_processed_vcs} from #{already_processed_from.name}, this overrides different settings (#{vcs}) found in #{imported_from.name}"
172
+ def queue_auto_imports_if_needed(queue, pkg_set, root_set)
173
+ if pkg_set.auto_imports?
174
+ pkg_set.each_raw_imported_set do |import_vcs, import_options|
175
+ vcs_overrides_key = import_vcs.overrides_key
176
+ import_vcs = root_set.resolve_overrides("pkg_set:#{vcs_overrides_key}", import_vcs)
177
+ queue << [import_vcs, import_options, pkg_set]
217
178
  end
218
-
219
- if imported_from
220
- pkg_set.imported_from << imported_from
221
- imported_from.imports << pkg_set
222
- end
223
- next
224
179
  end
225
- by_repository_id[repository_id] = [vcs, imported_from]
226
-
227
- # Make sure the package set has been already checked out to
228
- # retrieve the actual name of the package set
229
- if !vcs.local?
230
- failed = handle_keep_going(keep_going, vcs, failures) do
231
- update_remote_package_set(
232
- vcs, checkout_only: checkout_only,
233
- only_local: only_local, reset: reset,
234
- retry_count: retry_count)
235
- end
236
- raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
180
+ queue
181
+ end
182
+
183
+ # Load the package set information
184
+ #
185
+ # It loads the package set information as required by {manifest} and
186
+ # makes sure that they are either updated (if Autobuild.do_update is
187
+ # true), or at least checked out.
188
+ #
189
+ # @yieldparam [String] osdep the name of an osdep required to import the
190
+ # package sets
191
+ def load_and_update_package_sets(root_pkg_set,
192
+ only_local: false,
193
+ checkout_only: !Autobuild.do_update,
194
+ keep_going: false,
195
+ reset: false,
196
+ retry_count: nil)
197
+ package_sets = [root_pkg_set]
198
+ by_repository_id = Hash.new
199
+ by_name = Hash.new
200
+ failures = Array.new
201
+
202
+ required_remotes_dirs = Array.new
203
+
204
+ queue = queue_auto_imports_if_needed(Array.new, root_pkg_set, root_pkg_set)
205
+ until queue.empty?
206
+ vcs, import_options, imported_from = queue.shift
207
+ repository_id = vcs.overrides_key
208
+ if (already_processed = by_repository_id[repository_id])
209
+ already_processed_vcs, already_processed_from, pkg_set = *already_processed
210
+ if (already_processed_from != root_pkg_set) && (already_processed_vcs != vcs)
211
+ Autoproj.warn "already loaded the package set from #{already_processed_vcs} from #{already_processed_from.name}, this overrides different settings (#{vcs}) found in #{imported_from.name}"
212
+ end
237
213
 
238
- # We really can't continue if the VCS was being checked out
239
- # and that failed
240
- if failed && !File.directory?(raw_local_dir)
241
- raise failures.last
214
+ if imported_from
215
+ pkg_set.imported_from << imported_from
216
+ imported_from.imports << pkg_set
217
+ end
218
+ next
242
219
  end
220
+ by_repository_id[repository_id] = [vcs, imported_from]
221
+
222
+ # Make sure the package set has been already checked out to
223
+ # retrieve the actual name of the package set
224
+ unless vcs.local?
225
+ failed = handle_keep_going(keep_going, vcs, failures) do
226
+ update_remote_package_set(
227
+ vcs, checkout_only: checkout_only,
228
+ only_local: only_local, reset: reset,
229
+ retry_count: retry_count
230
+ )
231
+ end
232
+ raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)
243
233
 
244
- required_remotes_dirs << raw_local_dir
245
- end
234
+ # We really can't continue if the VCS was being checked out
235
+ # and that failed
236
+ raise failures.last if failed && !File.directory?(raw_local_dir)
246
237
 
247
- name = PackageSet.name_of(ws, vcs)
238
+ required_remotes_dirs << raw_local_dir
239
+ end
248
240
 
249
- required_user_dirs = by_name.collect { |k,v| k }
250
- Autoproj.debug "Trying to load package_set: #{name} from definition #{repository_id}"
251
- Autoproj.debug "Already loaded package_sets are: #{required_user_dirs}"
241
+ name = PackageSet.name_of(ws, vcs)
242
+
243
+ required_user_dirs = by_name.collect { |k, v| k }
244
+ Autoproj.debug "Trying to load package_set: #{name} from definition #{repository_id}"
245
+ Autoproj.debug "Already loaded package_sets are: #{required_user_dirs}"
246
+
247
+ if (already_loaded = by_name[name])
248
+ already_loaded_pkg_set, already_loaded_vcs = *already_loaded
249
+ if already_loaded_vcs != vcs
250
+ if imported_from
251
+ Autoproj.warn "redundant auto-import of package set '#{name}' by package set '#{imported_from.name}'"
252
+ Autoproj.warn " A package set with the same name has already been imported from"
253
+ Autoproj.warn " #{already_loaded_vcs}"
254
+ Autoproj.warn " Skipping the following one: "
255
+ Autoproj.warn " #{vcs}"
256
+ else
257
+ Autoproj.warn "the manifest refers to a package set from #{vcs}, but a package set with the same name (#{name}) has already been imported from #{already_loaded_vcs}, I am skipping this one"
258
+ end
259
+ end
252
260
 
253
- if already_loaded = by_name[name]
254
- already_loaded_pkg_set, already_loaded_vcs = *already_loaded
255
- if already_loaded_vcs != vcs
256
261
  if imported_from
257
- Autoproj.warn "redundant auto-import of package set '#{name}' by package set '#{imported_from.name}'"
258
- Autoproj.warn " A package set with the same name has already been imported from"
259
- Autoproj.warn " #{already_loaded_vcs}"
260
- Autoproj.warn " Skipping the following one: "
261
- Autoproj.warn " #{vcs}"
262
- else
263
- Autoproj.warn "the manifest refers to a package set from #{vcs}, but a package set with the same name (#{name}) has already been imported from #{already_loaded_vcs}, I am skipping this one"
262
+ already_loaded_pkg_set.imported_from << imported_from
263
+ imported_from.imports << already_loaded_pkg_set
264
+ by_repository_id[repository_id][2] = already_loaded_pkg_set
264
265
  end
266
+ next
265
267
  end
266
268
 
267
- if imported_from
268
- already_loaded_pkg_set.imported_from << imported_from
269
- imported_from.imports << already_loaded_pkg_set
270
- by_repository_id[repository_id][2] = already_loaded_pkg_set
271
- end
272
- next
273
- end
269
+ create_remote_set_user_dir(vcs) unless vcs.local?
270
+ pkg_set = load_package_set(vcs, import_options, imported_from)
271
+ by_repository_id[repository_id][2] = pkg_set
272
+ package_sets << pkg_set
274
273
 
275
- if !vcs.local?
276
- create_remote_set_user_dir(vcs)
274
+ by_name[pkg_set.name] = [pkg_set, vcs, import_options, imported_from]
275
+
276
+ # Finally, queue the imports
277
+ queue_auto_imports_if_needed(queue, pkg_set, root_pkg_set)
277
278
  end
278
- pkg_set = load_package_set(vcs, import_options, imported_from)
279
- by_repository_id[repository_id][2] = pkg_set
280
- package_sets << pkg_set
281
279
 
282
- by_name[pkg_set.name] = [pkg_set, vcs, import_options, imported_from]
280
+ required_user_dirs = by_name.collect { |k, v| k }
281
+ cleanup_remotes_dir(package_sets, required_remotes_dirs)
282
+ cleanup_remotes_user_dir(package_sets, required_user_dirs)
283
283
 
284
- # Finally, queue the imports
285
- queue_auto_imports_if_needed(queue, pkg_set, root_pkg_set)
284
+ [package_sets, failures]
286
285
  end
287
286
 
288
- required_user_dirs = by_name.collect { |k,v| k }
289
- cleanup_remotes_dir(package_sets, required_remotes_dirs)
290
- cleanup_remotes_user_dir(package_sets, required_user_dirs)
291
-
292
- return package_sets, failures
293
- end
294
-
295
- # Removes from {remotes_dir} the directories that do not match a package
296
- # set
297
- def cleanup_remotes_dir(package_sets = ws.manifest.package_sets, required_remotes_dirs = Array.new)
298
- # Cleanup the .remotes and remotes_symlinks_dir directories
299
- Dir.glob(File.join(remotes_dir, '*')).each do |dir|
300
- dir = File.expand_path(dir)
301
- # Once a package set has been checked out during the process,
302
- # keep it -- so that it won't be checked out again
303
- if File.directory?(dir) && !required_remotes_dirs.include?(dir)
304
- FileUtils.rm_rf dir
287
+ # Removes from {remotes_dir} the directories that do not match a package
288
+ # set
289
+ def cleanup_remotes_dir(package_sets = ws.manifest.package_sets, required_remotes_dirs = Array.new)
290
+ # Cleanup the .remotes and remotes_symlinks_dir directories
291
+ Dir.glob(File.join(remotes_dir, "*")).each do |dir|
292
+ dir = File.expand_path(dir)
293
+ # Once a package set has been checked out during the process,
294
+ # keep it -- so that it won't be checked out again
295
+ if File.directory?(dir) && !required_remotes_dirs.include?(dir)
296
+ FileUtils.rm_rf dir
297
+ end
305
298
  end
306
299
  end
307
- end
308
300
 
309
- # Removes from {remotes_user_dir} the directories that do not match a
310
- # package set
311
- def cleanup_remotes_user_dir(package_sets = ws.manifest.package_sets, required_user_dirs = Array.new)
312
- Dir.glob(File.join(remotes_user_dir, '*')).each do |file|
313
- file = File.expand_path(file)
314
- user_dir = File.basename(file)
315
- if File.symlink?(file) && !required_user_dirs.include?(user_dir)
316
- FileUtils.rm_f file
301
+ # Removes from {remotes_user_dir} the directories that do not match a
302
+ # package set
303
+ def cleanup_remotes_user_dir(package_sets = ws.manifest.package_sets, required_user_dirs = Array.new)
304
+ Dir.glob(File.join(remotes_user_dir, "*")).each do |file|
305
+ file = File.expand_path(file)
306
+ user_dir = File.basename(file)
307
+ if File.symlink?(file) && !required_user_dirs.include?(user_dir)
308
+ FileUtils.rm_f file
309
+ end
317
310
  end
318
311
  end
319
- end
320
312
 
321
- def inspect; to_s end
322
-
323
- def sort_package_sets_by_import_order(package_sets, root_pkg_set)
324
- # The sorting is done in two steps:
325
- # - first, we build a topological order of the package sets
326
- # - then, we insert the auto-imported packages, following this
327
- # topological order, in the user-provided order. Each package is
328
- # considered in turn, and added at the earliest place that fits
329
- # the dependencies
330
- topological = Array.new
331
- queue = (package_sets.to_a + [root_pkg_set]).uniq
332
- while !queue.empty?
333
- last_size = queue.size
334
- pending = queue.dup
335
- queue = Array.new
336
- while !pending.empty?
337
- pkg_set = pending.shift
338
- if pkg_set.imports.any? { |imported_set| !topological.include?(imported_set) }
339
- queue.push(pkg_set)
340
- else
341
- topological << pkg_set
313
+ def inspect
314
+ to_s
315
+ end
316
+
317
+ def sort_package_sets_by_import_order(package_sets, root_pkg_set)
318
+ # The sorting is done in two steps:
319
+ # - first, we build a topological order of the package sets
320
+ # - then, we insert the auto-imported packages, following this
321
+ # topological order, in the user-provided order. Each package is
322
+ # considered in turn, and added at the earliest place that fits
323
+ # the dependencies
324
+ topological = Array.new
325
+ queue = (package_sets.to_a + [root_pkg_set]).uniq
326
+ until queue.empty?
327
+ last_size = queue.size
328
+ pending = queue.dup
329
+ queue = Array.new
330
+ until pending.empty?
331
+ pkg_set = pending.shift
332
+ if pkg_set.imports.any? { |imported_set| !topological.include?(imported_set) }
333
+ queue.push(pkg_set)
334
+ else
335
+ topological << pkg_set
336
+ end
337
+ end
338
+ if queue.size == last_size
339
+ raise ArgumentError, "cannot resolve the dependencies between package sets. There seem to be a cycle amongst #{queue.map(&:name).sort.join(', ')}"
342
340
  end
343
341
  end
344
- if queue.size == last_size
345
- raise ArgumentError, "cannot resolve the dependencies between package sets. There seem to be a cycle amongst #{queue.map(&:name).sort.join(", ")}"
346
- end
347
- end
348
342
 
349
- result = root_pkg_set.imports.to_a.dup
350
- to_insert = topological.dup.
351
- find_all { |p| !result.include?(p) }
352
- while !to_insert.empty?
353
- pkg_set = to_insert.shift
354
- dependencies = pkg_set.imports.dup
355
- if dependencies.empty?
356
- result.unshift(pkg_set)
357
- else
358
- i = result.find_index do |p|
359
- dependencies.delete(p)
360
- dependencies.empty?
343
+ result = root_pkg_set.imports.to_a.dup
344
+ to_insert = topological.dup
345
+ .find_all { |p| !result.include?(p) }
346
+ until to_insert.empty?
347
+ pkg_set = to_insert.shift
348
+ dependencies = pkg_set.imports.dup
349
+ if dependencies.empty?
350
+ result.unshift(pkg_set)
351
+ else
352
+ i = result.find_index do |p|
353
+ dependencies.delete(p)
354
+ dependencies.empty?
355
+ end
356
+ result.insert(i + 1, pkg_set)
361
357
  end
362
- result.insert(i + 1, pkg_set)
363
358
  end
364
- end
365
359
 
366
- # Sanity check related to the root package set
367
- # - it should be last
368
- # - it should be present only once
369
- if result.last != root_pkg_set
370
- raise InternalError, "failed to sort the package sets: the root package set should be last, but is not"
360
+ # Sanity check related to the root package set
361
+ # - it should be last
362
+ # - it should be present only once
363
+ if result.last != root_pkg_set
364
+ raise InternalError, "failed to sort the package sets: the root package set should be last, but is not"
365
+ end
366
+
367
+ result
371
368
  end
372
- result
373
- end
374
369
 
375
- def load_package_sets(
370
+ def load_package_sets(
376
371
  only_local: false,
377
372
  checkout_only: true,
378
373
  keep_going: false,
379
374
  reset: false,
380
375
  retry_count: nil,
381
- mainline: nil)
382
- update_configuration(
383
- only_local: only_local,
384
- checkout_only: checkout_only,
385
- keep_going: keep_going,
386
- reset: reset,
387
- retry_count: retry_count,
388
- mainline: mainline)
389
- end
376
+ mainline: nil
377
+ )
378
+ update_configuration(
379
+ only_local: only_local,
380
+ checkout_only: checkout_only,
381
+ keep_going: keep_going,
382
+ reset: reset,
383
+ retry_count: retry_count,
384
+ mainline: mainline
385
+ )
386
+ end
390
387
 
391
- def report_import_failure(what, reason)
392
- if !reason.kind_of?(Interrupt)
393
- Autoproj.message "import of #{what} failed", :red
394
- Autoproj.message reason.to_s, :red
388
+ def report_import_failure(what, reason)
389
+ unless reason.kind_of?(Interrupt)
390
+ Autoproj.message "import of #{what} failed", :red
391
+ Autoproj.message reason.to_s, :red
392
+ end
395
393
  end
396
- end
397
394
 
398
- def handle_keep_going(keep_going, vcs, failures)
399
- yield
400
- false
401
- rescue Interrupt
402
- raise
403
- rescue Exception => failure_reason
404
- if keep_going
405
- report_import_failure(vcs, failure_reason)
406
- failures << failure_reason
407
- true
408
- else
395
+ def handle_keep_going(keep_going, vcs, failures)
396
+ yield
397
+ false
398
+ rescue Interrupt
409
399
  raise
400
+ rescue Exception => failure_reason
401
+ if keep_going
402
+ report_import_failure(vcs, failure_reason)
403
+ failures << failure_reason
404
+ true
405
+ else
406
+ raise
407
+ end
410
408
  end
411
- end
412
409
 
413
- def update_configuration(
410
+ def update_configuration(
414
411
  only_local: false,
415
412
  checkout_only: !Autobuild.do_update,
416
413
  keep_going: false,
417
414
  reset: false,
418
415
  retry_count: nil,
419
- mainline: nil)
416
+ mainline: nil
417
+ )
420
418
 
421
- if ws.manifest.vcs.needs_import?
422
- main_configuration_failure = update_main_configuration(
423
- keep_going: keep_going,
424
- checkout_only: checkout_only,
419
+ if ws.manifest.vcs.needs_import?
420
+ main_configuration_failure = update_main_configuration(
421
+ keep_going: keep_going,
422
+ checkout_only: checkout_only,
423
+ only_local: only_local,
424
+ reset: reset,
425
+ retry_count: retry_count
426
+ )
427
+
428
+ main_configuration_failure.each do |e|
429
+ report_import_failure("main configuration", e)
430
+ end
431
+ else
432
+ main_configuration_failure = []
433
+ end
434
+ ws.load_main_initrb
435
+ ws.manifest.load(manifest_path)
436
+ root_pkg_set = ws.manifest.main_package_set
437
+ root_pkg_set.load_description_file
438
+ root_pkg_set.explicit = true
439
+
440
+ package_sets_failure = update_package_sets(
425
441
  only_local: only_local,
442
+ checkout_only: checkout_only,
443
+ keep_going: keep_going,
426
444
  reset: reset,
427
- retry_count: retry_count)
445
+ retry_count: retry_count
446
+ )
447
+
448
+ load_package_set_information(mainline: mainline)
428
449
 
429
- main_configuration_failure.each do |e|
430
- report_import_failure("main configuration", e)
450
+ if !main_configuration_failure.empty? && !package_sets_failure.empty?
451
+ raise ImportFailed.new(main_configuration_failure + package_sets_failure)
452
+ elsif !main_configuration_failure.empty?
453
+ raise ImportFailed.new(main_configuration_failure)
454
+ elsif !package_sets_failure.empty?
455
+ raise ImportFailed.new(package_sets_failure)
431
456
  end
432
- else
433
- main_configuration_failure = []
434
457
  end
435
- ws.load_main_initrb
436
- ws.manifest.load(manifest_path)
437
- root_pkg_set = ws.manifest.main_package_set
438
- root_pkg_set.load_description_file
439
- root_pkg_set.explicit = true
440
-
441
- package_sets_failure = update_package_sets(
442
- only_local: only_local,
443
- checkout_only: checkout_only,
444
- keep_going: keep_going,
445
- reset: reset,
446
- retry_count: retry_count)
447
-
448
- load_package_set_information(mainline: mainline)
449
-
450
- if !main_configuration_failure.empty? && !package_sets_failure.empty?
451
- raise ImportFailed.new(main_configuration_failure + package_sets_failure)
452
- elsif !main_configuration_failure.empty?
453
- raise ImportFailed.new(main_configuration_failure)
454
- elsif !package_sets_failure.empty?
455
- raise ImportFailed.new(package_sets_failure)
456
- end
457
- end
458
458
 
459
- def load_package_set_information(mainline: nil)
460
- manifest = ws.manifest
461
- manifest.each_package_set do |pkg_set|
462
- if Gem::Version.new(pkg_set.required_autoproj_version) > Gem::Version.new(Autoproj::VERSION)
463
- raise ConfigError.new(pkg_set.source_file), "the #{pkg_set.name} package set requires autoproj v#{pkg_set.required_autoproj_version} but this is v#{Autoproj::VERSION}"
459
+ def load_package_set_information(mainline: nil)
460
+ manifest = ws.manifest
461
+ manifest.each_package_set do |pkg_set|
462
+ if Gem::Version.new(pkg_set.required_autoproj_version) > Gem::Version.new(Autoproj::VERSION)
463
+ raise ConfigError.new(pkg_set.source_file), "the #{pkg_set.name} package set requires autoproj v#{pkg_set.required_autoproj_version} but this is v#{Autoproj::VERSION}"
464
+ end
464
465
  end
465
- end
466
466
 
467
- # Loads OS repository definitions once and for all
468
- load_osrepos_from_package_sets
467
+ # Loads OS repository definitions once and for all
468
+ load_osrepos_from_package_sets
469
469
 
470
- # Loads OS package definitions once and for all
471
- load_osdeps_from_package_sets
470
+ # Loads OS package definitions once and for all
471
+ load_osdeps_from_package_sets
472
472
 
473
- # Load the required autobuild definitions
474
- manifest.each_package_set do |pkg_set|
475
- pkg_set.each_autobuild_file do |path|
476
- ws.import_autobuild_file pkg_set, path
473
+ # Load the required autobuild definitions
474
+ manifest.each_package_set do |pkg_set|
475
+ pkg_set.each_autobuild_file do |path|
476
+ ws.import_autobuild_file pkg_set, path
477
+ end
477
478
  end
478
- end
479
479
 
480
- # Now, load the package's importer configurations (from the various
481
- # source.yml files)
482
- if mainline.respond_to?(:to_str)
483
- mainline = manifest.package_set(mainline)
484
- end
485
- manifest.load_importers(mainline: mainline)
480
+ # Now, load the package's importer configurations (from the various
481
+ # source.yml files)
482
+ mainline = manifest.package_set(mainline) if mainline.respond_to?(:to_str)
483
+ manifest.load_importers(mainline: mainline)
486
484
 
487
- auto_add_packages_from_layout
485
+ auto_add_packages_from_layout
488
486
 
489
- manifest.each_autobuild_package do |pkg|
490
- Autobuild.each_utility do |uname, _|
491
- pkg.utility(uname).enabled =
492
- ws.config.utility_enabled_for?(uname, pkg.name)
487
+ manifest.each_autobuild_package do |pkg|
488
+ Autobuild.each_utility do |uname, _|
489
+ pkg.utility(uname).enabled =
490
+ ws.config.utility_enabled_for?(uname, pkg.name)
491
+ end
493
492
  end
494
- end
495
493
 
496
- mark_unavailable_osdeps_as_excluded
497
- end
494
+ mark_unavailable_osdeps_as_excluded
495
+ end
498
496
 
499
- # @api private
500
- #
501
- # Attempts to find packages mentioned in the layout but that are not
502
- # defined, and auto-define them if they can be found on disk
503
- #
504
- # It only warns about packages that can't be defined that way are on
505
- def auto_add_packages_from_layout
506
- manifest = ws.manifest
507
-
508
- # Auto-add packages that are
509
- # * present on disk
510
- # * listed in the layout part of the manifest
511
- # * but have no definition
512
- explicit = manifest.normalized_layout
513
- explicit.each do |pkg_or_set, layout_level|
514
- next if manifest.find_autobuild_package(pkg_or_set)
515
- next if manifest.has_package_set?(pkg_or_set)
516
- full_path = File.expand_path(File.join(ws.source_dir, layout_level, pkg_or_set))
517
- next if !File.directory?(full_path)
518
-
519
- if handler = auto_add_package(pkg_or_set, full_path)
520
- Autoproj.message " auto-added #{pkg_or_set} #{"in #{layout_level} " if layout_level != "/"}using the #{handler.gsub(/_package/, '')} package handler"
521
- else
522
- Autoproj.warn "cannot auto-add #{pkg_or_set}: unknown package type"
497
+ # @api private
498
+ #
499
+ # Attempts to find packages mentioned in the layout but that are not
500
+ # defined, and auto-define them if they can be found on disk
501
+ #
502
+ # It only warns about packages that can't be defined that way are on
503
+ def auto_add_packages_from_layout
504
+ manifest = ws.manifest
505
+
506
+ # Auto-add packages that are
507
+ # * present on disk
508
+ # * listed in the layout part of the manifest
509
+ # * but have no definition
510
+ explicit = manifest.normalized_layout
511
+ explicit.each do |pkg_or_set, layout_level|
512
+ next if manifest.find_autobuild_package(pkg_or_set)
513
+ next if manifest.has_package_set?(pkg_or_set)
514
+
515
+ full_path = File.expand_path(
516
+ File.join(ws.source_dir, layout_level, pkg_or_set)
517
+ )
518
+ next unless File.directory?(full_path)
519
+
520
+ if (handler = auto_add_package(pkg_or_set, full_path))
521
+ handler_name = handler.gsub(/_package/, "")
522
+ layout_level_msg = "in #{layout_level} " if layout_level != "/"
523
+ Autoproj.message " auto-added #{pkg_or_set} #{layout_level_msg}"\
524
+ "using the #{handler_name} package handler"
525
+ else
526
+ Autoproj.warn "cannot auto-add #{pkg_or_set}: "\
527
+ "unknown package type"
528
+ end
523
529
  end
524
-
525
530
  end
526
- end
527
531
 
528
- # @api private
529
- #
530
- # Attempts to auto-add the package checked out at the given path
531
- #
532
- # @param [String] full_path
533
- # @return [String,nil] either the name of the package handler used to
534
- # define the package, or nil if no handler could be found
535
- def auto_add_package(name, full_path)
536
- manifest = ws.manifest
537
- handler, _srcdir = Autoproj.package_handler_for(full_path)
538
- if handler
539
- ws.set_as_main_workspace do
540
- ws.in_package_set(manifest.main_package_set, manifest.file) do
541
- send(handler, name)
532
+ # @api private
533
+ #
534
+ # Attempts to auto-add the package checked out at the given path
535
+ #
536
+ # @param [String] full_path
537
+ # @return [String,nil] either the name of the package handler used to
538
+ # define the package, or nil if no handler could be found
539
+ def auto_add_package(name, full_path)
540
+ manifest = ws.manifest
541
+ handler, _srcdir = Autoproj.package_handler_for(full_path)
542
+ if handler
543
+ ws.set_as_main_workspace do
544
+ ws.in_package_set(manifest.main_package_set, manifest.file) do
545
+ send(handler, name)
546
+ end
542
547
  end
548
+ handler
543
549
  end
544
- handler
545
550
  end
546
- end
547
551
 
548
- def mark_unavailable_osdeps_as_excluded
549
- os_package_resolver = ws.os_package_resolver
550
- manifest = ws.manifest
551
- os_package_resolver.all_package_names.each do |osdep_name|
552
- # If the osdep can be replaced by source packages, there's
553
- # nothing to do really. The exclusions of the source packages
554
- # will work as expected
555
- if manifest.osdeps_overrides[osdep_name] || manifest.find_autobuild_package(osdep_name)
556
- next
557
- end
552
+ def mark_unavailable_osdeps_as_excluded
553
+ os_package_resolver = ws.os_package_resolver
554
+ manifest = ws.manifest
555
+ os_package_resolver.all_package_names.each do |osdep_name|
556
+ # If the osdep can be replaced by source packages, there's
557
+ # nothing to do really. The exclusions of the source packages
558
+ # will work as expected
559
+ if manifest.osdeps_overrides[osdep_name] || manifest.find_autobuild_package(osdep_name)
560
+ next
561
+ end
558
562
 
559
- case os_package_resolver.availability_of(osdep_name)
560
- when OSPackageResolver::UNKNOWN_OS
561
- manifest.exclude_package(osdep_name, "the current operating system is unknown to autoproj")
562
- when OSPackageResolver::WRONG_OS
563
- manifest.exclude_package(osdep_name, "#{osdep_name} is defined, but not for this operating system")
564
- when OSPackageResolver::NONEXISTENT
565
- manifest.exclude_package(osdep_name, "#{osdep_name} is marked as unavailable for this operating system")
563
+ case os_package_resolver.availability_of(osdep_name)
564
+ when OSPackageResolver::UNKNOWN_OS
565
+ manifest.exclude_package(osdep_name, "the current operating system is unknown to autoproj")
566
+ when OSPackageResolver::WRONG_OS
567
+ manifest.exclude_package(osdep_name, "#{osdep_name} is defined, but not for this operating system")
568
+ when OSPackageResolver::NONEXISTENT
569
+ manifest.exclude_package(osdep_name, "#{osdep_name} is marked as unavailable for this operating system")
570
+ end
566
571
  end
567
572
  end
568
- end
569
573
 
570
- # Load OS dependency information contained in our registered package
571
- # sets into the provided osdep object
572
- #
573
- # This is included in {load_package_sets}
574
- #
575
- # @return [void]
576
- def load_osdeps_from_package_sets
577
- ws.manifest.each_package_set do |pkg_set|
578
- pkg_set.each_osdeps_file do |file|
579
- file_osdeps = pkg_set.load_osdeps(
580
- file, operating_system: ws.operating_system)
581
- ws.os_package_resolver.merge(file_osdeps)
574
+ # Load OS dependency information contained in our registered package
575
+ # sets into the provided osdep object
576
+ #
577
+ # This is included in {load_package_sets}
578
+ #
579
+ # @return [void]
580
+ def load_osdeps_from_package_sets
581
+ ws.manifest.each_package_set do |pkg_set|
582
+ pkg_set.each_osdeps_file do |file|
583
+ file_osdeps = pkg_set.load_osdeps(
584
+ file, operating_system: ws.operating_system
585
+ )
586
+ ws.os_package_resolver.merge(file_osdeps)
587
+ end
582
588
  end
583
589
  end
584
- end
585
590
 
586
- # Load OS repository information contained in our registered package
587
- # sets into the provided osrepo object
588
- #
589
- # This is included in {load_package_sets}
590
- #
591
- # @return [void]
592
- def load_osrepos_from_package_sets
593
- ws.manifest.each_package_set do |pkg_set|
594
- pkg_set.each_osrepos_file do |file|
595
- file_osrepos = pkg_set.load_osrepos(file)
596
- ws.os_repository_resolver.merge(file_osrepos)
591
+ # Load OS repository information contained in our registered package
592
+ # sets into the provided osrepo object
593
+ #
594
+ # This is included in {load_package_sets}
595
+ #
596
+ # @return [void]
597
+ def load_osrepos_from_package_sets
598
+ ws.manifest.each_package_set do |pkg_set|
599
+ pkg_set.each_osrepos_file do |file|
600
+ file_osrepos = pkg_set.load_osrepos(file)
601
+ ws.os_repository_resolver.merge(file_osrepos)
602
+ end
597
603
  end
598
604
  end
599
- end
600
605
 
601
- def update_package_sets(only_local: false,
602
- checkout_only: !Autobuild.do_update,
603
- keep_going: false,
604
- reset: false,
605
- retry_count: nil)
606
- root_pkg_set = ws.manifest.main_package_set
607
- package_sets, failures = load_and_update_package_sets(
608
- root_pkg_set,
609
- only_local: only_local,
610
- checkout_only: checkout_only,
611
- keep_going: keep_going,
612
- reset: reset,
613
- retry_count: retry_count)
614
- root_pkg_set.imports.each do |pkg_set|
615
- pkg_set.explicit = true
616
- end
617
- package_sets = sort_package_sets_by_import_order(package_sets, root_pkg_set)
618
- ws.manifest.reset_package_sets
619
- package_sets.each do |pkg_set|
620
- ws.manifest.register_package_set(pkg_set)
606
+ def update_package_sets(only_local: false,
607
+ checkout_only: !Autobuild.do_update,
608
+ keep_going: false,
609
+ reset: false,
610
+ retry_count: nil)
611
+ root_pkg_set = ws.manifest.main_package_set
612
+ package_sets, failures = load_and_update_package_sets(
613
+ root_pkg_set,
614
+ only_local: only_local,
615
+ checkout_only: checkout_only,
616
+ keep_going: keep_going,
617
+ reset: reset,
618
+ retry_count: retry_count
619
+ )
620
+ root_pkg_set.imports.each do |pkg_set|
621
+ pkg_set.explicit = true
622
+ end
623
+ package_sets = sort_package_sets_by_import_order(package_sets, root_pkg_set)
624
+ ws.manifest.reset_package_sets
625
+ package_sets.each do |pkg_set|
626
+ ws.manifest.register_package_set(pkg_set)
627
+ end
628
+ failures
621
629
  end
622
- failures
623
630
  end
624
631
  end
625
- end
626
632
  end
627
-