autoproj 2.12.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 +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +2 -2
- data/bin/autoproj_bootstrap +186 -183
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +185 -182
- 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 +61 -44
- 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 +27 -27
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +18 -10
- data/lib/autoproj/cli/cache.rb +51 -8
- 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 +18 -13
- 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 +48 -55
- 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 +104 -51
- 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 -85
- 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 +145 -135
- 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 +64 -53
- data/lib/autoproj/ops/cached_env.rb +7 -6
- data/lib/autoproj/ops/configuration.rb +511 -506
- data/lib/autoproj/ops/import.rb +90 -61
- data/lib/autoproj/ops/install.rb +179 -175
- 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 +46 -31
- data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
- 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 +37 -27
- 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 +66 -36
- 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 +66 -53
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +128 -114
- data/lib/autoproj/python.rb +285 -0
- 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 +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 +162 -117
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +62 -72
- data/.travis.yml +0 -22
@@ -5,50 +5,56 @@ module Autoproj
|
|
5
5
|
class ShellScriptManager < Manager
|
6
6
|
def self.execute(command_line, with_locking, with_root, env: Autobuild.env)
|
7
7
|
if with_locking
|
8
|
-
File.open(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return execute(command_line, false, with_root, env: env)
|
15
|
-
ensure
|
16
|
-
lock_io.flock(File::LOCK_UN)
|
8
|
+
File.open("/tmp/autoproj_osdeps_lock", "w") do |lock_io|
|
9
|
+
until lock_io.flock(File::LOCK_EX | File::LOCK_NB)
|
10
|
+
Autoproj.message " waiting for other autoproj "\
|
11
|
+
"instances to finish their osdeps "\
|
12
|
+
"installation"
|
13
|
+
sleep 5
|
17
14
|
end
|
15
|
+
return execute(command_line, false, with_root, env: env)
|
16
|
+
ensure
|
17
|
+
lock_io.flock(File::LOCK_UN)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
if with_root
|
22
|
-
sudo = Autobuild.tool_in_path(
|
22
|
+
sudo = Autobuild.tool_in_path("sudo", env: env)
|
23
23
|
command_line = [sudo, *command_line]
|
24
24
|
end
|
25
25
|
|
26
|
-
Autobuild::Subprocess.run
|
26
|
+
Autobuild::Subprocess.run "autoproj", "osdeps", *command_line
|
27
27
|
end
|
28
28
|
|
29
29
|
# Overrides the {#needs_locking?} flag
|
30
30
|
attr_writer :needs_locking
|
31
|
+
|
31
32
|
# Whether two autoproj instances can run this package manager at the
|
32
33
|
# same time
|
33
34
|
#
|
34
35
|
# This declares if this package manager cannot be used concurrently.
|
35
36
|
# If it is the case, autoproj will ensure that there is no two
|
36
37
|
# autoproj instances running this package manager at the same time
|
37
|
-
#
|
38
|
+
#
|
38
39
|
# @return [Boolean]
|
39
40
|
# @see needs_locking=
|
40
|
-
def needs_locking
|
41
|
+
def needs_locking?
|
42
|
+
@needs_locking
|
43
|
+
end
|
41
44
|
|
42
45
|
# Overrides the {#needs_root?} flag
|
43
46
|
attr_writer :needs_root
|
47
|
+
|
44
48
|
# Whether this package manager needs root access.
|
45
49
|
#
|
46
50
|
# This declares if the command line(s) for this package manager
|
47
51
|
# should be started as root. Root access is provided using sudo
|
48
|
-
#
|
52
|
+
#
|
49
53
|
# @return [Boolean]
|
50
54
|
# @see needs_root=
|
51
|
-
def needs_root
|
55
|
+
def needs_root?
|
56
|
+
@needs_root
|
57
|
+
end
|
52
58
|
|
53
59
|
# Command line used by autoproj to install packages
|
54
60
|
#
|
@@ -83,10 +89,13 @@ module Autoproj
|
|
83
89
|
# itself, see {#auto_install_cmd}.
|
84
90
|
# @param [Boolean] needs_root if the command lines should be started
|
85
91
|
# as root or not. See {#needs_root?}
|
86
|
-
def initialize(ws, needs_locking, user_install_cmd,
|
92
|
+
def initialize(ws, needs_locking, user_install_cmd,
|
93
|
+
auto_install_cmd, needs_root = true)
|
87
94
|
super(ws)
|
88
|
-
@needs_locking
|
89
|
-
|
95
|
+
@needs_locking = needs_locking
|
96
|
+
@user_install_cmd = user_install_cmd
|
97
|
+
@auto_install_cmd = auto_install_cmd
|
98
|
+
@needs_root = needs_root
|
90
99
|
end
|
91
100
|
|
92
101
|
# Generate the shell script that would allow the user to install
|
@@ -98,10 +107,12 @@ module Autoproj
|
|
98
107
|
# command-line pattern that should be used to generate the script.
|
99
108
|
# If given, it overrides the default value stored in
|
100
109
|
# {#user_install_cmd]
|
101
|
-
def generate_user_os_script(os_packages,
|
110
|
+
def generate_user_os_script(os_packages,
|
111
|
+
user_install_cmd: self.user_install_cmd)
|
102
112
|
if user_install_cmd
|
103
|
-
user_install_cmd
|
104
|
-
else
|
113
|
+
generate_script(user_install_cmd, os_packages)
|
114
|
+
else
|
115
|
+
generate_auto_os_script(os_packages)
|
105
116
|
end
|
106
117
|
end
|
107
118
|
|
@@ -114,8 +125,16 @@ module Autoproj
|
|
114
125
|
# command-line pattern that should be used to generate the script.
|
115
126
|
# If given, it overrides the default value stored in
|
116
127
|
# {#auto_install_cmd]
|
117
|
-
def generate_auto_os_script(os_packages,
|
118
|
-
auto_install_cmd
|
128
|
+
def generate_auto_os_script(os_packages,
|
129
|
+
auto_install_cmd: self.auto_install_cmd)
|
130
|
+
generate_script(auto_install_cmd, os_packages)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Helper for {#generate_user_os_script} and {#generate_auto_os_script}
|
134
|
+
def generate_script(cmd, args)
|
135
|
+
cmd = cmd.join(" ")
|
136
|
+
args = args.join("' '")
|
137
|
+
"#{cmd} #{args}"
|
119
138
|
end
|
120
139
|
|
121
140
|
# Handles interaction with the user
|
@@ -139,9 +158,11 @@ module Autoproj
|
|
139
158
|
# anyway, do so now
|
140
159
|
puts <<-EOMSG
|
141
160
|
|
142
|
-
#{Autoproj.color(
|
143
|
-
#{Autoproj.color(
|
144
|
-
#{
|
161
|
+
#{Autoproj.color('The build process and/or the packages require some other software to be installed', :bold)}
|
162
|
+
#{Autoproj.color('and you required autoproj to not install them itself', :bold)}
|
163
|
+
#{unless respond_to?(:filter_uptodate_packages)
|
164
|
+
Autoproj.color('\nIf these packages are already installed, simply ignore this message\n', :red)
|
165
|
+
end}
|
145
166
|
The following packages are available as OS dependencies, i.e. as prebuilt
|
146
167
|
packages provided by your distribution / operating system. You will have to
|
147
168
|
install them manually if they are not already installed
|
@@ -152,8 +173,8 @@ module Autoproj
|
|
152
173
|
|
153
174
|
#{shell_script.split("\n").join("\n| ")}
|
154
175
|
|
155
|
-
|
156
|
-
print " #{Autoproj.color(
|
176
|
+
EOMSG
|
177
|
+
print " #{Autoproj.color('Press ENTER to continue ', :bold)}"
|
157
178
|
STDOUT.flush
|
158
179
|
STDIN.readline
|
159
180
|
puts
|
@@ -172,23 +193,33 @@ module Autoproj
|
|
172
193
|
# packages. See the option in {#generate_auto_os_script}
|
173
194
|
# @return [Boolean] true if packages got installed, false otherwise
|
174
195
|
def install(packages, filter_uptodate_packages: false, install_only: false,
|
175
|
-
|
196
|
+
auto_install_cmd: self.auto_install_cmd,
|
197
|
+
user_install_cmd: self.user_install_cmd)
|
176
198
|
return if packages.empty?
|
177
199
|
|
178
200
|
handled_os = ws.supported_operating_system?
|
179
201
|
if handled_os
|
180
|
-
shell_script = generate_auto_os_script(
|
181
|
-
|
202
|
+
shell_script = generate_auto_os_script(
|
203
|
+
packages, auto_install_cmd: auto_install_cmd
|
204
|
+
)
|
205
|
+
user_shell_script = generate_user_os_script(
|
206
|
+
packages, user_install_cmd: user_install_cmd
|
207
|
+
)
|
182
208
|
end
|
183
209
|
if osdeps_interaction(packages, user_shell_script)
|
184
|
-
Autoproj.message " installing OS packages:
|
210
|
+
Autoproj.message " installing OS packages: "\
|
211
|
+
"#{packages.sort.join(', ')}"
|
185
212
|
|
186
213
|
if Autoproj.verbose
|
187
|
-
Autoproj.message "Generating installation script for
|
214
|
+
Autoproj.message "Generating installation script for "\
|
215
|
+
"non-ruby OS dependencies"
|
188
216
|
Autoproj.message shell_script
|
189
217
|
end
|
190
218
|
|
191
|
-
ShellScriptManager.execute(
|
219
|
+
ShellScriptManager.execute(
|
220
|
+
[*auto_install_cmd, *packages], needs_locking?,
|
221
|
+
needs_root?, env: ws.env
|
222
|
+
)
|
192
223
|
return true
|
193
224
|
end
|
194
225
|
false
|
@@ -196,4 +227,3 @@ module Autoproj
|
|
196
227
|
end
|
197
228
|
end
|
198
229
|
end
|
199
|
-
|
@@ -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
|
-
|
@@ -30,13 +30,15 @@ module Autoproj
|
|
30
30
|
# @param [Boolean] ros_manifest whether the file follows the ROS format
|
31
31
|
# @return [PackageManifest]
|
32
32
|
# @see load
|
33
|
-
def self.parse(package, contents,
|
33
|
+
def self.parse(package, contents,
|
34
|
+
path: "<loaded from string>", loader_class: Loader)
|
34
35
|
manifest = PackageManifest.new(package, path)
|
35
36
|
loader = loader_class.new(path, manifest)
|
36
37
|
begin
|
37
38
|
REXML::Document.parse_stream(contents, loader)
|
38
39
|
rescue REXML::ParseException => e
|
39
|
-
raise Autobuild::PackageException.new(package.name,
|
40
|
+
raise Autobuild::PackageException.new(package.name, "prepare"),
|
41
|
+
"invalid #{file}: #{e.message}"
|
40
42
|
end
|
41
43
|
manifest
|
42
44
|
end
|
@@ -45,7 +47,7 @@ module Autoproj
|
|
45
47
|
Dependency = Struct.new :name, :optional, :modes
|
46
48
|
|
47
49
|
# The Autobuild::Package instance this manifest applies on
|
48
|
-
|
50
|
+
attr_accessor :package
|
49
51
|
attr_reader :path
|
50
52
|
attr_accessor :description
|
51
53
|
attr_accessor :brief_description
|
@@ -64,7 +66,7 @@ module Autoproj
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def has_documentation?
|
67
|
-
|
69
|
+
description
|
68
70
|
end
|
69
71
|
|
70
72
|
def documentation
|
@@ -72,7 +74,7 @@ module Autoproj
|
|
72
74
|
end
|
73
75
|
|
74
76
|
def has_short_documentation?
|
75
|
-
|
77
|
+
brief_description
|
76
78
|
end
|
77
79
|
|
78
80
|
def short_documentation
|
@@ -95,11 +97,12 @@ module Autoproj
|
|
95
97
|
# Whether this is a null manifest (used for packages that have actually
|
96
98
|
# no manifest) or not
|
97
99
|
def null?
|
98
|
-
|
100
|
+
@null
|
99
101
|
end
|
100
102
|
|
101
|
-
def each_dependency(in_modes =
|
102
|
-
return enum_for(__method__, in_modes)
|
103
|
+
def each_dependency(in_modes = [])
|
104
|
+
return enum_for(__method__, in_modes) unless block_given?
|
105
|
+
|
103
106
|
dependencies.each do |dep|
|
104
107
|
if dep.modes.empty? || in_modes.any? { |m| dep.modes.include?(m) }
|
105
108
|
yield(dep.name, dep.optional)
|
@@ -108,24 +111,28 @@ module Autoproj
|
|
108
111
|
end
|
109
112
|
|
110
113
|
def each_os_dependency(modes = Array.new, &block)
|
111
|
-
Autoproj.warn_deprecated "#{self.class}##{__method__}",
|
112
|
-
|
114
|
+
Autoproj.warn_deprecated "#{self.class}##{__method__}",
|
115
|
+
"call #each_dependency instead"
|
116
|
+
each_dependency(modes, &block)
|
113
117
|
end
|
114
118
|
|
115
119
|
def each_package_dependency(modes = Array.new, &block)
|
116
|
-
Autoproj.warn_deprecated "#{self.class}##{__method__}",
|
117
|
-
|
120
|
+
Autoproj.warn_deprecated "#{self.class}##{__method__}",
|
121
|
+
"call #each_dependency instead"
|
122
|
+
each_dependency(modes, &block)
|
118
123
|
end
|
119
124
|
|
120
125
|
def each_rock_maintainer
|
121
|
-
return enum_for(__method__)
|
126
|
+
return enum_for(__method__) unless block_given?
|
127
|
+
|
122
128
|
rock_maintainers.each do |m|
|
123
129
|
yield(m.name, m.email)
|
124
130
|
end
|
125
131
|
end
|
126
132
|
|
127
133
|
def each_maintainer
|
128
|
-
return enum_for(__method__)
|
134
|
+
return enum_for(__method__) unless block_given?
|
135
|
+
|
129
136
|
maintainers.each do |m|
|
130
137
|
yield(m.name, m.email)
|
131
138
|
end
|
@@ -134,7 +141,8 @@ module Autoproj
|
|
134
141
|
# Enumerates the name and email of each author. If no email is present,
|
135
142
|
# yields (name, nil)
|
136
143
|
def each_author
|
137
|
-
return enum_for(__method__)
|
144
|
+
return enum_for(__method__) unless block_given?
|
145
|
+
|
138
146
|
authors.each do |m|
|
139
147
|
yield(m.name, m.email)
|
140
148
|
end
|
@@ -177,64 +185,66 @@ module Autoproj
|
|
177
185
|
end
|
178
186
|
|
179
187
|
def parse_depend_tag(tag_name, attributes, modes: [], optional: false)
|
180
|
-
package = attributes[
|
181
|
-
|
182
|
-
raise InvalidPackageManifest,
|
188
|
+
package = attributes["package"] || attributes["name"]
|
189
|
+
unless package
|
190
|
+
raise InvalidPackageManifest,
|
191
|
+
"found '#{tag_name}' tag in #{path} "\
|
192
|
+
"without a 'package' attribute"
|
183
193
|
end
|
184
194
|
|
185
|
-
if tag_modes = attributes[
|
186
|
-
modes += tag_modes.split(
|
195
|
+
if (tag_modes = attributes["modes"])
|
196
|
+
modes += tag_modes.split(",")
|
187
197
|
end
|
188
198
|
|
189
199
|
manifest.add_dependency(
|
190
200
|
package,
|
191
|
-
optional: optional || (attributes[
|
192
|
-
modes: modes
|
201
|
+
optional: optional || (attributes["optional"] == "1"),
|
202
|
+
modes: modes
|
203
|
+
)
|
193
204
|
end
|
194
205
|
|
195
206
|
def parse_contact_field(text)
|
196
|
-
text.strip.split(
|
197
|
-
name, email = str.split(
|
198
|
-
email = nil if email
|
207
|
+
text.strip.split(",").map do |str|
|
208
|
+
name, email = str.split("/").map(&:strip)
|
209
|
+
email = nil if email&.empty?
|
199
210
|
ContactInfo.new(name, email)
|
200
211
|
end
|
201
212
|
end
|
202
213
|
|
203
|
-
TEXT_FIELDS = Set[
|
204
|
-
AUTHOR_FIELDS = Set[
|
214
|
+
TEXT_FIELDS = Set["url", "license", "version", "description"]
|
215
|
+
AUTHOR_FIELDS = Set["author", "maintainer", "rock_maintainer"]
|
205
216
|
|
206
217
|
def toplevel_tag_start(name, attributes)
|
207
|
-
if name ==
|
218
|
+
if name == "depend"
|
208
219
|
parse_depend_tag(name, attributes)
|
209
|
-
elsif name ==
|
220
|
+
elsif name == "depend_optional"
|
210
221
|
parse_depend_tag(name, attributes, optional: true)
|
211
|
-
elsif name ==
|
222
|
+
elsif name == "rosdep"
|
212
223
|
parse_depend_tag(name, attributes)
|
213
224
|
elsif name =~ /^(\w+)_depend$/
|
214
225
|
parse_depend_tag(name, attributes, modes: [$1])
|
215
|
-
elsif name ==
|
216
|
-
if brief = attributes[
|
226
|
+
elsif name == "description"
|
227
|
+
if (brief = attributes["brief"])
|
217
228
|
manifest.brief_description = brief
|
218
229
|
end
|
219
|
-
@tag_text =
|
230
|
+
@tag_text = ""
|
220
231
|
elsif TEXT_FIELDS.include?(name) || AUTHOR_FIELDS.include?(name)
|
221
|
-
@tag_text =
|
222
|
-
elsif name ==
|
223
|
-
@tag_text =
|
232
|
+
@tag_text = ""
|
233
|
+
elsif name == "tags"
|
234
|
+
@tag_text = ""
|
224
235
|
else
|
225
236
|
@tag_text = nil
|
226
237
|
end
|
227
238
|
end
|
239
|
+
|
228
240
|
def toplevel_tag_end(name)
|
229
241
|
if AUTHOR_FIELDS.include?(name)
|
230
242
|
manifest.send("#{name}s").concat(parse_contact_field(@tag_text))
|
231
243
|
elsif TEXT_FIELDS.include?(name)
|
232
244
|
field = @tag_text.strip
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
elsif name == 'tags'
|
237
|
-
manifest.tags.concat(@tag_text.strip.split(',').map(&:strip))
|
245
|
+
manifest.send("#{name}=", field) unless field.empty?
|
246
|
+
elsif name == "tags"
|
247
|
+
manifest.tags.concat(@tag_text.strip.split(",").map(&:strip))
|
238
248
|
end
|
239
249
|
@tag_text = nil
|
240
250
|
end
|
@@ -245,19 +255,19 @@ module Autoproj
|
|
245
255
|
# REXML stream parser object used to load the XML contents into a
|
246
256
|
# {PackageManifest} object
|
247
257
|
class RosLoader < Loader
|
248
|
-
SUPPORTED_MODES = [
|
249
|
-
DEPEND_TAGS =
|
250
|
-
|
251
|
-
|
258
|
+
SUPPORTED_MODES = %w[test doc].freeze
|
259
|
+
DEPEND_TAGS = %w[depend build_depend build_export_depend
|
260
|
+
buildtool_depend buildtool_export_depend
|
261
|
+
exec_depend test_depend run_depend doc_depend].to_set.freeze
|
252
262
|
|
253
263
|
def toplevel_tag_start(name, attributes)
|
254
264
|
if DEPEND_TAGS.include?(name)
|
255
|
-
@tag_text =
|
265
|
+
@tag_text = ""
|
256
266
|
elsif TEXT_FIELDS.include?(name)
|
257
|
-
@tag_text =
|
267
|
+
@tag_text = ""
|
258
268
|
elsif AUTHOR_FIELDS.include?(name)
|
259
|
-
@author_email = attributes[
|
260
|
-
@tag_text =
|
269
|
+
@author_email = attributes["email"]
|
270
|
+
@tag_text = ""
|
261
271
|
else
|
262
272
|
@tag_text = nil
|
263
273
|
end
|
@@ -265,18 +275,21 @@ module Autoproj
|
|
265
275
|
|
266
276
|
def toplevel_tag_end(name)
|
267
277
|
if DEPEND_TAGS.include?(name)
|
268
|
-
|
278
|
+
if @tag_text.strip.empty?
|
279
|
+
raise InvalidPackageManifest, "found '#{name}' tag in #{path} "\
|
280
|
+
"without content"
|
281
|
+
end
|
269
282
|
|
270
283
|
mode = []
|
271
|
-
if
|
272
|
-
mode = SUPPORTED_MODES & [
|
284
|
+
if (m = /^(\w+)_depend$/.match(name))
|
285
|
+
mode = SUPPORTED_MODES & [m[1]]
|
273
286
|
end
|
274
287
|
|
275
288
|
manifest.add_dependency(@tag_text, modes: mode)
|
276
289
|
elsif AUTHOR_FIELDS.include?(name)
|
277
290
|
author_name = @tag_text.strip
|
278
291
|
email = @author_email ? @author_email.strip : nil
|
279
|
-
email = nil if email
|
292
|
+
email = nil if email&.empty?
|
280
293
|
contact = ContactInfo.new(author_name, email)
|
281
294
|
manifest.send("#{name}s").concat([contact])
|
282
295
|
elsif TEXT_FIELDS.include?(name)
|