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
@@ -4,8 +4,8 @@ module Autoproj
|
|
4
4
|
class YumManager < ShellScriptManager
|
5
5
|
def initialize(ws)
|
6
6
|
super(ws, true,
|
7
|
-
%w
|
8
|
-
%w
|
7
|
+
%w[yum install],
|
8
|
+
%w[yum install -y])
|
9
9
|
end
|
10
10
|
|
11
11
|
def filter_uptodate_packages(packages)
|
@@ -17,15 +17,17 @@ module Autoproj
|
|
17
17
|
line = line.strip
|
18
18
|
if line =~ /package (.*) is not installed/
|
19
19
|
package_name = $1
|
20
|
-
|
20
|
+
unless packages.include?(package_name) # something is wrong, fallback to installing everything
|
21
21
|
return packages
|
22
22
|
end
|
23
|
+
|
23
24
|
new_packages << package_name
|
24
|
-
else
|
25
|
+
else
|
25
26
|
package_name = line.strip
|
26
|
-
|
27
|
+
unless packages.include?(package_name) # something is wrong, fallback to installing everything
|
27
28
|
return packages
|
28
29
|
end
|
30
|
+
|
29
31
|
installed_packages << package_name
|
30
32
|
end
|
31
33
|
end
|
@@ -33,21 +35,17 @@ module Autoproj
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def install(packages, filter_uptodate_packages: false, install_only: false)
|
36
|
-
if filter_uptodate_packages
|
37
|
-
packages = filter_uptodate_packages(packages)
|
38
|
-
end
|
38
|
+
packages = filter_uptodate_packages(packages) if filter_uptodate_packages
|
39
39
|
|
40
40
|
patterns, packages = packages.partition { |pkg| pkg =~ /^@/ }
|
41
41
|
patterns = patterns.map { |str| str[1..-1] }
|
42
42
|
result = false
|
43
|
-
|
43
|
+
unless patterns.empty?
|
44
44
|
result |= super(patterns,
|
45
|
-
auto_install_cmd: %w
|
46
|
-
user_install_cmd: %w
|
47
|
-
end
|
48
|
-
if !packages.empty?
|
49
|
-
result |= super(packages)
|
45
|
+
auto_install_cmd: %w[yum groupinstall -y],
|
46
|
+
user_install_cmd: %w[yum groupinstall])
|
50
47
|
end
|
48
|
+
result |= super(packages) unless packages.empty?
|
51
49
|
if result
|
52
50
|
# Invalidate caching of installed packages, as we just
|
53
51
|
# installed new packages !
|
@@ -57,4 +55,3 @@ module Autoproj
|
|
57
55
|
end
|
58
56
|
end
|
59
57
|
end
|
60
|
-
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module Autoproj
|
2
2
|
module PackageManagers
|
3
|
-
#Package manger for OpenSuse and Suse (untested)
|
3
|
+
# Package manger for OpenSuse and Suse (untested)
|
4
4
|
class ZypperManager < ShellScriptManager
|
5
5
|
def initialize(ws)
|
6
6
|
super(ws, true,
|
7
|
-
%w
|
8
|
-
%w
|
7
|
+
%w[zypper install],
|
8
|
+
%w[zypper -n install])
|
9
9
|
end
|
10
10
|
|
11
11
|
def filter_uptodate_packages(packages)
|
12
12
|
`LANG=C rpm -q --whatprovides '#{packages.join("' '")}'`
|
13
13
|
has_all_pkgs = $?.success?
|
14
14
|
|
15
|
-
if
|
16
|
-
|
17
|
-
else
|
18
|
-
|
15
|
+
if has_all_pkgs
|
16
|
+
[]
|
17
|
+
else
|
18
|
+
packages # let zypper filter, we need root now anyways
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -27,14 +27,12 @@ module Autoproj
|
|
27
27
|
patterns, packages = packages.partition { |pkg| pkg =~ /^@/ }
|
28
28
|
patterns = patterns.map { |str| str[1..-1] }
|
29
29
|
result = false
|
30
|
-
|
30
|
+
unless patterns.empty?
|
31
31
|
result |= super(patterns,
|
32
|
-
auto_install_cmd: %w
|
33
|
-
user_install_cmd: %w
|
34
|
-
end
|
35
|
-
if !packages.empty?
|
36
|
-
result |= super(packages)
|
32
|
+
auto_install_cmd: %w[zypper --non-interactive install --type pattern],
|
33
|
+
user_install_cmd: %w[zypper install --type pattern])
|
37
34
|
end
|
35
|
+
result |= super(packages) unless packages.empty?
|
38
36
|
if result
|
39
37
|
# Invalidate caching of installed packages, as we just
|
40
38
|
# installed new packages !
|
@@ -44,4 +42,3 @@ module Autoproj
|
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
47
|
-
|
@@ -31,13 +31,13 @@ module Autoproj
|
|
31
31
|
# @return [PackageManifest]
|
32
32
|
# @see load
|
33
33
|
def self.parse(package, contents,
|
34
|
-
|
34
|
+
path: "<loaded from string>", loader_class: Loader)
|
35
35
|
manifest = PackageManifest.new(package, path)
|
36
36
|
loader = loader_class.new(path, manifest)
|
37
37
|
begin
|
38
38
|
REXML::Document.parse_stream(contents, loader)
|
39
39
|
rescue REXML::ParseException => e
|
40
|
-
raise Autobuild::PackageException.new(package.name,
|
40
|
+
raise Autobuild::PackageException.new(package.name, "prepare"),
|
41
41
|
"invalid #{file}: #{e.message}"
|
42
42
|
end
|
43
43
|
manifest
|
@@ -185,52 +185,53 @@ module Autoproj
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def parse_depend_tag(tag_name, attributes, modes: [], optional: false)
|
188
|
-
package = attributes[
|
188
|
+
package = attributes["package"] || attributes["name"]
|
189
189
|
unless package
|
190
190
|
raise InvalidPackageManifest,
|
191
191
|
"found '#{tag_name}' tag in #{path} "\
|
192
192
|
"without a 'package' attribute"
|
193
193
|
end
|
194
194
|
|
195
|
-
if (tag_modes = attributes[
|
196
|
-
modes += tag_modes.split(
|
195
|
+
if (tag_modes = attributes["modes"])
|
196
|
+
modes += tag_modes.split(",")
|
197
197
|
end
|
198
198
|
|
199
199
|
manifest.add_dependency(
|
200
200
|
package,
|
201
|
-
optional: optional || (attributes[
|
202
|
-
modes: modes
|
201
|
+
optional: optional || (attributes["optional"] == "1"),
|
202
|
+
modes: modes
|
203
|
+
)
|
203
204
|
end
|
204
205
|
|
205
206
|
def parse_contact_field(text)
|
206
|
-
text.strip.split(
|
207
|
-
name, email = str.split(
|
207
|
+
text.strip.split(",").map do |str|
|
208
|
+
name, email = str.split("/").map(&:strip)
|
208
209
|
email = nil if email&.empty?
|
209
210
|
ContactInfo.new(name, email)
|
210
211
|
end
|
211
212
|
end
|
212
213
|
|
213
|
-
TEXT_FIELDS = Set[
|
214
|
-
AUTHOR_FIELDS = Set[
|
214
|
+
TEXT_FIELDS = Set["url", "license", "version", "description"]
|
215
|
+
AUTHOR_FIELDS = Set["author", "maintainer", "rock_maintainer"]
|
215
216
|
|
216
217
|
def toplevel_tag_start(name, attributes)
|
217
|
-
if name ==
|
218
|
+
if name == "depend"
|
218
219
|
parse_depend_tag(name, attributes)
|
219
|
-
elsif name ==
|
220
|
+
elsif name == "depend_optional"
|
220
221
|
parse_depend_tag(name, attributes, optional: true)
|
221
|
-
elsif name ==
|
222
|
+
elsif name == "rosdep"
|
222
223
|
parse_depend_tag(name, attributes)
|
223
224
|
elsif name =~ /^(\w+)_depend$/
|
224
225
|
parse_depend_tag(name, attributes, modes: [$1])
|
225
|
-
elsif name ==
|
226
|
-
if (brief = attributes[
|
226
|
+
elsif name == "description"
|
227
|
+
if (brief = attributes["brief"])
|
227
228
|
manifest.brief_description = brief
|
228
229
|
end
|
229
|
-
@tag_text =
|
230
|
+
@tag_text = ""
|
230
231
|
elsif TEXT_FIELDS.include?(name) || AUTHOR_FIELDS.include?(name)
|
231
|
-
@tag_text =
|
232
|
-
elsif name ==
|
233
|
-
@tag_text =
|
232
|
+
@tag_text = ""
|
233
|
+
elsif name == "tags"
|
234
|
+
@tag_text = ""
|
234
235
|
else
|
235
236
|
@tag_text = nil
|
236
237
|
end
|
@@ -242,8 +243,8 @@ module Autoproj
|
|
242
243
|
elsif TEXT_FIELDS.include?(name)
|
243
244
|
field = @tag_text.strip
|
244
245
|
manifest.send("#{name}=", field) unless field.empty?
|
245
|
-
elsif name ==
|
246
|
-
manifest.tags.concat(@tag_text.strip.split(
|
246
|
+
elsif name == "tags"
|
247
|
+
manifest.tags.concat(@tag_text.strip.split(",").map(&:strip))
|
247
248
|
end
|
248
249
|
@tag_text = nil
|
249
250
|
end
|
@@ -261,12 +262,12 @@ module Autoproj
|
|
261
262
|
|
262
263
|
def toplevel_tag_start(name, attributes)
|
263
264
|
if DEPEND_TAGS.include?(name)
|
264
|
-
@tag_text =
|
265
|
+
@tag_text = ""
|
265
266
|
elsif TEXT_FIELDS.include?(name)
|
266
|
-
@tag_text =
|
267
|
+
@tag_text = ""
|
267
268
|
elsif AUTHOR_FIELDS.include?(name)
|
268
|
-
@author_email = attributes[
|
269
|
-
@tag_text =
|
269
|
+
@author_email = attributes["email"]
|
270
|
+
@tag_text = ""
|
270
271
|
else
|
271
272
|
@tag_text = nil
|
272
273
|
end
|
@@ -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
|
-
|