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
@@ -1,222 +1,222 @@
|
|
1
1
|
module Autoproj
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
2
|
+
# Class holding information about which packages have been selected, and
|
3
|
+
# why. It is used to decide whether some non-availability of packages
|
4
|
+
# are errors or simply warnings (i.e. if the user really wants a given
|
5
|
+
# package, or merely might be adding it by accident)
|
6
|
+
class PackageSelection
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
# The set of matches, i.e. a mapping from a user-provided string to
|
10
|
+
# the set of packages it selected
|
11
|
+
attr_reader :matches
|
12
|
+
# The set of selected packages, as a hash of the package name to the
|
13
|
+
# set of user-provided strings that caused that package to be
|
14
|
+
# selected
|
15
|
+
attr_reader :selection
|
16
|
+
# A flag that tells #filter_excluded_and_ignored_packages whether
|
17
|
+
# the a given package selection is weak or not.
|
18
|
+
#
|
19
|
+
# If true, a selection that have some excluded packages will not
|
20
|
+
# generate an error. Otherwise (the default), an error is generated
|
21
|
+
attr_reader :weak_dependencies
|
22
|
+
# After a call to #filter_excluded_and_ignored_packages, this
|
23
|
+
# contains the set of package exclusions that have been ignored
|
24
|
+
# because the corresponding metapackage has a weak dependency policy
|
25
|
+
attr_reader :exclusions
|
26
|
+
# After a call to #filter_excluded_and_ignored_packages, this
|
27
|
+
# contains the set of package ignores that have been ignored because
|
28
|
+
# the corresponding metapackage has a weak dependency policy
|
29
|
+
attr_reader :ignores
|
30
|
+
# The set of source packages that have been selected
|
31
|
+
attr_reader :source_packages
|
32
|
+
# The set of osdeps that have been selected
|
33
|
+
attr_reader :osdeps
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
@selection = Hash.new { |h, k| h[k] = Set.new }
|
37
|
+
@matches = Hash.new { |h, k| h[k] = Set.new }
|
38
|
+
@weak_dependencies = Hash.new
|
39
|
+
@ignores = Hash.new { |h, k| h[k] = Set.new }
|
40
|
+
@exclusions = Hash.new { |h, k| h[k] = Set.new }
|
41
|
+
@source_packages = Set.new
|
42
|
+
@osdeps = Set.new
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
def include?(pkg_name)
|
46
|
+
selection.has_key?(pkg_name)
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def empty?
|
50
|
+
selection.empty?
|
51
|
+
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
# Test if a package is in the ignore list
|
54
|
+
#
|
55
|
+
# @param [String] pkg_name Name of the package
|
56
|
+
# @return [Bool] true, if package is in the ignore list, false
|
57
|
+
# otherwise
|
58
|
+
def ignored?(pkg_name)
|
59
|
+
ignores.include?(pkg_name)
|
60
|
+
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
# Test if a package is in the exclusions list
|
63
|
+
#
|
64
|
+
# @param [String] pkg_name Name of the package
|
65
|
+
# @return [Bool] true, if package is in the exclusion list, false
|
66
|
+
# otherwise
|
67
|
+
def excluded?(pkg_name)
|
68
|
+
exclusions.include?(pkg_name)
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
names.merge(roots).map do |pkg_name|
|
83
|
-
manifest.find_package_definition(pkg_name)
|
84
|
-
end
|
71
|
+
# Returns the source packages selected explicitely or through
|
72
|
+
# dependencies
|
73
|
+
#
|
74
|
+
# @param [Manifest] manifest
|
75
|
+
# @return [Array<PackageDefinition>]
|
76
|
+
def all_selected_source_packages(manifest)
|
77
|
+
names = Set.new
|
78
|
+
roots = each_source_package_name.to_set
|
79
|
+
roots.each do |pkg_name|
|
80
|
+
manifest.find_autobuild_package(pkg_name).all_dependencies(names)
|
85
81
|
end
|
86
|
-
|
87
|
-
|
88
|
-
# dependencies
|
89
|
-
#
|
90
|
-
# @param [Manifest] manifest
|
91
|
-
# @return [Array<String>]
|
92
|
-
def all_selected_osdep_packages(manifest)
|
93
|
-
all_sources = all_selected_source_packages(manifest)
|
94
|
-
from_source = all_sources.each_with_object(Set.new) do |pkg, s|
|
95
|
-
s.merge(pkg.autobuild.os_packages)
|
96
|
-
end
|
97
|
-
from_source | osdeps
|
82
|
+
names.merge(roots).map do |pkg_name|
|
83
|
+
manifest.find_package_definition(pkg_name)
|
98
84
|
end
|
85
|
+
end
|
99
86
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
87
|
+
# Returns the source packages selected explicitely or through
|
88
|
+
# dependencies
|
89
|
+
#
|
90
|
+
# @param [Manifest] manifest
|
91
|
+
# @return [Array<String>]
|
92
|
+
def all_selected_osdep_packages(manifest)
|
93
|
+
all_sources = all_selected_source_packages(manifest)
|
94
|
+
from_source = all_sources.each_with_object(Set.new) do |pkg, s|
|
95
|
+
s.merge(pkg.autobuild.os_packages)
|
96
|
+
end
|
97
|
+
from_source | osdeps
|
98
|
+
end
|
104
99
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
end
|
100
|
+
def each(&block)
|
101
|
+
Autoproj.warn_deprecated "PackageSelection#each", "use PackageSelection#each_source_package_name instead", 0
|
102
|
+
each_source_package_name(&block)
|
103
|
+
end
|
110
104
|
|
111
|
-
|
112
|
-
|
113
|
-
end
|
105
|
+
def each_package_name(&block)
|
106
|
+
return enum_for(__method__) unless block
|
114
107
|
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
each_source_package_name(&block)
|
109
|
+
each_osdep_package_name(&block)
|
110
|
+
end
|
118
111
|
|
119
|
-
|
120
|
-
|
121
|
-
|
112
|
+
def selected_source_package?(pkg)
|
113
|
+
source_packages.include?(pkg.name)
|
114
|
+
end
|
122
115
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
116
|
+
def each_source_package_name(&block)
|
117
|
+
source_packages.each(&block)
|
118
|
+
end
|
127
119
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
weak = _backward.first
|
132
|
-
end
|
120
|
+
def each_osdep_package_name(&block)
|
121
|
+
osdeps.each(&block)
|
122
|
+
end
|
133
123
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
139
|
-
if osdep
|
140
|
-
osdeps.merge(packages)
|
141
|
-
else
|
142
|
-
source_packages.merge(packages)
|
143
|
-
end
|
124
|
+
def packages
|
125
|
+
Autoproj.warn_deprecated "PackageSelection#packages", "use PackageSelection#source_packages instead", 0
|
126
|
+
source_packages
|
127
|
+
end
|
144
128
|
|
145
|
-
|
129
|
+
def select(sel, packages, *_backward, weak: false, osdep: false)
|
130
|
+
unless _backward.empty?
|
131
|
+
Autoproj.warn_deprecated "calling PackageSelection#select with a boolean as third argument", "use e.g. weak: true instead", 0
|
132
|
+
weak = _backward.first
|
146
133
|
end
|
147
134
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
old.matches.each do |sel, set|
|
153
|
-
@matches[sel] = set.dup
|
154
|
-
end
|
155
|
-
@source_packages = old.source_packages.dup
|
156
|
-
@osdeps = old.osdeps.dup
|
135
|
+
packages = Array(packages).to_set
|
136
|
+
matches[sel].merge(packages)
|
137
|
+
packages.each do |pkg_name|
|
138
|
+
selection[pkg_name] << sel
|
157
139
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
140
|
+
if osdep
|
141
|
+
osdeps.merge(packages)
|
142
|
+
else
|
143
|
+
source_packages.merge(packages)
|
161
144
|
end
|
162
145
|
|
163
|
-
|
164
|
-
|
146
|
+
weak_dependencies[sel] = weak
|
147
|
+
end
|
148
|
+
|
149
|
+
def initialize_copy(old)
|
150
|
+
old.selection.each do |pkg_name, set|
|
151
|
+
@selection[pkg_name] = set.dup
|
152
|
+
end
|
153
|
+
old.matches.each do |sel, set|
|
154
|
+
@matches[sel] = set.dup
|
165
155
|
end
|
156
|
+
@source_packages = old.source_packages.dup
|
157
|
+
@osdeps = old.osdeps.dup
|
158
|
+
end
|
166
159
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
160
|
+
def has_match_for?(sel)
|
161
|
+
matches.has_key?(sel)
|
162
|
+
end
|
163
|
+
|
164
|
+
def match_for(sel)
|
165
|
+
matches[sel]
|
166
|
+
end
|
167
|
+
|
168
|
+
# Remove packages that are explicitely excluded and/or ignored
|
169
|
+
#
|
170
|
+
# Raise an error if an explicit selection expands only to an
|
171
|
+
# excluded package, and display a warning for ignored packages
|
172
|
+
def filter_excluded_and_ignored_packages(manifest)
|
173
|
+
matches.each do |sel, expansion|
|
174
|
+
excluded, other = expansion.partition { |pkg_name| manifest.excluded?(pkg_name) }
|
175
|
+
ignored, ok = other.partition { |pkg_name| manifest.ignored?(pkg_name) }
|
176
|
+
|
177
|
+
if !excluded.empty? && (!weak_dependencies[sel] || (ok.empty? && ignored.empty?))
|
178
|
+
exclusions = excluded.map do |pkg_name|
|
179
|
+
[pkg_name, manifest.exclusion_reason(pkg_name)]
|
180
|
+
end
|
181
|
+
base_msg = "#{sel} is selected in the manifest or on the command line"
|
182
|
+
if exclusions.size == 1
|
183
|
+
reason = exclusions[0][1]
|
184
|
+
if sel == exclusions[0][0]
|
185
|
+
raise ExcludedSelection.new(sel), "#{base_msg}, but it is excluded from the build: #{reason}"
|
190
186
|
elsif weak_dependencies[sel]
|
191
|
-
raise ExcludedSelection.new(sel), "#{base_msg}, but expands to #{exclusions.map(&:first).join(
|
187
|
+
raise ExcludedSelection.new(sel), "#{base_msg}, but it expands to #{exclusions.map(&:first).join(', ')}, which is excluded from the build: #{reason}"
|
192
188
|
else
|
193
|
-
raise ExcludedSelection.new(sel), "#{base_msg}, but
|
189
|
+
raise ExcludedSelection.new(sel), "#{base_msg}, but its dependency #{exclusions.map(&:first).join(', ')} is excluded from the build: #{reason}"
|
194
190
|
end
|
191
|
+
elsif weak_dependencies[sel]
|
192
|
+
raise ExcludedSelection.new(sel), "#{base_msg}, but expands to #{exclusions.map(&:first).join(', ')}, and all these packages are excluded from the build:\n #{exclusions.map { |e_name, e_reason| "#{e_name}: #{e_reason}" }.join("\n ")}"
|
195
193
|
else
|
196
|
-
|
197
|
-
self.ignores[sel] |= ignored.to_set.dup
|
198
|
-
end
|
199
|
-
|
200
|
-
excluded = excluded.to_set
|
201
|
-
ignored = ignored.to_set
|
202
|
-
expansion.delete_if do |pkg_name|
|
203
|
-
ignored.include?(pkg_name) || excluded.include?(pkg_name)
|
194
|
+
raise ExcludedSelection.new(sel), "#{base_msg}, but it requires #{exclusions.map(&:first).join(', ')}, and all these packages are excluded from the build:\n #{exclusions.map { |e_name, e_reason| "#{e_name}: #{e_reason}" }.join("\n ")}"
|
204
195
|
end
|
196
|
+
else
|
197
|
+
self.exclusions[sel] |= excluded.to_set.dup
|
198
|
+
ignores[sel] |= ignored.to_set.dup
|
205
199
|
end
|
206
200
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
manifest.excluded?(pkg_name) || manifest.ignored?(pkg_name)
|
212
|
-
end
|
213
|
-
selection.delete_if do |pkg_name, _|
|
214
|
-
manifest.excluded?(pkg_name) || manifest.ignored?(pkg_name)
|
215
|
-
end
|
216
|
-
matches.delete_if do |key, sel|
|
217
|
-
sel.empty?
|
201
|
+
excluded = excluded.to_set
|
202
|
+
ignored = ignored.to_set
|
203
|
+
expansion.delete_if do |pkg_name|
|
204
|
+
ignored.include?(pkg_name) || excluded.include?(pkg_name)
|
218
205
|
end
|
219
206
|
end
|
207
|
+
|
208
|
+
source_packages.delete_if do |pkg_name|
|
209
|
+
manifest.excluded?(pkg_name) || manifest.ignored?(pkg_name)
|
210
|
+
end
|
211
|
+
osdeps.delete_if do |pkg_name|
|
212
|
+
manifest.excluded?(pkg_name) || manifest.ignored?(pkg_name)
|
213
|
+
end
|
214
|
+
selection.delete_if do |pkg_name, _|
|
215
|
+
manifest.excluded?(pkg_name) || manifest.ignored?(pkg_name)
|
216
|
+
end
|
217
|
+
matches.delete_if do |key, sel|
|
218
|
+
sel.empty?
|
219
|
+
end
|
220
220
|
end
|
221
|
+
end
|
221
222
|
end
|
222
|
-
|