autoproj 2.12.1 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +79 -91
- data/.rubocop_todo.yml +1473 -0
- data/Gemfile +9 -9
- data/Rakefile +24 -24
- data/autoproj.gemspec +24 -22
- data/bin/alocate +4 -4
- data/bin/alog +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +225 -200
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +224 -199
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +9 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +66 -36
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- data/lib/autoproj/autobuild_extensions/python.rb +18 -0
- data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
- data/lib/autoproj/base.rb +1 -1
- data/lib/autoproj/bash_completion.rb +5 -6
- data/lib/autoproj/build_option.rb +22 -24
- data/lib/autoproj/cli/base.rb +26 -26
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +10 -7
- data/lib/autoproj/cli/cache.rb +11 -11
- data/lib/autoproj/cli/clean.rb +10 -10
- data/lib/autoproj/cli/commit.rb +7 -8
- data/lib/autoproj/cli/doc.rb +2 -2
- data/lib/autoproj/cli/envsh.rb +1 -2
- data/lib/autoproj/cli/exec.rb +60 -20
- data/lib/autoproj/cli/inspection_tool.rb +13 -7
- data/lib/autoproj/cli/locate.rb +30 -41
- data/lib/autoproj/cli/log.rb +7 -7
- data/lib/autoproj/cli/main.rb +217 -205
- data/lib/autoproj/cli/main_doc.rb +22 -21
- data/lib/autoproj/cli/main_global.rb +44 -19
- data/lib/autoproj/cli/main_plugin.rb +18 -18
- data/lib/autoproj/cli/main_test.rb +28 -27
- data/lib/autoproj/cli/manifest.rb +7 -7
- data/lib/autoproj/cli/osdeps.rb +12 -11
- data/lib/autoproj/cli/patcher.rb +2 -3
- data/lib/autoproj/cli/query.rb +17 -18
- data/lib/autoproj/cli/reconfigure.rb +1 -2
- data/lib/autoproj/cli/reset.rb +9 -12
- data/lib/autoproj/cli/show.rb +38 -39
- data/lib/autoproj/cli/status.rb +56 -44
- data/lib/autoproj/cli/switch_config.rb +5 -6
- data/lib/autoproj/cli/tag.rb +12 -11
- data/lib/autoproj/cli/test.rb +7 -7
- data/lib/autoproj/cli/update.rb +97 -43
- data/lib/autoproj/cli/utility.rb +14 -12
- data/lib/autoproj/cli/version.rb +42 -40
- data/lib/autoproj/cli/versions.rb +14 -15
- data/lib/autoproj/cli/watch.rb +33 -37
- data/lib/autoproj/cli/which.rb +16 -20
- data/lib/autoproj/cli.rb +4 -2
- data/lib/autoproj/configuration.rb +78 -86
- data/lib/autoproj/default.osdeps +29 -3
- data/lib/autoproj/environment.rb +42 -23
- data/lib/autoproj/exceptions.rb +9 -3
- data/lib/autoproj/find_workspace.rb +20 -25
- data/lib/autoproj/git_server_configuration.rb +40 -44
- data/lib/autoproj/gitorious.rb +1 -1
- data/lib/autoproj/installation_manifest.rb +64 -29
- data/lib/autoproj/local_package_set.rb +13 -11
- data/lib/autoproj/manifest.rb +139 -132
- data/lib/autoproj/metapackage.rb +2 -6
- data/lib/autoproj/ops/atomic_write.rb +7 -6
- data/lib/autoproj/ops/build.rb +4 -6
- data/lib/autoproj/ops/cache.rb +41 -43
- data/lib/autoproj/ops/cached_env.rb +5 -4
- data/lib/autoproj/ops/configuration.rb +519 -507
- data/lib/autoproj/ops/import.rb +88 -63
- data/lib/autoproj/ops/install.rb +218 -192
- data/lib/autoproj/ops/loader.rb +77 -76
- data/lib/autoproj/ops/main_config_switcher.rb +36 -45
- data/lib/autoproj/ops/phase_reporting.rb +4 -4
- data/lib/autoproj/ops/snapshot.rb +250 -247
- data/lib/autoproj/ops/tools.rb +76 -78
- data/lib/autoproj/ops/watch.rb +6 -6
- data/lib/autoproj/ops/which.rb +17 -14
- data/lib/autoproj/options.rb +13 -2
- data/lib/autoproj/os_package_installer.rb +102 -92
- data/lib/autoproj/os_package_query.rb +7 -13
- data/lib/autoproj/os_package_resolver.rb +189 -140
- data/lib/autoproj/os_repository_installer.rb +4 -4
- data/lib/autoproj/os_repository_resolver.rb +8 -6
- data/lib/autoproj/package_definition.rb +12 -13
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
- data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
- data/lib/autoproj/package_managers/debian_version.rb +25 -21
- data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
- data/lib/autoproj/package_managers/gem_manager.rb +68 -77
- data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
- data/lib/autoproj/package_managers/manager.rb +8 -3
- data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
- data/lib/autoproj/package_managers/pip_manager.rb +30 -28
- data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
- data/lib/autoproj/package_managers/port_manager.rb +2 -3
- data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
- data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
- data/lib/autoproj/package_managers/yum_manager.rb +12 -15
- data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
- data/lib/autoproj/package_manifest.rb +28 -74
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +145 -114
- data/lib/autoproj/python.rb +297 -0
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +102 -68
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- data/lib/autoproj/ros_condition_parser.rb +84 -0
- data/lib/autoproj/ros_package_manifest.rb +125 -0
- data/lib/autoproj/shell_completion.rb +16 -13
- data/lib/autoproj/source_package_query.rb +29 -36
- data/lib/autoproj/system.rb +32 -21
- data/lib/autoproj/test.rb +131 -106
- data/lib/autoproj/variable_expansion.rb +10 -10
- data/lib/autoproj/vcs_definition.rb +53 -37
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +143 -108
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +55 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +86 -65
- data/.travis.yml +0 -22
data/lib/autoproj/manifest.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "yaml"
|
2
|
+
require "csv"
|
3
|
+
require "utilrb/kernel/options"
|
4
|
+
require "set"
|
5
5
|
|
6
|
-
|
6
|
+
if RbConfig::CONFIG["host_os"] =~ %r{(msdos|mswin|djgpp|mingw|[Ww]indows)}
|
7
|
+
require "win32/dir"
|
8
|
+
end
|
7
9
|
|
8
10
|
module Autoproj
|
9
11
|
# The Manifest class represents the information included in the main
|
@@ -60,6 +62,11 @@ module Autoproj
|
|
60
62
|
YAML.safe_load(File.read(file)) || {}
|
61
63
|
end
|
62
64
|
|
65
|
+
if data["layout"]&.member?(nil)
|
66
|
+
Autoproj.warn "There is an empty entry in your layout in #{file}. All empty entries are ignored."
|
67
|
+
data["layout"] = data["layout"].compact
|
68
|
+
end
|
69
|
+
|
63
70
|
@file = file
|
64
71
|
initialize_from_hash(data)
|
65
72
|
end
|
@@ -69,22 +76,23 @@ module Autoproj
|
|
69
76
|
# Initialize the manifest from a hash, as loaded from a manifest file
|
70
77
|
def initialize_from_hash(data)
|
71
78
|
@data = data
|
72
|
-
@ignored_packages |= (data[
|
73
|
-
@ignored_packages |= (data[
|
79
|
+
@ignored_packages |= (data["ignored_packages"] || Set.new).to_set
|
80
|
+
@ignored_packages |= (data["ignore_packages"] || Set.new).to_set
|
74
81
|
invalidate_ignored_package_names
|
75
|
-
@manifest_exclusions |= (data[
|
82
|
+
@manifest_exclusions |= (data["exclude_packages"] || Set.new).to_set
|
76
83
|
|
77
84
|
normalized_layout = Hash.new
|
78
85
|
compute_normalized_layout(
|
79
86
|
normalized_layout,
|
80
|
-
|
81
|
-
data[
|
87
|
+
"/",
|
88
|
+
data["layout"] || Hash.new
|
89
|
+
)
|
82
90
|
@normalized_layout = normalized_layout
|
83
|
-
@has_layout = !!data[
|
91
|
+
@has_layout = !!data["layout"]
|
84
92
|
|
85
|
-
if data[
|
93
|
+
if data["constants"]
|
86
94
|
@constant_definitions =
|
87
|
-
Autoproj.resolve_constant_definitions(data[
|
95
|
+
Autoproj.resolve_constant_definitions(data["constants"])
|
88
96
|
end
|
89
97
|
end
|
90
98
|
|
@@ -110,7 +118,7 @@ module Autoproj
|
|
110
118
|
def add_package_to_layout(package)
|
111
119
|
package_name = validate_package_name_argument(package)
|
112
120
|
@has_layout = true
|
113
|
-
normalized_layout[package_name] =
|
121
|
+
normalized_layout[package_name] = "/"
|
114
122
|
end
|
115
123
|
|
116
124
|
# Add a package into the layout
|
@@ -123,7 +131,7 @@ module Autoproj
|
|
123
131
|
def add_metapackage_to_layout(metapackage)
|
124
132
|
validate_metapackage_in_self(metapackage)
|
125
133
|
@has_layout = true
|
126
|
-
normalized_layout[metapackage.name] =
|
134
|
+
normalized_layout[metapackage.name] = "/"
|
127
135
|
end
|
128
136
|
|
129
137
|
# Add a constant definition, used when resolving $CONSTANT in loaded
|
@@ -152,10 +160,12 @@ module Autoproj
|
|
152
160
|
# is not available on the current operating system, or simply return it
|
153
161
|
#
|
154
162
|
# @return [Boolean]
|
155
|
-
def accept_unavailable_osdeps
|
163
|
+
def accept_unavailable_osdeps?
|
164
|
+
!!@accept_unavailable_osdeps
|
165
|
+
end
|
156
166
|
|
157
167
|
# Sets {#accept_unavailable_osdeps?}
|
158
|
-
|
168
|
+
attr_writer :accept_unavailable_osdeps
|
159
169
|
|
160
170
|
attr_reader :constant_definitions
|
161
171
|
|
@@ -235,6 +245,7 @@ module Autoproj
|
|
235
245
|
if require_existing && !has_package?(package)
|
236
246
|
raise PackageNotFound, "no package named #{package} in #{self}"
|
237
247
|
end
|
248
|
+
|
238
249
|
package
|
239
250
|
end
|
240
251
|
end
|
@@ -270,9 +281,7 @@ module Autoproj
|
|
270
281
|
#
|
271
282
|
# Do not use directly, use {#ignored?} instead
|
272
283
|
def cache_ignored_package_names
|
273
|
-
if @ignored_package_names
|
274
|
-
return @ignored_package_names
|
275
|
-
end
|
284
|
+
return @ignored_package_names if @ignored_package_names
|
276
285
|
|
277
286
|
@ignored_package_names = each_package_definition.find_all do |pkg|
|
278
287
|
ignored_packages.any? do |l|
|
@@ -293,7 +302,8 @@ module Autoproj
|
|
293
302
|
#
|
294
303
|
# @yieldparam [Autobuild::Package]
|
295
304
|
def each_ignored_package
|
296
|
-
return enum_for(__method__)
|
305
|
+
return enum_for(__method__) unless block_given?
|
306
|
+
|
297
307
|
cache_ignored_package_names.each do |pkg_name|
|
298
308
|
yield(find_autobuild_package(pkg_name))
|
299
309
|
end
|
@@ -315,7 +325,7 @@ module Autoproj
|
|
315
325
|
|
316
326
|
if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)
|
317
327
|
true
|
318
|
-
elsif automatic_exclusions.any? { |pkg_name
|
328
|
+
elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }
|
319
329
|
true
|
320
330
|
else
|
321
331
|
false
|
@@ -324,7 +334,8 @@ module Autoproj
|
|
324
334
|
|
325
335
|
# Enumerates the package names of all ignored packages
|
326
336
|
def each_excluded_package
|
327
|
-
return enum_for(__method__)
|
337
|
+
return enum_for(__method__) unless block_given?
|
338
|
+
|
328
339
|
each_autobuild_package do |pkg|
|
329
340
|
yield(pkg) if excluded?(pkg.name)
|
330
341
|
end
|
@@ -353,10 +364,14 @@ module Autoproj
|
|
353
364
|
# Exclude +package_name+ from the build. +reason+ is a string describing
|
354
365
|
# why the package is to be excluded.
|
355
366
|
def exclude_package(package_name, reason)
|
356
|
-
package = validate_package_name_argument(
|
357
|
-
|
367
|
+
package = validate_package_name_argument(
|
368
|
+
package_name, require_existing: false
|
369
|
+
)
|
370
|
+
if (meta = find_metapackage(package))
|
358
371
|
meta.each_package do |pkg|
|
359
|
-
automatic_exclusions[pkg.name] =
|
372
|
+
automatic_exclusions[pkg.name] =
|
373
|
+
"#{meta.name} is an excluded metapackage, "\
|
374
|
+
"and it includes #{pkg.name}: #{reason}"
|
360
375
|
end
|
361
376
|
else
|
362
377
|
automatic_exclusions[package] = reason
|
@@ -383,11 +398,11 @@ module Autoproj
|
|
383
398
|
# disabled on this particular operating system.
|
384
399
|
def exclusion_reason(package_name)
|
385
400
|
package_name = validate_package_name_argument(package_name)
|
386
|
-
if message = automatic_exclusions[package_name]
|
401
|
+
if (message = automatic_exclusions[package_name])
|
387
402
|
return message
|
388
403
|
end
|
389
404
|
|
390
|
-
|
405
|
+
unless explicitely_selected_in_layout?(package_name)
|
391
406
|
manifest_exclusions.each do |matcher|
|
392
407
|
if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)
|
393
408
|
return "#{pkg_set.name} is a metapackage listed in the exclude_packages section of the manifest, and it includes #{package_name}"
|
@@ -416,12 +431,10 @@ module Autoproj
|
|
416
431
|
|
417
432
|
# Like #each_package_set, but filters out local package sets
|
418
433
|
def each_remote_package_set
|
419
|
-
return enum_for(__method__)
|
434
|
+
return enum_for(__method__) unless block_given?
|
420
435
|
|
421
436
|
each_package_set do |pkg_set|
|
422
|
-
|
423
|
-
yield(pkg_set)
|
424
|
-
end
|
437
|
+
yield(pkg_set) unless pkg_set.local?
|
425
438
|
end
|
426
439
|
end
|
427
440
|
|
@@ -461,9 +474,7 @@ module Autoproj
|
|
461
474
|
def register_package(package, block = nil, package_set = main_package_set, file = nil)
|
462
475
|
invalidate_ignored_package_names
|
463
476
|
pkg = PackageDefinition.new(package, package_set, file)
|
464
|
-
if block
|
465
|
-
pkg.add_setup_block(block)
|
466
|
-
end
|
477
|
+
pkg.add_setup_block(block) if block
|
467
478
|
@packages[package.name] = pkg
|
468
479
|
metapackage pkg.package_set.name, pkg.autobuild
|
469
480
|
metapackage "#{pkg.package_set.name}.all", pkg.autobuild
|
@@ -502,11 +513,11 @@ module Autoproj
|
|
502
513
|
#
|
503
514
|
# Unlike {#find_package_definition}, raise if the package does not exist
|
504
515
|
def package_definition_by_name(name)
|
505
|
-
|
506
|
-
pkg
|
507
|
-
else
|
516
|
+
unless (pkg = find_package_definition(name))
|
508
517
|
raise ArgumentError, "no package defined named '#{name}'"
|
509
518
|
end
|
519
|
+
|
520
|
+
pkg
|
510
521
|
end
|
511
522
|
|
512
523
|
# The autobuild description of a package by its name
|
@@ -514,16 +525,15 @@ module Autoproj
|
|
514
525
|
# @param [String,#name] name the package name
|
515
526
|
# @return [Autobuild::Package,nil]
|
516
527
|
def find_autobuild_package(name)
|
517
|
-
|
518
|
-
pkg.autobuild
|
519
|
-
end
|
528
|
+
find_package_definition(name)&.autobuild
|
520
529
|
end
|
521
530
|
|
522
531
|
# Lists all defined packages
|
523
532
|
#
|
524
533
|
# @yieldparam [PackageDefinition] pkg
|
525
534
|
def each_package_definition(&block)
|
526
|
-
return enum_for(__method__)
|
535
|
+
return enum_for(__method__) unless block_given?
|
536
|
+
|
527
537
|
packages.each_value(&block)
|
528
538
|
end
|
529
539
|
|
@@ -531,7 +541,8 @@ module Autoproj
|
|
531
541
|
#
|
532
542
|
# @yieldparam [Autobuild::Package] pkg
|
533
543
|
def each_autobuild_package
|
534
|
-
return enum_for(__method__)
|
544
|
+
return enum_for(__method__) unless block_given?
|
545
|
+
|
535
546
|
each_package_definition { |pkg| yield(pkg.autobuild) }
|
536
547
|
end
|
537
548
|
|
@@ -549,28 +560,24 @@ module Autoproj
|
|
549
560
|
end
|
550
561
|
package_name = validate_package_name_argument(package, require_existing: require_existing)
|
551
562
|
package_set = _package_set || package_set || package.package_set
|
552
|
-
mainline = if mainline == true
|
553
|
-
package_set
|
554
|
-
else mainline
|
555
|
-
end
|
563
|
+
mainline = package_set if mainline == true
|
556
564
|
|
557
565
|
# package_name is already validated, do not re-validate
|
558
566
|
vcs = package_set.importer_definition_for(package_name, require_existing: false)
|
559
567
|
|
560
568
|
package_sets = each_package_set.to_a.dup
|
561
569
|
index = package_sets.find_index(package_set)
|
562
|
-
|
570
|
+
unless index
|
563
571
|
raise RuntimeError, "found inconsistency: package #{package_name} is not in a package set of #{self}"
|
564
572
|
end
|
565
573
|
|
566
|
-
if package_sets[0, index + 1].include?(mainline)
|
567
|
-
return vcs
|
568
|
-
end
|
574
|
+
return vcs if package_sets[0, index + 1].include?(mainline)
|
569
575
|
|
570
576
|
# Then apply the overrides
|
571
577
|
package_sets[(index + 1)..-1].inject(vcs) do |updated_vcs, pkg_set|
|
572
578
|
updated_vcs = pkg_set.overrides_for(package_name, updated_vcs, require_existing: false)
|
573
579
|
return updated_vcs if pkg_set == mainline
|
580
|
+
|
574
581
|
updated_vcs
|
575
582
|
end
|
576
583
|
end
|
@@ -596,7 +603,8 @@ module Autoproj
|
|
596
603
|
package_mainline =
|
597
604
|
if mainline == true
|
598
605
|
pkg.package_set
|
599
|
-
else
|
606
|
+
else
|
607
|
+
mainline
|
600
608
|
end
|
601
609
|
vcs = importer_definition_for(pkg, mainline: package_mainline)
|
602
610
|
|
@@ -636,11 +644,11 @@ module Autoproj
|
|
636
644
|
# @return [PackageSet] the package set
|
637
645
|
# @raise [ArgumentError] if none exists with that name
|
638
646
|
def package_set(name)
|
639
|
-
|
640
|
-
set
|
641
|
-
else
|
647
|
+
unless (set = find_package_set(name))
|
642
648
|
raise ArgumentError, "no package set called #{name} exists"
|
643
649
|
end
|
650
|
+
|
651
|
+
set
|
644
652
|
end
|
645
653
|
|
646
654
|
# The root package set, which represents the workspace itself
|
@@ -665,25 +673,24 @@ module Autoproj
|
|
665
673
|
# fallback defined with {#add_osdeps_overrides}. If true, it will
|
666
674
|
# return such a package as an osdep.
|
667
675
|
def resolve_package_name(name, include_unavailable: false)
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
676
|
+
pkg_names =
|
677
|
+
if (pkg_set = find_metapackage(name))
|
678
|
+
pkg_set.each_package.map(&:name)
|
679
|
+
else
|
680
|
+
[name.to_str]
|
681
|
+
end
|
673
682
|
|
674
683
|
result = []
|
675
684
|
pkg_names.each do |pkg|
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
else
|
682
|
-
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
683
|
-
end
|
684
|
-
rescue PackageNotFound => e
|
685
|
+
result.concat(resolve_single_package_name(pkg))
|
686
|
+
rescue PackageUnavailable => e
|
687
|
+
if include_unavailable
|
688
|
+
result.concat([[:osdeps, pkg]])
|
689
|
+
else
|
685
690
|
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
686
691
|
end
|
692
|
+
rescue PackageNotFound => e
|
693
|
+
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
687
694
|
end
|
688
695
|
result
|
689
696
|
end
|
@@ -720,11 +727,12 @@ module Autoproj
|
|
720
727
|
# @raise PackageNotFound if the given package name cannot be resolved
|
721
728
|
# into a package
|
722
729
|
def resolve_package_name_as_source_package(name)
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
raise PackageNotFound, "cannot resolve #{name}: it is neither a package nor an osdep"
|
730
|
+
unless (pkg = find_autobuild_package(name))
|
731
|
+
raise PackageNotFound,
|
732
|
+
"cannot resolve #{name}: it is neither a package nor an osdep"
|
727
733
|
end
|
734
|
+
|
735
|
+
[[:package, pkg.name]]
|
728
736
|
end
|
729
737
|
|
730
738
|
# @api private
|
@@ -743,7 +751,7 @@ module Autoproj
|
|
743
751
|
# fallback defined with {#add_osdeps_overrides}.
|
744
752
|
# If true, it will return it as an osdep.
|
745
753
|
def resolve_package_name_as_osdep(name)
|
746
|
-
|
754
|
+
osdeps_availability = os_package_resolver.availability_of(name)
|
747
755
|
if osdeps_availability == OSPackageResolver::NO_PACKAGE
|
748
756
|
raise PackageNotFound, "#{name} is not an osdep"
|
749
757
|
end
|
@@ -755,13 +763,13 @@ module Autoproj
|
|
755
763
|
(osdeps_availability == OSPackageResolver::IGNORE)
|
756
764
|
osdeps_overrides = self.osdeps_overrides[name]
|
757
765
|
if osdeps_overrides && (!osdeps_available || osdeps_overrides[:force])
|
758
|
-
|
766
|
+
osdeps_overrides[:packages].inject([]) do |result, src_pkg_name|
|
759
767
|
result.concat(resolve_package_name_as_source_package(src_pkg_name))
|
760
768
|
end.uniq
|
761
769
|
elsif !osdeps_available && (pkg = find_autobuild_package(name))
|
762
|
-
|
770
|
+
[[:package, pkg.name]]
|
763
771
|
elsif osdeps_available || accept_unavailable_osdeps?
|
764
|
-
|
772
|
+
[[:osdeps, name]]
|
765
773
|
elsif osdeps_availability == OSPackageResolver::WRONG_OS
|
766
774
|
raise PackageUnavailable, "#{name} is an osdep, but it is not available for this operating system (#{os_package_resolver.operating_system})"
|
767
775
|
elsif osdeps_availability == OSPackageResolver::UNKNOWN_OS
|
@@ -797,9 +805,9 @@ module Autoproj
|
|
797
805
|
packages.each do |arg|
|
798
806
|
if !arg.respond_to?(:to_str)
|
799
807
|
meta.add(arg)
|
800
|
-
elsif pkg = find_autobuild_package(arg)
|
808
|
+
elsif (pkg = find_autobuild_package(arg))
|
801
809
|
meta.add(pkg)
|
802
|
-
elsif pkg_set = find_metapackage(arg)
|
810
|
+
elsif (pkg_set = find_metapackage(arg))
|
803
811
|
pkg_set.each_package do |pkg_in_set|
|
804
812
|
meta.add(pkg_in_set)
|
805
813
|
end
|
@@ -810,9 +818,7 @@ module Autoproj
|
|
810
818
|
end
|
811
819
|
end
|
812
820
|
|
813
|
-
if block
|
814
|
-
meta.instance_eval(&block)
|
815
|
-
end
|
821
|
+
meta.instance_eval(&block) if block
|
816
822
|
meta
|
817
823
|
end
|
818
824
|
|
@@ -829,19 +835,23 @@ module Autoproj
|
|
829
835
|
# @return [PackageSelection]
|
830
836
|
def layout_packages(validate = true)
|
831
837
|
result = PackageSelection.new
|
832
|
-
Autoproj.in_file(
|
838
|
+
Autoproj.in_file(file) do
|
833
839
|
normalized_layout.each_key do |pkg_or_set|
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
end
|
838
|
-
|
839
|
-
resolve_package_name(pkg_or_set).each do |pkg_type, pkg_name|
|
840
|
-
result.select(pkg_or_set, pkg_name, osdep: (pkg_type == :osdeps), weak: weak)
|
840
|
+
weak =
|
841
|
+
if (meta = metapackages[pkg_or_set])
|
842
|
+
meta.weak_dependencies?
|
841
843
|
end
|
842
|
-
|
843
|
-
|
844
|
+
|
845
|
+
resolve_package_name(pkg_or_set).each do |pkg_type, pkg_name|
|
846
|
+
result.select(
|
847
|
+
pkg_or_set, pkg_name,
|
848
|
+
osdep: (pkg_type == :osdeps),
|
849
|
+
weak: weak
|
850
|
+
)
|
844
851
|
end
|
852
|
+
rescue PackageNotFound => e
|
853
|
+
raise e, "#{pkg_or_set}, which is selected in the layout, "\
|
854
|
+
"is unknown: #{e.message}", e.backtrace
|
845
855
|
end
|
846
856
|
end
|
847
857
|
|
@@ -932,6 +942,7 @@ module Autoproj
|
|
932
942
|
all_package_names.each do |pkg_name|
|
933
943
|
package_type, package_name = resolve_single_package_name(pkg_name).first
|
934
944
|
next if excluded?(package_name) || ignored?(package_name)
|
945
|
+
|
935
946
|
result.select(package_name, package_name, osdep: (package_type == :osdeps))
|
936
947
|
end
|
937
948
|
result
|
@@ -963,20 +974,18 @@ module Autoproj
|
|
963
974
|
package_name = validate_package_name_argument(package_name)
|
964
975
|
|
965
976
|
matches = [package_name]
|
966
|
-
if source_package = find_package_definition(package_name)
|
977
|
+
if (source_package = find_package_definition(package_name))
|
967
978
|
each_metapackage do |meta|
|
968
|
-
if meta.include?(source_package)
|
969
|
-
matches << meta.name
|
970
|
-
end
|
979
|
+
matches << meta.name if meta.include?(source_package)
|
971
980
|
end
|
972
981
|
end
|
973
982
|
|
974
983
|
matches.each do |name|
|
975
|
-
if place = normalized_layout[name]
|
984
|
+
if (place = normalized_layout[name])
|
976
985
|
return place
|
977
986
|
end
|
978
987
|
end
|
979
|
-
|
988
|
+
"/"
|
980
989
|
end
|
981
990
|
|
982
991
|
class NoPackageXML < ConfigError; end
|
@@ -988,35 +997,38 @@ module Autoproj
|
|
988
997
|
def load_package_manifest(pkg)
|
989
998
|
if pkg.respond_to?(:to_str)
|
990
999
|
pkg_definition = find_package_definition(pkg)
|
991
|
-
|
1000
|
+
unless pkg_definition
|
992
1001
|
raise ArgumentError, "#{pkg} is not a known package in #{self}"
|
993
1002
|
end
|
1003
|
+
|
994
1004
|
pkg = pkg_definition
|
995
1005
|
end
|
996
|
-
package
|
1006
|
+
package = pkg.autobuild
|
1007
|
+
package_set = pkg.package_set
|
997
1008
|
|
998
1009
|
# Look for the package's manifest.xml, but fallback to a manifest in
|
999
1010
|
# the package set if present
|
1000
1011
|
if package.use_package_xml? && package.checked_out?
|
1001
1012
|
manifest_path = File.join(package.srcdir, "package.xml")
|
1002
1013
|
raise NoPackageXML.new(package.srcdir), "#{package.name} from "\
|
1003
|
-
|
1004
|
-
|
1014
|
+
"#{package_set.name} has use_package_xml set, but the package has "\
|
1015
|
+
"no package.xml file" unless File.file?(manifest_path)
|
1005
1016
|
|
1006
1017
|
manifest = PackageManifest.load(package, manifest_path,
|
1007
|
-
|
1018
|
+
ros_manifest: true)
|
1008
1019
|
else
|
1009
1020
|
manifest_paths = [File.join(package.srcdir, "manifest.xml")]
|
1010
1021
|
if package_set.local_dir
|
1011
1022
|
manifest_paths << File.join(
|
1012
|
-
package_set.local_dir, "manifests", package.name
|
1023
|
+
package_set.local_dir, "manifests", "#{package.name}.xml"
|
1024
|
+
)
|
1013
1025
|
end
|
1014
1026
|
manifest_path = manifest_paths.find do |path|
|
1015
1027
|
File.file?(path)
|
1016
1028
|
end
|
1017
1029
|
if manifest_path
|
1018
1030
|
manifest = PackageManifest.load(package, manifest_path,
|
1019
|
-
|
1031
|
+
ros_manifest: false)
|
1020
1032
|
end
|
1021
1033
|
end
|
1022
1034
|
|
@@ -1067,9 +1079,7 @@ module Autoproj
|
|
1067
1079
|
# The :force option allows to force the usage of the source package(s),
|
1068
1080
|
# regardless of the availability of the osdeps package.
|
1069
1081
|
def add_osdeps_overrides(osdeps_name, package: osdeps_name, packages: [], force: false)
|
1070
|
-
if package
|
1071
|
-
packages << package
|
1072
|
-
end
|
1082
|
+
packages << package if package
|
1073
1083
|
packages.each { |pkg_name| resolve_package_name(pkg_name) }
|
1074
1084
|
@osdeps_overrides[osdeps_name.to_s] = Hash[packages: packages, force: force]
|
1075
1085
|
end
|
@@ -1086,7 +1096,8 @@ module Autoproj
|
|
1086
1096
|
#
|
1087
1097
|
# Helper for {#expand_package_selection}
|
1088
1098
|
def update_selection(selection, user_selection_string, name, weak)
|
1089
|
-
source_packages
|
1099
|
+
source_packages = Array.new
|
1100
|
+
osdeps = Array.new
|
1090
1101
|
resolve_package_name(name).each do |type, resolved_name|
|
1091
1102
|
if type == :package
|
1092
1103
|
source_packages << resolved_name
|
@@ -1094,10 +1105,10 @@ module Autoproj
|
|
1094
1105
|
osdeps << resolved_name
|
1095
1106
|
end
|
1096
1107
|
end
|
1097
|
-
|
1108
|
+
unless source_packages.empty?
|
1098
1109
|
selection.select(user_selection_string, source_packages, osdep: false, weak: weak)
|
1099
1110
|
end
|
1100
|
-
|
1111
|
+
unless osdeps.empty?
|
1101
1112
|
selection.select(user_selection_string, osdeps, osdep: true, weak: weak)
|
1102
1113
|
end
|
1103
1114
|
end
|
@@ -1113,7 +1124,7 @@ module Autoproj
|
|
1113
1124
|
result = PackageSelection.new
|
1114
1125
|
|
1115
1126
|
all_selected_packages = self.all_selected_packages.to_set
|
1116
|
-
all_source_package_names =
|
1127
|
+
all_source_package_names = all_package_names
|
1117
1128
|
all_osdeps_package_names = os_package_resolver.all_package_names
|
1118
1129
|
selection.each do |sel|
|
1119
1130
|
match_pkg_name = Regexp.new(Regexp.quote(sel))
|
@@ -1145,25 +1156,21 @@ module Autoproj
|
|
1145
1156
|
all_matches.partition { |_, exact_match| exact_match }
|
1146
1157
|
selected_partial_matches, not_selected_partial_matches =
|
1147
1158
|
partial_matches.partition { |pkg_name, _| all_selected_packages.include?(pkg_name) }
|
1148
|
-
if result.has_match_for?(sel)
|
1149
|
-
not_selected_partial_matches.clear
|
1150
|
-
end
|
1159
|
+
not_selected_partial_matches.clear if result.has_match_for?(sel)
|
1151
1160
|
|
1152
|
-
matches =
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1161
|
+
matches =
|
1162
|
+
[exact_matches, selected_partial_matches, not_selected_partial_matches]
|
1163
|
+
.find { |m| !m.empty? }
|
1164
|
+
|
1165
|
+
matches&.each do |pkg_name, _|
|
1166
|
+
update_selection(result, sel, pkg_name, true)
|
1158
1167
|
end
|
1159
1168
|
end
|
1160
1169
|
|
1161
|
-
if filter
|
1162
|
-
result.filter_excluded_and_ignored_packages(self)
|
1163
|
-
end
|
1170
|
+
result.filter_excluded_and_ignored_packages(self) if filter
|
1164
1171
|
|
1165
1172
|
nonresolved = selection - result.matches.keys
|
1166
|
-
|
1173
|
+
[result, nonresolved]
|
1167
1174
|
end
|
1168
1175
|
|
1169
1176
|
attr_reader :moved_packages
|
@@ -1206,9 +1213,7 @@ module Autoproj
|
|
1206
1213
|
# Declare that we should reuse the autoproj installation present at the
|
1207
1214
|
# given path
|
1208
1215
|
def reuse(workspace_root)
|
1209
|
-
if reused_installations.any? { |mnf| mnf.path == workspace_root }
|
1210
|
-
return
|
1211
|
-
end
|
1216
|
+
return if reused_installations.any? { |mnf| mnf.path == workspace_root }
|
1212
1217
|
|
1213
1218
|
manifest = InstallationManifest.from_workspace_root(workspace_root)
|
1214
1219
|
manifest.load
|
@@ -1221,14 +1226,16 @@ module Autoproj
|
|
1221
1226
|
|
1222
1227
|
def self.manifest
|
1223
1228
|
Autoproj.warn_deprecated(
|
1224
|
-
__method__, "use workspace.manifest instead"
|
1229
|
+
__method__, "use workspace.manifest instead"
|
1230
|
+
)
|
1225
1231
|
|
1226
1232
|
workspace.manifest
|
1227
1233
|
end
|
1228
1234
|
|
1229
1235
|
def self.osdeps
|
1230
1236
|
Autoproj.warn_deprecated(
|
1231
|
-
__method__, "use workspace.os_package_resolver or workspace.os_package_installer instead"
|
1237
|
+
__method__, "use workspace.os_package_resolver or workspace.os_package_installer instead"
|
1238
|
+
)
|
1232
1239
|
|
1233
1240
|
workspace.os_package_resolver
|
1234
1241
|
end
|
@@ -1237,7 +1244,7 @@ module Autoproj
|
|
1237
1244
|
workspace.config
|
1238
1245
|
end
|
1239
1246
|
|
1240
|
-
def self.add_osdeps_overrides(*args, &block)
|
1241
|
-
manifest.add_osdeps_overrides(*args, &block)
|
1247
|
+
def self.add_osdeps_overrides(*args, **kw, &block)
|
1248
|
+
manifest.add_osdeps_overrides(*args, **kw, &block)
|
1242
1249
|
end
|
1243
1250
|
end
|
data/lib/autoproj/metapackage.rb
CHANGED
@@ -43,9 +43,7 @@ module Autoproj
|
|
43
43
|
|
44
44
|
# Remove a package from this metapackage
|
45
45
|
def remove(pkg)
|
46
|
-
if pkg.respond_to?(:name)
|
47
|
-
pkg = pkg.name
|
48
|
-
end
|
46
|
+
pkg = pkg.name if pkg.respond_to?(:name)
|
49
47
|
packages_by_name.delete(pkg)
|
50
48
|
end
|
51
49
|
|
@@ -60,9 +58,7 @@ module Autoproj
|
|
60
58
|
#
|
61
59
|
# @param [String,#name] pkg the package or package name
|
62
60
|
def include?(pkg)
|
63
|
-
|
64
|
-
pkg = pkg.name
|
65
|
-
end
|
61
|
+
pkg = pkg.name unless pkg.respond_to?(:to_str)
|
66
62
|
packages_by_name.has_key?(pkg)
|
67
63
|
end
|
68
64
|
|