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
@@ -3,33 +3,43 @@ module Autoproj
|
|
3
3
|
# Base class for all package managers that simply require the call of a
|
4
4
|
# shell script to install packages (e.g. yum, apt, ...)
|
5
5
|
class ShellScriptManager < Manager
|
6
|
-
def self.execute(command_line, with_locking, with_root,
|
6
|
+
def self.execute(command_line, with_locking, with_root,
|
7
|
+
env: Autoproj.workspace.env, inherit: Set.new)
|
7
8
|
if with_locking
|
8
|
-
File.open(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
sleep 5
|
15
|
-
end
|
16
|
-
return execute(command_line, false, with_root, env: env)
|
17
|
-
ensure
|
18
|
-
lock_io.flock(File::LOCK_UN)
|
9
|
+
File.open("/tmp/autoproj_osdeps_lock", "w") do |lock_io|
|
10
|
+
until lock_io.flock(File::LOCK_EX | File::LOCK_NB)
|
11
|
+
Autoproj.message " waiting for other autoproj "\
|
12
|
+
"instances to finish their osdeps "\
|
13
|
+
"installation"
|
14
|
+
sleep 5
|
19
15
|
end
|
16
|
+
return execute(command_line, false, with_root,
|
17
|
+
env: env, inherit: inherit)
|
18
|
+
ensure
|
19
|
+
lock_io.flock(File::LOCK_UN)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
process_env = env
|
23
24
|
if with_root
|
24
|
-
|
25
|
-
|
25
|
+
process_env = Autobuild::Environment.new
|
26
|
+
process_env.isolate
|
27
|
+
process_env.add_path("PATH", "/usr/local/sbin",
|
28
|
+
"/usr/sbin", "/sbin")
|
29
|
+
|
30
|
+
inherit.each { |var| process_env.set(var, env[var]) }
|
31
|
+
sudo = Autobuild.tool_in_path("sudo", env: process_env)
|
32
|
+
command_line = [sudo, "--preserve-env", *command_line]
|
26
33
|
end
|
27
34
|
|
28
|
-
Autobuild::Subprocess.run
|
35
|
+
Autobuild::Subprocess.run "autoproj", "osdeps", *command_line,
|
36
|
+
env: process_env.resolved_env,
|
37
|
+
env_inherit: false
|
29
38
|
end
|
30
39
|
|
31
40
|
# Overrides the {#needs_locking?} flag
|
32
41
|
attr_writer :needs_locking
|
42
|
+
|
33
43
|
# Whether two autoproj instances can run this package manager at the
|
34
44
|
# same time
|
35
45
|
#
|
@@ -45,6 +55,7 @@ module Autoproj
|
|
45
55
|
|
46
56
|
# Overrides the {#needs_root?} flag
|
47
57
|
attr_writer :needs_root
|
58
|
+
|
48
59
|
# Whether this package manager needs root access.
|
49
60
|
#
|
50
61
|
# This declares if the command line(s) for this package manager
|
@@ -90,7 +101,7 @@ module Autoproj
|
|
90
101
|
# @param [Boolean] needs_root if the command lines should be started
|
91
102
|
# as root or not. See {#needs_root?}
|
92
103
|
def initialize(ws, needs_locking, user_install_cmd,
|
93
|
-
|
104
|
+
auto_install_cmd, needs_root = true)
|
94
105
|
super(ws)
|
95
106
|
@needs_locking = needs_locking
|
96
107
|
@user_install_cmd = user_install_cmd
|
@@ -108,10 +119,11 @@ module Autoproj
|
|
108
119
|
# If given, it overrides the default value stored in
|
109
120
|
# {#user_install_cmd]
|
110
121
|
def generate_user_os_script(os_packages,
|
111
|
-
|
122
|
+
user_install_cmd: self.user_install_cmd)
|
112
123
|
if user_install_cmd
|
113
|
-
user_install_cmd
|
114
|
-
else
|
124
|
+
generate_script(user_install_cmd, os_packages)
|
125
|
+
else
|
126
|
+
generate_auto_os_script(os_packages)
|
115
127
|
end
|
116
128
|
end
|
117
129
|
|
@@ -125,8 +137,15 @@ module Autoproj
|
|
125
137
|
# If given, it overrides the default value stored in
|
126
138
|
# {#auto_install_cmd]
|
127
139
|
def generate_auto_os_script(os_packages,
|
128
|
-
|
129
|
-
auto_install_cmd
|
140
|
+
auto_install_cmd: self.auto_install_cmd)
|
141
|
+
generate_script(auto_install_cmd, os_packages)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Helper for {#generate_user_os_script} and {#generate_auto_os_script}
|
145
|
+
def generate_script(cmd, args)
|
146
|
+
cmd = cmd.join(" ")
|
147
|
+
args = args.join("' '")
|
148
|
+
"#{cmd} #{args}"
|
130
149
|
end
|
131
150
|
|
132
151
|
# Handles interaction with the user
|
@@ -152,7 +171,9 @@ module Autoproj
|
|
152
171
|
|
153
172
|
#{Autoproj.color('The build process and/or the packages require some other software to be installed', :bold)}
|
154
173
|
#{Autoproj.color('and you required autoproj to not install them itself', :bold)}
|
155
|
-
#{
|
174
|
+
#{unless respond_to?(:filter_uptodate_packages)
|
175
|
+
Autoproj.color('\nIf these packages are already installed, simply ignore this message\n', :red)
|
176
|
+
end}
|
156
177
|
The following packages are available as OS dependencies, i.e. as prebuilt
|
157
178
|
packages provided by your distribution / operating system. You will have to
|
158
179
|
install them manually if they are not already installed
|
@@ -183,8 +204,9 @@ module Autoproj
|
|
183
204
|
# packages. See the option in {#generate_auto_os_script}
|
184
205
|
# @return [Boolean] true if packages got installed, false otherwise
|
185
206
|
def install(packages, filter_uptodate_packages: false, install_only: false,
|
186
|
-
|
187
|
-
|
207
|
+
auto_install_cmd: self.auto_install_cmd,
|
208
|
+
user_install_cmd: self.user_install_cmd,
|
209
|
+
inherit: Set.new)
|
188
210
|
return if packages.empty?
|
189
211
|
|
190
212
|
handled_os = ws.supported_operating_system?
|
@@ -208,7 +230,7 @@ module Autoproj
|
|
208
230
|
|
209
231
|
ShellScriptManager.execute(
|
210
232
|
[*auto_install_cmd, *packages], needs_locking?,
|
211
|
-
needs_root?, env: ws.env
|
233
|
+
needs_root?, env: ws.env, inherit: inherit
|
212
234
|
)
|
213
235
|
return true
|
214
236
|
end
|
@@ -10,8 +10,8 @@ module Autoproj
|
|
10
10
|
|
11
11
|
def osdeps_interaction_unknown_os(osdeps)
|
12
12
|
puts <<-EOMSG
|
13
|
-
#{Autoproj.color(
|
14
|
-
#{Autoproj.color(
|
13
|
+
#{Autoproj.color('The build process requires some other software packages to be installed on our operating system', :bold)}
|
14
|
+
#{Autoproj.color('If they are already installed, simply ignore this message', :red)}
|
15
15
|
|
16
16
|
#{osdeps.to_a.sort.join("\n ")}
|
17
17
|
|
@@ -25,18 +25,15 @@ module Autoproj
|
|
25
25
|
|
26
26
|
def install(osdeps)
|
27
27
|
if silent?
|
28
|
-
|
28
|
+
false
|
29
29
|
else
|
30
30
|
osdeps = osdeps.to_set
|
31
31
|
osdeps -= @installed_osdeps
|
32
|
-
|
33
|
-
result = osdeps_interaction_unknown_os(osdeps)
|
34
|
-
end
|
32
|
+
result = osdeps_interaction_unknown_os(osdeps) unless osdeps.empty?
|
35
33
|
@installed_osdeps |= osdeps
|
36
|
-
|
34
|
+
result
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
42
|
-
|
@@ -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
|
-
|
@@ -17,7 +17,7 @@ module Autoproj
|
|
17
17
|
# @return [PackageManifest]
|
18
18
|
# @see parse
|
19
19
|
def self.load(package, file, ros_manifest: false)
|
20
|
-
loader_class = ros_manifest ?
|
20
|
+
loader_class = ros_manifest ? RosPackageManifest::Loader : Loader
|
21
21
|
parse(package, File.read(file), path: file, loader_class: loader_class)
|
22
22
|
end
|
23
23
|
|
@@ -31,13 +31,13 @@ module Autoproj
|
|
31
31
|
# @return [PackageManifest]
|
32
32
|
# @see load
|
33
33
|
def self.parse(package, contents,
|
34
|
-
|
35
|
-
manifest =
|
34
|
+
path: "<loaded from string>", loader_class: Loader)
|
35
|
+
manifest = loader_class::MANIFEST_CLASS.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
|
@@ -167,6 +167,7 @@ module Autoproj
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def text(text)
|
170
|
+
@tag_text = @tag_text.dup
|
170
171
|
@tag_text << text if @tag_text
|
171
172
|
end
|
172
173
|
end
|
@@ -178,6 +179,8 @@ module Autoproj
|
|
178
179
|
class Loader < BaseLoader
|
179
180
|
attr_reader :path, :manifest
|
180
181
|
|
182
|
+
MANIFEST_CLASS = PackageManifest
|
183
|
+
|
181
184
|
def initialize(path, manifest)
|
182
185
|
super()
|
183
186
|
@path = path
|
@@ -185,52 +188,53 @@ module Autoproj
|
|
185
188
|
end
|
186
189
|
|
187
190
|
def parse_depend_tag(tag_name, attributes, modes: [], optional: false)
|
188
|
-
package = attributes[
|
191
|
+
package = attributes["package"] || attributes["name"]
|
189
192
|
unless package
|
190
193
|
raise InvalidPackageManifest,
|
191
194
|
"found '#{tag_name}' tag in #{path} "\
|
192
195
|
"without a 'package' attribute"
|
193
196
|
end
|
194
197
|
|
195
|
-
if (tag_modes = attributes[
|
196
|
-
modes += tag_modes.split(
|
198
|
+
if (tag_modes = attributes["modes"])
|
199
|
+
modes += tag_modes.split(",")
|
197
200
|
end
|
198
201
|
|
199
202
|
manifest.add_dependency(
|
200
203
|
package,
|
201
|
-
optional: optional || (attributes[
|
202
|
-
modes: modes
|
204
|
+
optional: optional || (attributes["optional"] == "1"),
|
205
|
+
modes: modes
|
206
|
+
)
|
203
207
|
end
|
204
208
|
|
205
209
|
def parse_contact_field(text)
|
206
|
-
text.strip.split(
|
207
|
-
name, email = str.split(
|
210
|
+
text.strip.split(",").map do |str|
|
211
|
+
name, email = str.split("/").map(&:strip)
|
208
212
|
email = nil if email&.empty?
|
209
213
|
ContactInfo.new(name, email)
|
210
214
|
end
|
211
215
|
end
|
212
216
|
|
213
|
-
TEXT_FIELDS = Set[
|
214
|
-
AUTHOR_FIELDS = Set[
|
217
|
+
TEXT_FIELDS = Set["url", "license", "version", "description"]
|
218
|
+
AUTHOR_FIELDS = Set["author", "maintainer", "rock_maintainer"]
|
215
219
|
|
216
220
|
def toplevel_tag_start(name, attributes)
|
217
|
-
if name ==
|
221
|
+
if name == "depend"
|
218
222
|
parse_depend_tag(name, attributes)
|
219
|
-
elsif name ==
|
223
|
+
elsif name == "depend_optional"
|
220
224
|
parse_depend_tag(name, attributes, optional: true)
|
221
|
-
elsif name ==
|
225
|
+
elsif name == "rosdep"
|
222
226
|
parse_depend_tag(name, attributes)
|
223
227
|
elsif name =~ /^(\w+)_depend$/
|
224
228
|
parse_depend_tag(name, attributes, modes: [$1])
|
225
|
-
elsif name ==
|
226
|
-
if (brief = attributes[
|
229
|
+
elsif name == "description"
|
230
|
+
if (brief = attributes["brief"])
|
227
231
|
manifest.brief_description = brief
|
228
232
|
end
|
229
|
-
@tag_text =
|
233
|
+
@tag_text = ""
|
230
234
|
elsif TEXT_FIELDS.include?(name) || AUTHOR_FIELDS.include?(name)
|
231
|
-
@tag_text =
|
232
|
-
elsif name ==
|
233
|
-
@tag_text =
|
235
|
+
@tag_text = ""
|
236
|
+
elsif name == "tags"
|
237
|
+
@tag_text = ""
|
234
238
|
else
|
235
239
|
@tag_text = nil
|
236
240
|
end
|
@@ -242,58 +246,8 @@ module Autoproj
|
|
242
246
|
elsif TEXT_FIELDS.include?(name)
|
243
247
|
field = @tag_text.strip
|
244
248
|
manifest.send("#{name}=", field) unless field.empty?
|
245
|
-
elsif name ==
|
246
|
-
manifest.tags.concat(@tag_text.strip.split(
|
247
|
-
end
|
248
|
-
@tag_text = nil
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
# @api private
|
253
|
-
#
|
254
|
-
# REXML stream parser object used to load the XML contents into a
|
255
|
-
# {PackageManifest} object
|
256
|
-
class RosLoader < Loader
|
257
|
-
SUPPORTED_MODES = %w[test doc].freeze
|
258
|
-
DEPEND_TAGS = %w[depend build_depend build_export_depend
|
259
|
-
buildtool_depend buildtool_export_depend
|
260
|
-
exec_depend test_depend run_depend doc_depend].to_set.freeze
|
261
|
-
|
262
|
-
def toplevel_tag_start(name, attributes)
|
263
|
-
if DEPEND_TAGS.include?(name)
|
264
|
-
@tag_text = ''
|
265
|
-
elsif TEXT_FIELDS.include?(name)
|
266
|
-
@tag_text = ''
|
267
|
-
elsif AUTHOR_FIELDS.include?(name)
|
268
|
-
@author_email = attributes['email']
|
269
|
-
@tag_text = ''
|
270
|
-
else
|
271
|
-
@tag_text = nil
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
def toplevel_tag_end(name)
|
276
|
-
if DEPEND_TAGS.include?(name)
|
277
|
-
if @tag_text.strip.empty?
|
278
|
-
raise InvalidPackageManifest, "found '#{name}' tag in #{path} "\
|
279
|
-
"without content"
|
280
|
-
end
|
281
|
-
|
282
|
-
mode = []
|
283
|
-
if (m = /^(\w+)_depend$/.match(name))
|
284
|
-
mode = SUPPORTED_MODES & [m[1]]
|
285
|
-
end
|
286
|
-
|
287
|
-
manifest.add_dependency(@tag_text, modes: mode)
|
288
|
-
elsif AUTHOR_FIELDS.include?(name)
|
289
|
-
author_name = @tag_text.strip
|
290
|
-
email = @author_email ? @author_email.strip : nil
|
291
|
-
email = nil if email&.empty?
|
292
|
-
contact = ContactInfo.new(author_name, email)
|
293
|
-
manifest.send("#{name}s").concat([contact])
|
294
|
-
elsif TEXT_FIELDS.include?(name)
|
295
|
-
field = @tag_text.strip
|
296
|
-
manifest.send("#{name}=", field) unless field.empty?
|
249
|
+
elsif name == "tags"
|
250
|
+
manifest.tags.concat(@tag_text.strip.split(",").map(&:strip))
|
297
251
|
end
|
298
252
|
@tag_text = nil
|
299
253
|
end
|