autoproj 2.0.0.rc38 → 2.0.0.rc39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -7
- data/lib/autoproj/cli/build.rb +5 -7
- data/lib/autoproj/cli/main.rb +5 -0
- data/lib/autoproj/cli/manifest.rb +52 -0
- data/lib/autoproj/cli/patcher.rb +1 -1
- data/lib/autoproj/cli/query.rb +1 -1
- data/lib/autoproj/cli/update.rb +122 -61
- data/lib/autoproj/cli/versions.rb +1 -1
- data/lib/autoproj/exceptions.rb +20 -0
- data/lib/autoproj/find_workspace.rb +1 -2
- data/lib/autoproj/manifest.rb +3 -0
- data/lib/autoproj/ops/configuration.rb +262 -68
- data/lib/autoproj/ops/import.rb +38 -32
- data/lib/autoproj/ops/main_config_switcher.rb +1 -1
- data/lib/autoproj/ops/snapshot.rb +10 -21
- data/lib/autoproj/os_package_installer.rb +1 -0
- data/lib/autoproj/os_package_resolver.rb +35 -19
- data/lib/autoproj/system.rb +3 -0
- data/lib/autoproj/test.rb +17 -0
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +37 -131
- metadata +3 -2
data/lib/autoproj/ops/import.rb
CHANGED
@@ -149,15 +149,13 @@ def queue_import_work(executor, completion_queue, pkg, retry_count: nil, **impor
|
|
149
149
|
import_future.execute
|
150
150
|
end
|
151
151
|
|
152
|
-
class ImportFailed < RuntimeError; end
|
153
|
-
|
154
152
|
# Import all packages from the given selection, and their
|
155
153
|
# dependencies
|
156
|
-
def import_selected_packages(selection,
|
154
|
+
def import_selected_packages(selection,
|
157
155
|
parallel: ws.config.parallel_import_level,
|
158
156
|
recursive: true,
|
159
157
|
retry_count: nil,
|
160
|
-
|
158
|
+
keep_going: false,
|
161
159
|
install_vcs_packages: Hash.new,
|
162
160
|
non_imported_packages: :checkout,
|
163
161
|
**import_options)
|
@@ -189,10 +187,10 @@ def import_selected_packages(selection, updated_packages,
|
|
189
187
|
all_processed_packages = Set.new
|
190
188
|
main_thread_imports = Array.new
|
191
189
|
package_queue = selected_packages.to_a.sort_by(&:name)
|
192
|
-
failures =
|
190
|
+
failures = Array.new
|
193
191
|
missing_vcs = Array.new
|
194
192
|
installed_vcs_packages = Set['none', 'local']
|
195
|
-
while failures.empty? ||
|
193
|
+
while failures.empty? || keep_going
|
196
194
|
# Queue work for all packages in the queue
|
197
195
|
package_queue.each do |pkg|
|
198
196
|
# Remove packages that have already been processed
|
@@ -283,7 +281,7 @@ def import_selected_packages(selection, updated_packages,
|
|
283
281
|
if !reason.kind_of?(Interrupt)
|
284
282
|
Autoproj.error "#{reason}"
|
285
283
|
end
|
286
|
-
failures
|
284
|
+
failures << reason
|
287
285
|
end
|
288
286
|
else
|
289
287
|
if new_packages = post_package_import(selection, manifest, pkg.autobuild, reverse_dependencies)
|
@@ -299,29 +297,19 @@ def import_selected_packages(selection, updated_packages,
|
|
299
297
|
end
|
300
298
|
end
|
301
299
|
|
302
|
-
if !failures.empty?
|
303
|
-
raise ImportFailed, "import of #{failures.size} packages failed: #{failures.keys.map(&:name).sort.join(", ")}"
|
304
|
-
end
|
305
|
-
|
306
300
|
all_processed_packages.delete_if do |processed_pkg|
|
307
301
|
ws.manifest.excluded?(processed_pkg.name) || ws.manifest.ignored?(processed_pkg.name)
|
308
302
|
end
|
309
|
-
all_processed_packages
|
303
|
+
return all_processed_packages, failures
|
310
304
|
|
311
305
|
ensure
|
312
|
-
if failures && !failures.empty? && !
|
306
|
+
if failures && !failures.empty? && !keep_going
|
313
307
|
Autoproj.error "waiting for pending import jobs to finish"
|
314
308
|
end
|
315
309
|
if executor
|
316
310
|
executor.shutdown
|
317
311
|
executor.wait_for_termination
|
318
312
|
end
|
319
|
-
if all_processed_packages
|
320
|
-
all_updated_packages = all_processed_packages.find_all do |processed_pkg|
|
321
|
-
processed_pkg.autobuild.updated?
|
322
|
-
end
|
323
|
-
updated_packages.concat(all_updated_packages.map(&:name))
|
324
|
-
end
|
325
313
|
end
|
326
314
|
|
327
315
|
def finalize_package_load(processed_packages)
|
@@ -373,22 +361,24 @@ def import_packages(selection,
|
|
373
361
|
warn_about_ignored_packages: true,
|
374
362
|
warn_about_excluded_packages: true,
|
375
363
|
recursive: true,
|
376
|
-
|
364
|
+
keep_going: false,
|
377
365
|
install_vcs_packages: Hash.new,
|
378
366
|
**import_options)
|
379
367
|
|
380
|
-
# Used in the ensure block, initialize as soon as possible
|
381
|
-
updated_packages = Array.new
|
382
|
-
|
383
368
|
manifest = ws.manifest
|
384
369
|
|
385
|
-
all_processed_packages = import_selected_packages(
|
386
|
-
selection,
|
370
|
+
all_processed_packages, failures = import_selected_packages(
|
371
|
+
selection,
|
387
372
|
non_imported_packages: non_imported_packages,
|
388
|
-
|
373
|
+
keep_going: keep_going,
|
389
374
|
recursive: recursive,
|
390
375
|
install_vcs_packages: install_vcs_packages,
|
391
376
|
**import_options)
|
377
|
+
|
378
|
+
if !keep_going && !failures.empty?
|
379
|
+
raise failures.first
|
380
|
+
end
|
381
|
+
|
392
382
|
finalize_package_load(all_processed_packages)
|
393
383
|
|
394
384
|
all_enabled_osdeps = selection.each_osdep_package_name.to_set
|
@@ -414,18 +404,34 @@ def import_packages(selection,
|
|
414
404
|
end
|
415
405
|
end
|
416
406
|
|
417
|
-
|
407
|
+
if !failures.empty?
|
408
|
+
raise PackageImportFailed.new(
|
409
|
+
failures, source_packages: all_enabled_sources,
|
410
|
+
osdep_packages: all_enabled_osdeps)
|
411
|
+
else
|
412
|
+
return all_enabled_sources, all_enabled_osdeps
|
413
|
+
end
|
418
414
|
|
419
415
|
ensure
|
420
|
-
if ws.config.import_log_enabled? &&
|
416
|
+
if ws.config.import_log_enabled? && Autoproj::Ops::Snapshot.update_log_available?(manifest)
|
417
|
+
update_log_for_processed_packages(all_processed_packages || Array.new, $!)
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
def update_log_for_processed_packages(all_processed_packages, exception)
|
422
|
+
all_updated_packages = all_processed_packages.find_all do |processed_pkg|
|
423
|
+
processed_pkg.autobuild.updated?
|
424
|
+
end
|
425
|
+
|
426
|
+
if !all_updated_packages.empty?
|
421
427
|
failure_message =
|
422
|
-
if
|
423
|
-
" (#{
|
428
|
+
if exception
|
429
|
+
" (#{exception.message.split("\n").first})"
|
424
430
|
end
|
425
|
-
ops = Ops::Snapshot.new(ws.manifest,
|
431
|
+
ops = Ops::Snapshot.new(ws.manifest, keep_going: true)
|
426
432
|
ops.update_package_import_state(
|
427
433
|
"#{$0} #{ARGV.join(" ")}#{failure_message}",
|
428
|
-
|
434
|
+
all_updated_packages.map(&:name))
|
429
435
|
end
|
430
436
|
end
|
431
437
|
end
|
@@ -127,7 +127,7 @@ def switch_config(*args)
|
|
127
127
|
|
128
128
|
url = VCSDefinition.to_absolute_url(url, ws.root_dir)
|
129
129
|
|
130
|
-
if vcs
|
130
|
+
if vcs.type == type && vcs.url == url
|
131
131
|
vcs = vcs.to_hash
|
132
132
|
options.each do |opt|
|
133
133
|
opt_name, opt_value = opt.split('=')
|
@@ -43,12 +43,9 @@ def sort_versions(versions)
|
|
43
43
|
pkgs.sort_by { |vcs| vcs.keys.first }
|
44
44
|
end
|
45
45
|
|
46
|
-
def save_versions( versions, versions_file,
|
47
|
-
options = Kernel.validate_options options,
|
48
|
-
replace: false
|
49
|
-
|
46
|
+
def save_versions( versions, versions_file, replace: false)
|
50
47
|
existing_versions = Array.new
|
51
|
-
if !
|
48
|
+
if !replace && File.exist?(versions_file)
|
52
49
|
existing_versions = YAML.load( File.read( versions_file ) ) ||
|
53
50
|
Array.new
|
54
51
|
end
|
@@ -80,25 +77,20 @@ def self.snapshot( packages, target_dir )
|
|
80
77
|
#
|
81
78
|
# @return [Boolean]
|
82
79
|
# @see initialize error_or_warn
|
83
|
-
def
|
80
|
+
def keep_going?; !!@keep_going end
|
84
81
|
|
85
|
-
def initialize(manifest,
|
82
|
+
def initialize(manifest, keep_going: false)
|
86
83
|
@manifest = manifest
|
87
|
-
|
88
|
-
ignore_errors: false
|
89
|
-
@ignore_errors = options[:ignore_errors]
|
84
|
+
@keep_going = keep_going
|
90
85
|
end
|
91
86
|
|
92
|
-
def snapshot_package_sets(target_dir = nil,
|
93
|
-
options = Kernel.validate_options options,
|
94
|
-
only_local: true
|
95
|
-
|
87
|
+
def snapshot_package_sets(target_dir = nil, only_local: true)
|
96
88
|
result = Array.new
|
97
89
|
manifest.each_package_set do |pkg_set|
|
98
90
|
next if pkg_set.local?
|
99
91
|
|
100
92
|
vcs_info =
|
101
|
-
begin pkg_set.snapshot(target_dir, only_local:
|
93
|
+
begin pkg_set.snapshot(target_dir, only_local: only_local)
|
102
94
|
rescue Exception => e
|
103
95
|
error_or_warn(pkg_set, e)
|
104
96
|
next
|
@@ -116,7 +108,7 @@ def snapshot_package_sets(target_dir = nil, options = Hash.new)
|
|
116
108
|
def error_or_warn(package, error)
|
117
109
|
if error.kind_of?(Interrupt)
|
118
110
|
raise
|
119
|
-
elsif
|
111
|
+
elsif keep_going?
|
120
112
|
if !error.respond_to?(:to_str)
|
121
113
|
error = error.message
|
122
114
|
end
|
@@ -128,10 +120,7 @@ def error_or_warn(package, error)
|
|
128
120
|
end
|
129
121
|
end
|
130
122
|
|
131
|
-
def snapshot_packages(packages, target_dir = nil,
|
132
|
-
options = Kernel.validate_options options,
|
133
|
-
only_local: true
|
134
|
-
|
123
|
+
def snapshot_packages(packages, target_dir = nil, only_local: true)
|
135
124
|
result = Array.new
|
136
125
|
packages.each do |package_name|
|
137
126
|
package = manifest.find_package_definition(package_name)
|
@@ -148,7 +137,7 @@ def snapshot_packages(packages, target_dir = nil, options = Hash.new)
|
|
148
137
|
end
|
149
138
|
|
150
139
|
vcs_info =
|
151
|
-
begin importer.snapshot(package.autobuild, target_dir, only_local:
|
140
|
+
begin importer.snapshot(package.autobuild, target_dir, only_local: only_local)
|
152
141
|
rescue Exception => e
|
153
142
|
error_or_warn(package, e)
|
154
143
|
next
|
@@ -50,6 +50,7 @@ def initialize(ws, os_package_resolver, package_managers: PACKAGE_MANAGERS)
|
|
50
50
|
@installed_resolved_packages = Hash.new { |h, k| h[k] = Set.new }
|
51
51
|
@silent = true
|
52
52
|
@filter_uptodate_packages = true
|
53
|
+
@osdeps_mode = nil
|
53
54
|
|
54
55
|
@package_managers = Hash.new
|
55
56
|
package_managers.each do |name, klass|
|
@@ -134,7 +134,7 @@ def prefer_indep_over_os_packages=(flag); @prefer_indep_over_os_packages = flag
|
|
134
134
|
# Use to override the autodetected OS-specific package handler
|
135
135
|
def os_package_manager=(manager_name)
|
136
136
|
if manager_name && !package_managers.include?(manager_name)
|
137
|
-
raise ArgumentError, "#{manager_name} is not a known package manager"
|
137
|
+
raise ArgumentError, "#{manager_name} is not a known package manager, known managers are #{package_managers.to_a.sort.join(", ")}"
|
138
138
|
end
|
139
139
|
@os_package_manager = manager_name
|
140
140
|
end
|
@@ -214,8 +214,6 @@ def invalidate_resolve_package_cache
|
|
214
214
|
# defined in both OSPackageResolver objects, the information in +info+
|
215
215
|
# takes precedence
|
216
216
|
def merge(info)
|
217
|
-
invalidate_resolve_package_cache
|
218
|
-
|
219
217
|
@definitions = definitions.merge(info.definitions) do |h, v1, v2|
|
220
218
|
if v1 != v2
|
221
219
|
old = source_of(h)
|
@@ -224,11 +222,11 @@ def merge(info)
|
|
224
222
|
# Warn if the new osdep definition resolves to a different
|
225
223
|
# set of packages than the old one
|
226
224
|
old_resolved = resolve_package(h).inject(Hash.new) do |osdep_h, (handler, status, list)|
|
227
|
-
osdep_h[handler] = [status, list]
|
225
|
+
osdep_h[handler] = [status, list.dup]
|
228
226
|
osdep_h
|
229
227
|
end
|
230
228
|
new_resolved = info.resolve_package(h).inject(Hash.new) do |osdep_h, (handler, status, list)|
|
231
|
-
osdep_h[handler] = [status, list]
|
229
|
+
osdep_h[handler] = [status, list.dup]
|
232
230
|
osdep_h
|
233
231
|
end
|
234
232
|
if old_resolved != new_resolved
|
@@ -237,6 +235,8 @@ def merge(info)
|
|
237
235
|
end
|
238
236
|
v2
|
239
237
|
end
|
238
|
+
invalidate_resolve_package_cache
|
239
|
+
|
240
240
|
@sources = sources.merge(info.sources)
|
241
241
|
@all_definitions = all_definitions.merge(info.all_definitions) do |package_name, all_defs, new_all_defs|
|
242
242
|
all_defs = all_defs.dup
|
@@ -270,6 +270,12 @@ def self.verify_definitions(hash, path = [])
|
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
|
+
# Whether the operating system could be autodetected successfully
|
274
|
+
def known_operating_system?
|
275
|
+
os_names, _ = operating_system
|
276
|
+
!os_names.empty?
|
277
|
+
end
|
278
|
+
|
273
279
|
# Returns true if it is possible to install packages for the operating
|
274
280
|
# system on which we are installed
|
275
281
|
def supported_operating_system?
|
@@ -497,26 +503,27 @@ def resolve_package(name)
|
|
497
503
|
path = self.class.resolve_name(name)
|
498
504
|
name = path.last
|
499
505
|
|
500
|
-
os_names, os_versions = operating_system
|
501
|
-
os_names = os_names.dup
|
502
|
-
if prefer_indep_over_os_packages?
|
503
|
-
os_names.unshift 'default'
|
504
|
-
else
|
505
|
-
os_names.push 'default'
|
506
|
-
end
|
507
|
-
|
508
506
|
dep_def = definitions[name]
|
509
507
|
if !dep_def
|
510
508
|
return (resolve_package_cache[name] = nil)
|
511
509
|
end
|
512
510
|
|
511
|
+
os_names, os_versions = operating_system
|
512
|
+
|
513
513
|
# Partition the found definition in all entries that are interesting
|
514
514
|
# for us: toplevel os-independent package managers, os-dependent
|
515
515
|
# package managers and os-independent package managers selected by
|
516
516
|
# OS or version
|
517
|
-
if
|
517
|
+
if os_names.empty?
|
518
518
|
os_names = ['default']
|
519
519
|
os_versions = ['default']
|
520
|
+
else
|
521
|
+
os_names = os_names.dup
|
522
|
+
if prefer_indep_over_os_packages?
|
523
|
+
os_names.unshift 'default'
|
524
|
+
else
|
525
|
+
os_names.push 'default'
|
526
|
+
end
|
520
527
|
end
|
521
528
|
|
522
529
|
result = []
|
@@ -545,6 +552,10 @@ def resolve_package(name)
|
|
545
552
|
end
|
546
553
|
end
|
547
554
|
|
555
|
+
result.each do |args|
|
556
|
+
args.last.freeze
|
557
|
+
end
|
558
|
+
result.freeze
|
548
559
|
resolve_package_cache[name] = result
|
549
560
|
end
|
550
561
|
|
@@ -714,7 +725,11 @@ def resolve_os_packages(dependencies)
|
|
714
725
|
|
715
726
|
if result.empty?
|
716
727
|
os_names, os_versions = operating_system
|
717
|
-
|
728
|
+
if os_names.empty?
|
729
|
+
raise MissingOSDep.new, "there is an osdeps definition for #{name}, but autoproj cannot detect the local operation system"
|
730
|
+
else
|
731
|
+
raise MissingOSDep.new, "there is an osdeps definition for #{name}, but not for this operating system and version (resp. #{os_names.join(", ")} and #{os_versions.join(", ")})"
|
732
|
+
end
|
718
733
|
end
|
719
734
|
|
720
735
|
result.each do |handler, status, packages|
|
@@ -724,7 +739,7 @@ def resolve_os_packages(dependencies)
|
|
724
739
|
if entry = all_packages.find { |h, _| h == handler }
|
725
740
|
entry[1].concat(packages)
|
726
741
|
else
|
727
|
-
all_packages << [handler, packages]
|
742
|
+
all_packages << [handler, packages.dup]
|
728
743
|
end
|
729
744
|
end
|
730
745
|
end
|
@@ -784,13 +799,14 @@ def availability_of(name)
|
|
784
799
|
end
|
785
800
|
|
786
801
|
if resolved.empty?
|
787
|
-
if
|
802
|
+
if known_operating_system?
|
803
|
+
return WRONG_OS
|
804
|
+
else
|
788
805
|
return UNKNOWN_OS
|
789
|
-
else return WRONG_OS
|
790
806
|
end
|
791
807
|
end
|
792
808
|
|
793
|
-
resolved = resolved.
|
809
|
+
resolved = resolved.find_all { |_, status, list| status != FOUND_PACKAGES || !list.empty? }
|
794
810
|
failed = resolved.find_all do |_, status, _|
|
795
811
|
status == FOUND_NONEXISTENT
|
796
812
|
end
|
data/lib/autoproj/system.rb
CHANGED
data/lib/autoproj/test.rb
CHANGED
@@ -292,12 +292,29 @@ def ws_define_package_set(name, vcs = VCSDefinition.from_raw(type: 'none'), **op
|
|
292
292
|
package_set
|
293
293
|
end
|
294
294
|
|
295
|
+
def ws_create_local_package_set(name, path, source_data: Hash.new, **options)
|
296
|
+
vcs = VCSDefinition.from_raw(type: 'local', url: path)
|
297
|
+
package_set = PackageSet.new(ws, vcs, name: name, **options)
|
298
|
+
FileUtils.mkdir_p(path)
|
299
|
+
File.open(File.join(path, 'source.yml'), 'w') do |io|
|
300
|
+
YAML.dump(Hash['name' => name].merge(source_data), io)
|
301
|
+
end
|
302
|
+
ws.manifest.register_package_set(package_set)
|
303
|
+
package_set
|
304
|
+
end
|
305
|
+
|
295
306
|
def ws_add_package_set_to_layout(name, vcs = VCSDefinition.from_raw(type: 'none'), **options)
|
296
307
|
package_set = ws_define_package_set(name, vcs, **options)
|
297
308
|
ws.manifest.add_package_set_to_layout(package_set)
|
298
309
|
package_set
|
299
310
|
end
|
300
311
|
|
312
|
+
def ws_add_metapackage_to_layout(name, *packages)
|
313
|
+
meta = ws.manifest.metapackage(name, *packages)
|
314
|
+
ws.manifest.add_metapackage_to_layout(meta)
|
315
|
+
meta
|
316
|
+
end
|
317
|
+
|
301
318
|
def ws_define_osdep_entries(entries)
|
302
319
|
ws_os_package_resolver.add_entries(entries)
|
303
320
|
end
|
data/lib/autoproj/version.rb
CHANGED
data/lib/autoproj/workspace.rb
CHANGED
@@ -138,17 +138,9 @@ def config_file_path
|
|
138
138
|
File.join(dot_autoproj_dir, 'config.yml')
|
139
139
|
end
|
140
140
|
|
141
|
-
# The path to a workspace's manifest file given its root dir
|
142
|
-
#
|
143
|
-
# @param [String] root_dir the workspace root directory
|
144
|
-
# @return [String]
|
145
|
-
def self.manifest_file_path_for(root_dir)
|
146
|
-
File.join(root_dir, 'autoproj', 'manifest')
|
147
|
-
end
|
148
|
-
|
149
141
|
# The path to the workspace's manifest file
|
150
142
|
def manifest_file_path
|
151
|
-
|
143
|
+
File.join(root_dir, 'autoproj', config.get('manifest_name', 'manifest'))
|
152
144
|
end
|
153
145
|
|
154
146
|
# Return the directory in which remote package set definition should be
|
@@ -210,12 +202,6 @@ def save_config
|
|
210
202
|
config.save(config_file_path)
|
211
203
|
end
|
212
204
|
|
213
|
-
def load_manifest
|
214
|
-
if File.exist?(manifest_file_path)
|
215
|
-
manifest.load(manifest_file_path)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
205
|
def autodetect_operating_system(force: false)
|
220
206
|
if force || !os_package_resolver.operating_system
|
221
207
|
begin
|
@@ -262,7 +248,9 @@ def setup
|
|
262
248
|
config.each_reused_autoproj_installation do |p|
|
263
249
|
manifest.reuse(p)
|
264
250
|
end
|
265
|
-
|
251
|
+
if File.exist?(manifest_file_path)
|
252
|
+
manifest.load(manifest_file_path)
|
253
|
+
end
|
266
254
|
|
267
255
|
Autobuild.prefix = prefix_dir
|
268
256
|
FileUtils.mkdir_p File.join(prefix_dir, '.autoproj')
|
@@ -386,6 +374,20 @@ def set_as_main_workspace
|
|
386
374
|
Autoproj.workspace = self
|
387
375
|
Autoproj.root_dir = root_dir
|
388
376
|
Autobuild.env = env
|
377
|
+
|
378
|
+
if block_given?
|
379
|
+
begin
|
380
|
+
yield
|
381
|
+
ensure
|
382
|
+
clear_main_workspace
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
def clear_main_workspace
|
388
|
+
Autoproj.workspace = nil
|
389
|
+
Autoproj.root_dir = nil
|
390
|
+
Autobuild.env = nil
|
389
391
|
end
|
390
392
|
|
391
393
|
# Loads autoproj/init.rb
|
@@ -418,127 +420,29 @@ def load_autoprojrc
|
|
418
420
|
end
|
419
421
|
end
|
420
422
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
manifest.each_package_set do |pkg_set|
|
429
|
-
pkg_set.each_osdeps_file do |file|
|
430
|
-
file_osdeps = pkg_set.load_osdeps(file, operating_system: os_package_resolver.operating_system)
|
431
|
-
os_package_resolver.merge(file_osdeps)
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
|
436
|
-
def load_package_sets(options = Hash.new)
|
423
|
+
def load_package_sets(only_local: false,
|
424
|
+
checkout_only: true,
|
425
|
+
reconfigure: false,
|
426
|
+
keep_going: false,
|
427
|
+
mainline: nil,
|
428
|
+
reset: false,
|
429
|
+
retry_count: nil)
|
437
430
|
if !File.file?(manifest_file_path) # empty install, just return
|
438
431
|
return
|
439
432
|
end
|
440
433
|
|
441
|
-
|
442
|
-
only_local: false,
|
443
|
-
checkout_only: true,
|
444
|
-
silent: false, # NOTE: this is ignored, enclose call with Autoproj.silent { }
|
445
|
-
reconfigure: false,
|
446
|
-
ignore_errors: false,
|
447
|
-
mainline: nil,
|
448
|
-
reset: false,
|
449
|
-
retry_count: nil
|
450
|
-
|
451
|
-
Ops::Configuration.new(self).
|
452
|
-
load_package_sets(only_local: options[:only_local],
|
453
|
-
checkout_only: options[:checkout_only],
|
454
|
-
ignore_errors: options[:ignore_errors],
|
455
|
-
reset: options[:reset],
|
456
|
-
retry_count: options[:retry_count])
|
457
|
-
|
458
|
-
manifest.each_package_set do |pkg_set|
|
459
|
-
if Gem::Version.new(pkg_set.required_autoproj_version) > Gem::Version.new(Autoproj::VERSION)
|
460
|
-
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}"
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
# Loads OS package definitions once and for all
|
465
|
-
load_osdeps_from_package_sets
|
466
|
-
|
467
|
-
# Load the required autobuild definitions
|
468
|
-
Autoproj.message("autoproj: loading ...", :bold)
|
469
|
-
if !options[:reconfigure]
|
434
|
+
if !reconfigure
|
470
435
|
Autoproj.message("run 'autoproj reconfigure' to change configuration options", :bold)
|
471
436
|
Autoproj.message("and use 'autoproj switch-config' to change the remote source for", :bold)
|
472
437
|
Autoproj.message("autoproj's main build configuration", :bold)
|
473
438
|
end
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
# source.yml files)
|
482
|
-
mainline = options[:mainline]
|
483
|
-
if mainline.respond_to?(:to_str)
|
484
|
-
mainline = manifest.package_set(mainline)
|
485
|
-
end
|
486
|
-
manifest.load_importers(mainline: mainline)
|
487
|
-
|
488
|
-
# Auto-add packages that are
|
489
|
-
# * present on disk
|
490
|
-
# * listed in the layout part of the manifest
|
491
|
-
# * but have no definition
|
492
|
-
explicit = manifest.normalized_layout
|
493
|
-
explicit.each do |pkg_or_set, layout_level|
|
494
|
-
next if manifest.find_autobuild_package(pkg_or_set)
|
495
|
-
next if manifest.has_package_set?(pkg_or_set)
|
496
|
-
|
497
|
-
# This is not known. Check if we can auto-add it
|
498
|
-
full_path = File.expand_path(File.join(root_dir, layout_level, pkg_or_set))
|
499
|
-
next if !File.directory?(full_path)
|
500
|
-
|
501
|
-
handler, _srcdir = Autoproj.package_handler_for(full_path)
|
502
|
-
if handler
|
503
|
-
Autoproj.message " auto-adding #{pkg_or_set} #{"in #{layout_level} " if layout_level != "/"}using the #{handler.gsub(/_package/, '')} package handler"
|
504
|
-
in_package_set(manifest.main_package_set, manifest.file) do
|
505
|
-
send(handler, pkg_or_set)
|
506
|
-
end
|
507
|
-
else
|
508
|
-
Autoproj.warn "cannot auto-add #{pkg_or_set}: unknown package type"
|
509
|
-
end
|
510
|
-
end
|
511
|
-
|
512
|
-
manifest.each_autobuild_package do |pkg|
|
513
|
-
Autobuild.each_utility do |uname, _|
|
514
|
-
pkg.utility(uname).enabled =
|
515
|
-
config.utility_enabled_for?(uname, pkg.name)
|
516
|
-
end
|
517
|
-
end
|
518
|
-
|
519
|
-
# And exclude any package that is not available on this particular
|
520
|
-
# configuration
|
521
|
-
mark_unavailable_osdeps_as_excluded
|
522
|
-
end
|
523
|
-
|
524
|
-
def mark_unavailable_osdeps_as_excluded
|
525
|
-
os_package_resolver.all_package_names.each do |osdep_name|
|
526
|
-
# If the osdep can be replaced by source packages, there's
|
527
|
-
# nothing to do really. The exclusions of the source packages
|
528
|
-
# will work as expected
|
529
|
-
if manifest.osdeps_overrides[osdep_name] || manifest.find_autobuild_package(osdep_name)
|
530
|
-
next
|
531
|
-
end
|
532
|
-
|
533
|
-
case os_package_resolver.availability_of(osdep_name)
|
534
|
-
when OSPackageResolver::UNKNOWN_OS
|
535
|
-
manifest.exclude_package(osdep_name, "this operating system is unknown to autoproj")
|
536
|
-
when OSPackageResolver::WRONG_OS
|
537
|
-
manifest.exclude_package(osdep_name, "there are definitions for it, but not for this operating system")
|
538
|
-
when OSPackageResolver::NONEXISTENT
|
539
|
-
manifest.exclude_package(osdep_name, "it is marked as unavailable for this operating system")
|
540
|
-
end
|
541
|
-
end
|
439
|
+
Ops::Configuration.new(self).
|
440
|
+
load_package_sets(only_local: only_local,
|
441
|
+
checkout_only: checkout_only,
|
442
|
+
keep_going: keep_going,
|
443
|
+
reset: reset,
|
444
|
+
retry_count: retry_count,
|
445
|
+
mainline: mainline)
|
542
446
|
end
|
543
447
|
|
544
448
|
def load_packages(selection = manifest.default_packages(false), options = Hash.new)
|
@@ -705,7 +609,7 @@ def all_os_packages(import_missing: false, parallel: config.parallel_import_leve
|
|
705
609
|
_, all_os_packages =
|
706
610
|
ops.import_packages(manifest.default_packages,
|
707
611
|
checkout_only: true, only_local: true, reset: false,
|
708
|
-
recursive: true,
|
612
|
+
recursive: true, keep_going: true, parallel: parallel,
|
709
613
|
retry_count: 0)
|
710
614
|
all_os_packages
|
711
615
|
else
|
@@ -761,7 +665,9 @@ def self.workspace
|
|
761
665
|
|
762
666
|
def self.workspace=(ws)
|
763
667
|
@workspace = ws
|
764
|
-
|
668
|
+
if ws
|
669
|
+
self.root_dir = ws.root_dir
|
670
|
+
end
|
765
671
|
end
|
766
672
|
|
767
673
|
def self.env
|