autoproj 2.14.0 → 2.15.0
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 +22 -22
- data/bin/alocate +4 -4
- data/bin/alog +5 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +185 -182
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +184 -181
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +5 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +38 -34
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- 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 +213 -204
- 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 +45 -39
- 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 +35 -37
- data/lib/autoproj/cli/utility.rb +11 -10
- 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 +77 -84
- data/lib/autoproj/environment.rb +28 -13
- 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 +132 -130
- 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 +511 -506
- data/lib/autoproj/ops/import.rb +73 -63
- data/lib/autoproj/ops/install.rb +178 -174
- 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 +10 -10
- data/lib/autoproj/package_managers/bundler_manager.rb +147 -111
- 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 +20 -22
- 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 +32 -22
- 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 +27 -26
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +127 -113
- data/lib/autoproj/python.rb +55 -55
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +101 -67
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- 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 +127 -104
- data/lib/autoproj/variable_expansion.rb +7 -9
- data/lib/autoproj/vcs_definition.rb +35 -32
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +123 -107
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -55
- data/samples/autoproj/init.rb +1 -2
- metadata +53 -51
- data/.travis.yml +0 -24
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
|
@@ -74,22 +76,23 @@ module Autoproj
|
|
74
76
|
# Initialize the manifest from a hash, as loaded from a manifest file
|
75
77
|
def initialize_from_hash(data)
|
76
78
|
@data = data
|
77
|
-
@ignored_packages |= (data[
|
78
|
-
@ignored_packages |= (data[
|
79
|
+
@ignored_packages |= (data["ignored_packages"] || Set.new).to_set
|
80
|
+
@ignored_packages |= (data["ignore_packages"] || Set.new).to_set
|
79
81
|
invalidate_ignored_package_names
|
80
|
-
@manifest_exclusions |= (data[
|
82
|
+
@manifest_exclusions |= (data["exclude_packages"] || Set.new).to_set
|
81
83
|
|
82
84
|
normalized_layout = Hash.new
|
83
85
|
compute_normalized_layout(
|
84
86
|
normalized_layout,
|
85
|
-
|
86
|
-
data[
|
87
|
+
"/",
|
88
|
+
data["layout"] || Hash.new
|
89
|
+
)
|
87
90
|
@normalized_layout = normalized_layout
|
88
|
-
@has_layout = !!data[
|
91
|
+
@has_layout = !!data["layout"]
|
89
92
|
|
90
|
-
if data[
|
93
|
+
if data["constants"]
|
91
94
|
@constant_definitions =
|
92
|
-
Autoproj.resolve_constant_definitions(data[
|
95
|
+
Autoproj.resolve_constant_definitions(data["constants"])
|
93
96
|
end
|
94
97
|
end
|
95
98
|
|
@@ -115,7 +118,7 @@ module Autoproj
|
|
115
118
|
def add_package_to_layout(package)
|
116
119
|
package_name = validate_package_name_argument(package)
|
117
120
|
@has_layout = true
|
118
|
-
normalized_layout[package_name] =
|
121
|
+
normalized_layout[package_name] = "/"
|
119
122
|
end
|
120
123
|
|
121
124
|
# Add a package into the layout
|
@@ -128,7 +131,7 @@ module Autoproj
|
|
128
131
|
def add_metapackage_to_layout(metapackage)
|
129
132
|
validate_metapackage_in_self(metapackage)
|
130
133
|
@has_layout = true
|
131
|
-
normalized_layout[metapackage.name] =
|
134
|
+
normalized_layout[metapackage.name] = "/"
|
132
135
|
end
|
133
136
|
|
134
137
|
# Add a constant definition, used when resolving $CONSTANT in loaded
|
@@ -157,10 +160,12 @@ module Autoproj
|
|
157
160
|
# is not available on the current operating system, or simply return it
|
158
161
|
#
|
159
162
|
# @return [Boolean]
|
160
|
-
def accept_unavailable_osdeps
|
163
|
+
def accept_unavailable_osdeps?
|
164
|
+
!!@accept_unavailable_osdeps
|
165
|
+
end
|
161
166
|
|
162
167
|
# Sets {#accept_unavailable_osdeps?}
|
163
|
-
|
168
|
+
attr_writer :accept_unavailable_osdeps
|
164
169
|
|
165
170
|
attr_reader :constant_definitions
|
166
171
|
|
@@ -240,6 +245,7 @@ module Autoproj
|
|
240
245
|
if require_existing && !has_package?(package)
|
241
246
|
raise PackageNotFound, "no package named #{package} in #{self}"
|
242
247
|
end
|
248
|
+
|
243
249
|
package
|
244
250
|
end
|
245
251
|
end
|
@@ -275,9 +281,7 @@ module Autoproj
|
|
275
281
|
#
|
276
282
|
# Do not use directly, use {#ignored?} instead
|
277
283
|
def cache_ignored_package_names
|
278
|
-
if @ignored_package_names
|
279
|
-
return @ignored_package_names
|
280
|
-
end
|
284
|
+
return @ignored_package_names if @ignored_package_names
|
281
285
|
|
282
286
|
@ignored_package_names = each_package_definition.find_all do |pkg|
|
283
287
|
ignored_packages.any? do |l|
|
@@ -298,7 +302,8 @@ module Autoproj
|
|
298
302
|
#
|
299
303
|
# @yieldparam [Autobuild::Package]
|
300
304
|
def each_ignored_package
|
301
|
-
return enum_for(__method__)
|
305
|
+
return enum_for(__method__) unless block_given?
|
306
|
+
|
302
307
|
cache_ignored_package_names.each do |pkg_name|
|
303
308
|
yield(find_autobuild_package(pkg_name))
|
304
309
|
end
|
@@ -320,7 +325,7 @@ module Autoproj
|
|
320
325
|
|
321
326
|
if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)
|
322
327
|
true
|
323
|
-
elsif automatic_exclusions.any? { |pkg_name
|
328
|
+
elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }
|
324
329
|
true
|
325
330
|
else
|
326
331
|
false
|
@@ -329,7 +334,8 @@ module Autoproj
|
|
329
334
|
|
330
335
|
# Enumerates the package names of all ignored packages
|
331
336
|
def each_excluded_package
|
332
|
-
return enum_for(__method__)
|
337
|
+
return enum_for(__method__) unless block_given?
|
338
|
+
|
333
339
|
each_autobuild_package do |pkg|
|
334
340
|
yield(pkg) if excluded?(pkg.name)
|
335
341
|
end
|
@@ -358,10 +364,14 @@ module Autoproj
|
|
358
364
|
# Exclude +package_name+ from the build. +reason+ is a string describing
|
359
365
|
# why the package is to be excluded.
|
360
366
|
def exclude_package(package_name, reason)
|
361
|
-
package = validate_package_name_argument(
|
362
|
-
|
367
|
+
package = validate_package_name_argument(
|
368
|
+
package_name, require_existing: false
|
369
|
+
)
|
370
|
+
if (meta = find_metapackage(package))
|
363
371
|
meta.each_package do |pkg|
|
364
|
-
automatic_exclusions[pkg.name] =
|
372
|
+
automatic_exclusions[pkg.name] =
|
373
|
+
"#{meta.name} is an excluded metapackage, "\
|
374
|
+
"and it includes #{pkg.name}: #{reason}"
|
365
375
|
end
|
366
376
|
else
|
367
377
|
automatic_exclusions[package] = reason
|
@@ -388,11 +398,11 @@ module Autoproj
|
|
388
398
|
# disabled on this particular operating system.
|
389
399
|
def exclusion_reason(package_name)
|
390
400
|
package_name = validate_package_name_argument(package_name)
|
391
|
-
if message = automatic_exclusions[package_name]
|
401
|
+
if (message = automatic_exclusions[package_name])
|
392
402
|
return message
|
393
403
|
end
|
394
404
|
|
395
|
-
|
405
|
+
unless explicitely_selected_in_layout?(package_name)
|
396
406
|
manifest_exclusions.each do |matcher|
|
397
407
|
if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)
|
398
408
|
return "#{pkg_set.name} is a metapackage listed in the exclude_packages section of the manifest, and it includes #{package_name}"
|
@@ -421,12 +431,10 @@ module Autoproj
|
|
421
431
|
|
422
432
|
# Like #each_package_set, but filters out local package sets
|
423
433
|
def each_remote_package_set
|
424
|
-
return enum_for(__method__)
|
434
|
+
return enum_for(__method__) unless block_given?
|
425
435
|
|
426
436
|
each_package_set do |pkg_set|
|
427
|
-
|
428
|
-
yield(pkg_set)
|
429
|
-
end
|
437
|
+
yield(pkg_set) unless pkg_set.local?
|
430
438
|
end
|
431
439
|
end
|
432
440
|
|
@@ -466,9 +474,7 @@ module Autoproj
|
|
466
474
|
def register_package(package, block = nil, package_set = main_package_set, file = nil)
|
467
475
|
invalidate_ignored_package_names
|
468
476
|
pkg = PackageDefinition.new(package, package_set, file)
|
469
|
-
if block
|
470
|
-
pkg.add_setup_block(block)
|
471
|
-
end
|
477
|
+
pkg.add_setup_block(block) if block
|
472
478
|
@packages[package.name] = pkg
|
473
479
|
metapackage pkg.package_set.name, pkg.autobuild
|
474
480
|
metapackage "#{pkg.package_set.name}.all", pkg.autobuild
|
@@ -507,11 +513,11 @@ module Autoproj
|
|
507
513
|
#
|
508
514
|
# Unlike {#find_package_definition}, raise if the package does not exist
|
509
515
|
def package_definition_by_name(name)
|
510
|
-
|
511
|
-
pkg
|
512
|
-
else
|
516
|
+
unless (pkg = find_package_definition(name))
|
513
517
|
raise ArgumentError, "no package defined named '#{name}'"
|
514
518
|
end
|
519
|
+
|
520
|
+
pkg
|
515
521
|
end
|
516
522
|
|
517
523
|
# The autobuild description of a package by its name
|
@@ -519,16 +525,15 @@ module Autoproj
|
|
519
525
|
# @param [String,#name] name the package name
|
520
526
|
# @return [Autobuild::Package,nil]
|
521
527
|
def find_autobuild_package(name)
|
522
|
-
|
523
|
-
pkg.autobuild
|
524
|
-
end
|
528
|
+
find_package_definition(name)&.autobuild
|
525
529
|
end
|
526
530
|
|
527
531
|
# Lists all defined packages
|
528
532
|
#
|
529
533
|
# @yieldparam [PackageDefinition] pkg
|
530
534
|
def each_package_definition(&block)
|
531
|
-
return enum_for(__method__)
|
535
|
+
return enum_for(__method__) unless block_given?
|
536
|
+
|
532
537
|
packages.each_value(&block)
|
533
538
|
end
|
534
539
|
|
@@ -536,7 +541,8 @@ module Autoproj
|
|
536
541
|
#
|
537
542
|
# @yieldparam [Autobuild::Package] pkg
|
538
543
|
def each_autobuild_package
|
539
|
-
return enum_for(__method__)
|
544
|
+
return enum_for(__method__) unless block_given?
|
545
|
+
|
540
546
|
each_package_definition { |pkg| yield(pkg.autobuild) }
|
541
547
|
end
|
542
548
|
|
@@ -554,28 +560,24 @@ module Autoproj
|
|
554
560
|
end
|
555
561
|
package_name = validate_package_name_argument(package, require_existing: require_existing)
|
556
562
|
package_set = _package_set || package_set || package.package_set
|
557
|
-
mainline = if mainline == true
|
558
|
-
package_set
|
559
|
-
else mainline
|
560
|
-
end
|
563
|
+
mainline = package_set if mainline == true
|
561
564
|
|
562
565
|
# package_name is already validated, do not re-validate
|
563
566
|
vcs = package_set.importer_definition_for(package_name, require_existing: false)
|
564
567
|
|
565
568
|
package_sets = each_package_set.to_a.dup
|
566
569
|
index = package_sets.find_index(package_set)
|
567
|
-
|
570
|
+
unless index
|
568
571
|
raise RuntimeError, "found inconsistency: package #{package_name} is not in a package set of #{self}"
|
569
572
|
end
|
570
573
|
|
571
|
-
if package_sets[0, index + 1].include?(mainline)
|
572
|
-
return vcs
|
573
|
-
end
|
574
|
+
return vcs if package_sets[0, index + 1].include?(mainline)
|
574
575
|
|
575
576
|
# Then apply the overrides
|
576
577
|
package_sets[(index + 1)..-1].inject(vcs) do |updated_vcs, pkg_set|
|
577
578
|
updated_vcs = pkg_set.overrides_for(package_name, updated_vcs, require_existing: false)
|
578
579
|
return updated_vcs if pkg_set == mainline
|
580
|
+
|
579
581
|
updated_vcs
|
580
582
|
end
|
581
583
|
end
|
@@ -601,7 +603,8 @@ module Autoproj
|
|
601
603
|
package_mainline =
|
602
604
|
if mainline == true
|
603
605
|
pkg.package_set
|
604
|
-
else
|
606
|
+
else
|
607
|
+
mainline
|
605
608
|
end
|
606
609
|
vcs = importer_definition_for(pkg, mainline: package_mainline)
|
607
610
|
|
@@ -641,11 +644,11 @@ module Autoproj
|
|
641
644
|
# @return [PackageSet] the package set
|
642
645
|
# @raise [ArgumentError] if none exists with that name
|
643
646
|
def package_set(name)
|
644
|
-
|
645
|
-
set
|
646
|
-
else
|
647
|
+
unless (set = find_package_set(name))
|
647
648
|
raise ArgumentError, "no package set called #{name} exists"
|
648
649
|
end
|
650
|
+
|
651
|
+
set
|
649
652
|
end
|
650
653
|
|
651
654
|
# The root package set, which represents the workspace itself
|
@@ -670,25 +673,24 @@ module Autoproj
|
|
670
673
|
# fallback defined with {#add_osdeps_overrides}. If true, it will
|
671
674
|
# return such a package as an osdep.
|
672
675
|
def resolve_package_name(name, include_unavailable: false)
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
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
|
678
682
|
|
679
683
|
result = []
|
680
684
|
pkg_names.each do |pkg|
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
else
|
687
|
-
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
688
|
-
end
|
689
|
-
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
|
690
690
|
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
691
691
|
end
|
692
|
+
rescue PackageNotFound => e
|
693
|
+
raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
|
692
694
|
end
|
693
695
|
result
|
694
696
|
end
|
@@ -725,11 +727,12 @@ module Autoproj
|
|
725
727
|
# @raise PackageNotFound if the given package name cannot be resolved
|
726
728
|
# into a package
|
727
729
|
def resolve_package_name_as_source_package(name)
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
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"
|
732
733
|
end
|
734
|
+
|
735
|
+
[[:package, pkg.name]]
|
733
736
|
end
|
734
737
|
|
735
738
|
# @api private
|
@@ -748,7 +751,7 @@ module Autoproj
|
|
748
751
|
# fallback defined with {#add_osdeps_overrides}.
|
749
752
|
# If true, it will return it as an osdep.
|
750
753
|
def resolve_package_name_as_osdep(name)
|
751
|
-
|
754
|
+
osdeps_availability = os_package_resolver.availability_of(name)
|
752
755
|
if osdeps_availability == OSPackageResolver::NO_PACKAGE
|
753
756
|
raise PackageNotFound, "#{name} is not an osdep"
|
754
757
|
end
|
@@ -760,13 +763,13 @@ module Autoproj
|
|
760
763
|
(osdeps_availability == OSPackageResolver::IGNORE)
|
761
764
|
osdeps_overrides = self.osdeps_overrides[name]
|
762
765
|
if osdeps_overrides && (!osdeps_available || osdeps_overrides[:force])
|
763
|
-
|
766
|
+
osdeps_overrides[:packages].inject([]) do |result, src_pkg_name|
|
764
767
|
result.concat(resolve_package_name_as_source_package(src_pkg_name))
|
765
768
|
end.uniq
|
766
769
|
elsif !osdeps_available && (pkg = find_autobuild_package(name))
|
767
|
-
|
770
|
+
[[:package, pkg.name]]
|
768
771
|
elsif osdeps_available || accept_unavailable_osdeps?
|
769
|
-
|
772
|
+
[[:osdeps, name]]
|
770
773
|
elsif osdeps_availability == OSPackageResolver::WRONG_OS
|
771
774
|
raise PackageUnavailable, "#{name} is an osdep, but it is not available for this operating system (#{os_package_resolver.operating_system})"
|
772
775
|
elsif osdeps_availability == OSPackageResolver::UNKNOWN_OS
|
@@ -802,9 +805,9 @@ module Autoproj
|
|
802
805
|
packages.each do |arg|
|
803
806
|
if !arg.respond_to?(:to_str)
|
804
807
|
meta.add(arg)
|
805
|
-
elsif pkg = find_autobuild_package(arg)
|
808
|
+
elsif (pkg = find_autobuild_package(arg))
|
806
809
|
meta.add(pkg)
|
807
|
-
elsif pkg_set = find_metapackage(arg)
|
810
|
+
elsif (pkg_set = find_metapackage(arg))
|
808
811
|
pkg_set.each_package do |pkg_in_set|
|
809
812
|
meta.add(pkg_in_set)
|
810
813
|
end
|
@@ -815,9 +818,7 @@ module Autoproj
|
|
815
818
|
end
|
816
819
|
end
|
817
820
|
|
818
|
-
if block
|
819
|
-
meta.instance_eval(&block)
|
820
|
-
end
|
821
|
+
meta.instance_eval(&block) if block
|
821
822
|
meta
|
822
823
|
end
|
823
824
|
|
@@ -834,19 +835,23 @@ module Autoproj
|
|
834
835
|
# @return [PackageSelection]
|
835
836
|
def layout_packages(validate = true)
|
836
837
|
result = PackageSelection.new
|
837
|
-
Autoproj.in_file(
|
838
|
+
Autoproj.in_file(file) do
|
838
839
|
normalized_layout.each_key do |pkg_or_set|
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
end
|
843
|
-
|
844
|
-
resolve_package_name(pkg_or_set).each do |pkg_type, pkg_name|
|
845
|
-
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?
|
846
843
|
end
|
847
|
-
|
848
|
-
|
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
|
+
)
|
849
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
|
850
855
|
end
|
851
856
|
end
|
852
857
|
|
@@ -937,6 +942,7 @@ module Autoproj
|
|
937
942
|
all_package_names.each do |pkg_name|
|
938
943
|
package_type, package_name = resolve_single_package_name(pkg_name).first
|
939
944
|
next if excluded?(package_name) || ignored?(package_name)
|
945
|
+
|
940
946
|
result.select(package_name, package_name, osdep: (package_type == :osdeps))
|
941
947
|
end
|
942
948
|
result
|
@@ -968,20 +974,18 @@ module Autoproj
|
|
968
974
|
package_name = validate_package_name_argument(package_name)
|
969
975
|
|
970
976
|
matches = [package_name]
|
971
|
-
if source_package = find_package_definition(package_name)
|
977
|
+
if (source_package = find_package_definition(package_name))
|
972
978
|
each_metapackage do |meta|
|
973
|
-
if meta.include?(source_package)
|
974
|
-
matches << meta.name
|
975
|
-
end
|
979
|
+
matches << meta.name if meta.include?(source_package)
|
976
980
|
end
|
977
981
|
end
|
978
982
|
|
979
983
|
matches.each do |name|
|
980
|
-
if place = normalized_layout[name]
|
984
|
+
if (place = normalized_layout[name])
|
981
985
|
return place
|
982
986
|
end
|
983
987
|
end
|
984
|
-
|
988
|
+
"/"
|
985
989
|
end
|
986
990
|
|
987
991
|
class NoPackageXML < ConfigError; end
|
@@ -993,35 +997,38 @@ module Autoproj
|
|
993
997
|
def load_package_manifest(pkg)
|
994
998
|
if pkg.respond_to?(:to_str)
|
995
999
|
pkg_definition = find_package_definition(pkg)
|
996
|
-
|
1000
|
+
unless pkg_definition
|
997
1001
|
raise ArgumentError, "#{pkg} is not a known package in #{self}"
|
998
1002
|
end
|
1003
|
+
|
999
1004
|
pkg = pkg_definition
|
1000
1005
|
end
|
1001
|
-
package
|
1006
|
+
package = pkg.autobuild
|
1007
|
+
package_set = pkg.package_set
|
1002
1008
|
|
1003
1009
|
# Look for the package's manifest.xml, but fallback to a manifest in
|
1004
1010
|
# the package set if present
|
1005
1011
|
if package.use_package_xml? && package.checked_out?
|
1006
1012
|
manifest_path = File.join(package.srcdir, "package.xml")
|
1007
1013
|
raise NoPackageXML.new(package.srcdir), "#{package.name} from "\
|
1008
|
-
|
1009
|
-
|
1014
|
+
"#{package_set.name} has use_package_xml set, but the package has "\
|
1015
|
+
"no package.xml file" unless File.file?(manifest_path)
|
1010
1016
|
|
1011
1017
|
manifest = PackageManifest.load(package, manifest_path,
|
1012
|
-
|
1018
|
+
ros_manifest: true)
|
1013
1019
|
else
|
1014
1020
|
manifest_paths = [File.join(package.srcdir, "manifest.xml")]
|
1015
1021
|
if package_set.local_dir
|
1016
1022
|
manifest_paths << File.join(
|
1017
|
-
package_set.local_dir, "manifests", package.name
|
1023
|
+
package_set.local_dir, "manifests", "#{package.name}.xml"
|
1024
|
+
)
|
1018
1025
|
end
|
1019
1026
|
manifest_path = manifest_paths.find do |path|
|
1020
1027
|
File.file?(path)
|
1021
1028
|
end
|
1022
1029
|
if manifest_path
|
1023
1030
|
manifest = PackageManifest.load(package, manifest_path,
|
1024
|
-
|
1031
|
+
ros_manifest: false)
|
1025
1032
|
end
|
1026
1033
|
end
|
1027
1034
|
|
@@ -1072,9 +1079,7 @@ module Autoproj
|
|
1072
1079
|
# The :force option allows to force the usage of the source package(s),
|
1073
1080
|
# regardless of the availability of the osdeps package.
|
1074
1081
|
def add_osdeps_overrides(osdeps_name, package: osdeps_name, packages: [], force: false)
|
1075
|
-
if package
|
1076
|
-
packages << package
|
1077
|
-
end
|
1082
|
+
packages << package if package
|
1078
1083
|
packages.each { |pkg_name| resolve_package_name(pkg_name) }
|
1079
1084
|
@osdeps_overrides[osdeps_name.to_s] = Hash[packages: packages, force: force]
|
1080
1085
|
end
|
@@ -1091,7 +1096,8 @@ module Autoproj
|
|
1091
1096
|
#
|
1092
1097
|
# Helper for {#expand_package_selection}
|
1093
1098
|
def update_selection(selection, user_selection_string, name, weak)
|
1094
|
-
source_packages
|
1099
|
+
source_packages = Array.new
|
1100
|
+
osdeps = Array.new
|
1095
1101
|
resolve_package_name(name).each do |type, resolved_name|
|
1096
1102
|
if type == :package
|
1097
1103
|
source_packages << resolved_name
|
@@ -1099,10 +1105,10 @@ module Autoproj
|
|
1099
1105
|
osdeps << resolved_name
|
1100
1106
|
end
|
1101
1107
|
end
|
1102
|
-
|
1108
|
+
unless source_packages.empty?
|
1103
1109
|
selection.select(user_selection_string, source_packages, osdep: false, weak: weak)
|
1104
1110
|
end
|
1105
|
-
|
1111
|
+
unless osdeps.empty?
|
1106
1112
|
selection.select(user_selection_string, osdeps, osdep: true, weak: weak)
|
1107
1113
|
end
|
1108
1114
|
end
|
@@ -1118,7 +1124,7 @@ module Autoproj
|
|
1118
1124
|
result = PackageSelection.new
|
1119
1125
|
|
1120
1126
|
all_selected_packages = self.all_selected_packages.to_set
|
1121
|
-
all_source_package_names =
|
1127
|
+
all_source_package_names = all_package_names
|
1122
1128
|
all_osdeps_package_names = os_package_resolver.all_package_names
|
1123
1129
|
selection.each do |sel|
|
1124
1130
|
match_pkg_name = Regexp.new(Regexp.quote(sel))
|
@@ -1150,25 +1156,21 @@ module Autoproj
|
|
1150
1156
|
all_matches.partition { |_, exact_match| exact_match }
|
1151
1157
|
selected_partial_matches, not_selected_partial_matches =
|
1152
1158
|
partial_matches.partition { |pkg_name, _| all_selected_packages.include?(pkg_name) }
|
1153
|
-
if result.has_match_for?(sel)
|
1154
|
-
not_selected_partial_matches.clear
|
1155
|
-
end
|
1159
|
+
not_selected_partial_matches.clear if result.has_match_for?(sel)
|
1156
1160
|
|
1157
|
-
matches =
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
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)
|
1163
1167
|
end
|
1164
1168
|
end
|
1165
1169
|
|
1166
|
-
if filter
|
1167
|
-
result.filter_excluded_and_ignored_packages(self)
|
1168
|
-
end
|
1170
|
+
result.filter_excluded_and_ignored_packages(self) if filter
|
1169
1171
|
|
1170
1172
|
nonresolved = selection - result.matches.keys
|
1171
|
-
|
1173
|
+
[result, nonresolved]
|
1172
1174
|
end
|
1173
1175
|
|
1174
1176
|
attr_reader :moved_packages
|
@@ -1211,9 +1213,7 @@ module Autoproj
|
|
1211
1213
|
# Declare that we should reuse the autoproj installation present at the
|
1212
1214
|
# given path
|
1213
1215
|
def reuse(workspace_root)
|
1214
|
-
if reused_installations.any? { |mnf| mnf.path == workspace_root }
|
1215
|
-
return
|
1216
|
-
end
|
1216
|
+
return if reused_installations.any? { |mnf| mnf.path == workspace_root }
|
1217
1217
|
|
1218
1218
|
manifest = InstallationManifest.from_workspace_root(workspace_root)
|
1219
1219
|
manifest.load
|
@@ -1226,14 +1226,16 @@ module Autoproj
|
|
1226
1226
|
|
1227
1227
|
def self.manifest
|
1228
1228
|
Autoproj.warn_deprecated(
|
1229
|
-
__method__, "use workspace.manifest instead"
|
1229
|
+
__method__, "use workspace.manifest instead"
|
1230
|
+
)
|
1230
1231
|
|
1231
1232
|
workspace.manifest
|
1232
1233
|
end
|
1233
1234
|
|
1234
1235
|
def self.osdeps
|
1235
1236
|
Autoproj.warn_deprecated(
|
1236
|
-
__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
|
+
)
|
1237
1239
|
|
1238
1240
|
workspace.os_package_resolver
|
1239
1241
|
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
|
|
@@ -2,9 +2,9 @@ module Autoproj
|
|
2
2
|
module Ops
|
3
3
|
# Shamelessly stolen from ActiveSupport
|
4
4
|
def self.atomic_write(file_name, temp_dir = Dir.tmpdir)
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
5
|
+
require "tempfile" unless defined?(Tempfile)
|
6
|
+
require "fileutils" unless defined?(FileUtils)
|
7
|
+
|
8
8
|
temp_file = Tempfile.new(File.basename(file_name), temp_dir)
|
9
9
|
yield temp_file
|
10
10
|
temp_file.flush
|
@@ -12,15 +12,16 @@ module Autoproj
|
|
12
12
|
rescue NotImplementedError
|
13
13
|
end
|
14
14
|
temp_file.close
|
15
|
-
|
15
|
+
|
16
16
|
begin
|
17
17
|
# Get original file permissions
|
18
18
|
old_stat = File.stat(file_name)
|
19
19
|
rescue Errno::ENOENT
|
20
20
|
# No old permissions, write a temp file to determine the defaults
|
21
21
|
check_name = File.join(
|
22
|
-
File.dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}"
|
23
|
-
|
22
|
+
File.dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}"
|
23
|
+
)
|
24
|
+
File.open(check_name, "w") {}
|
24
25
|
old_stat = File.stat(check_name)
|
25
26
|
File.unlink(check_name)
|
26
27
|
end
|