autoproj 2.13.0 → 2.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +79 -91
  5. data/.rubocop_todo.yml +1473 -0
  6. data/Gemfile +9 -9
  7. data/Rakefile +24 -24
  8. data/autoproj.gemspec +24 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +5 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +3 -3
  14. data/bin/autoproj_bootstrap +224 -199
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +223 -198
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +9 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +64 -34
  22. data/lib/autoproj/autobuild_extensions/git.rb +27 -26
  23. data/lib/autoproj/autobuild_extensions/package.rb +23 -22
  24. data/lib/autoproj/autobuild_extensions/python.rb +18 -0
  25. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  26. data/lib/autoproj/base.rb +1 -1
  27. data/lib/autoproj/bash_completion.rb +5 -6
  28. data/lib/autoproj/build_option.rb +22 -24
  29. data/lib/autoproj/cli/base.rb +26 -26
  30. data/lib/autoproj/cli/bootstrap.rb +14 -16
  31. data/lib/autoproj/cli/build.rb +10 -7
  32. data/lib/autoproj/cli/cache.rb +11 -11
  33. data/lib/autoproj/cli/clean.rb +10 -10
  34. data/lib/autoproj/cli/commit.rb +7 -8
  35. data/lib/autoproj/cli/doc.rb +2 -2
  36. data/lib/autoproj/cli/envsh.rb +1 -2
  37. data/lib/autoproj/cli/exec.rb +60 -20
  38. data/lib/autoproj/cli/inspection_tool.rb +13 -7
  39. data/lib/autoproj/cli/locate.rb +30 -41
  40. data/lib/autoproj/cli/log.rb +7 -7
  41. data/lib/autoproj/cli/main.rb +213 -204
  42. data/lib/autoproj/cli/main_doc.rb +22 -21
  43. data/lib/autoproj/cli/main_global.rb +44 -19
  44. data/lib/autoproj/cli/main_plugin.rb +18 -18
  45. data/lib/autoproj/cli/main_test.rb +28 -27
  46. data/lib/autoproj/cli/manifest.rb +7 -7
  47. data/lib/autoproj/cli/osdeps.rb +12 -11
  48. data/lib/autoproj/cli/patcher.rb +2 -3
  49. data/lib/autoproj/cli/query.rb +17 -18
  50. data/lib/autoproj/cli/reconfigure.rb +1 -2
  51. data/lib/autoproj/cli/reset.rb +9 -12
  52. data/lib/autoproj/cli/show.rb +38 -39
  53. data/lib/autoproj/cli/status.rb +45 -39
  54. data/lib/autoproj/cli/switch_config.rb +5 -6
  55. data/lib/autoproj/cli/tag.rb +12 -11
  56. data/lib/autoproj/cli/test.rb +7 -7
  57. data/lib/autoproj/cli/update.rb +35 -37
  58. data/lib/autoproj/cli/utility.rb +11 -10
  59. data/lib/autoproj/cli/version.rb +42 -40
  60. data/lib/autoproj/cli/versions.rb +14 -15
  61. data/lib/autoproj/cli/watch.rb +33 -37
  62. data/lib/autoproj/cli/which.rb +16 -20
  63. data/lib/autoproj/cli.rb +4 -2
  64. data/lib/autoproj/configuration.rb +77 -85
  65. data/lib/autoproj/default.osdeps +18 -3
  66. data/lib/autoproj/environment.rb +42 -23
  67. data/lib/autoproj/exceptions.rb +9 -3
  68. data/lib/autoproj/find_workspace.rb +20 -25
  69. data/lib/autoproj/git_server_configuration.rb +40 -44
  70. data/lib/autoproj/gitorious.rb +1 -1
  71. data/lib/autoproj/installation_manifest.rb +64 -29
  72. data/lib/autoproj/local_package_set.rb +13 -11
  73. data/lib/autoproj/manifest.rb +137 -130
  74. data/lib/autoproj/metapackage.rb +2 -6
  75. data/lib/autoproj/ops/atomic_write.rb +7 -6
  76. data/lib/autoproj/ops/build.rb +4 -6
  77. data/lib/autoproj/ops/cache.rb +41 -43
  78. data/lib/autoproj/ops/cached_env.rb +5 -4
  79. data/lib/autoproj/ops/configuration.rb +525 -507
  80. data/lib/autoproj/ops/import.rb +76 -64
  81. data/lib/autoproj/ops/install.rb +217 -191
  82. data/lib/autoproj/ops/loader.rb +77 -76
  83. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  84. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  85. data/lib/autoproj/ops/snapshot.rb +250 -247
  86. data/lib/autoproj/ops/tools.rb +76 -78
  87. data/lib/autoproj/ops/watch.rb +6 -6
  88. data/lib/autoproj/ops/which.rb +17 -14
  89. data/lib/autoproj/options.rb +13 -2
  90. data/lib/autoproj/os_package_installer.rb +102 -92
  91. data/lib/autoproj/os_package_query.rb +7 -13
  92. data/lib/autoproj/os_package_resolver.rb +189 -140
  93. data/lib/autoproj/os_repository_installer.rb +4 -4
  94. data/lib/autoproj/os_repository_resolver.rb +8 -6
  95. data/lib/autoproj/package_definition.rb +12 -13
  96. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
  97. data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
  98. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  99. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  100. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  101. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  102. data/lib/autoproj/package_managers/manager.rb +8 -3
  103. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  104. data/lib/autoproj/package_managers/pip_manager.rb +30 -28
  105. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  106. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  107. data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
  108. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  109. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  110. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  111. data/lib/autoproj/package_manifest.rb +28 -74
  112. data/lib/autoproj/package_selection.rb +187 -187
  113. data/lib/autoproj/package_set.rb +144 -113
  114. data/lib/autoproj/python.rb +297 -0
  115. data/lib/autoproj/query_base.rb +20 -14
  116. data/lib/autoproj/reporter.rb +19 -19
  117. data/lib/autoproj/repository_managers/apt.rb +102 -68
  118. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  119. data/lib/autoproj/ros_condition_parser.rb +84 -0
  120. data/lib/autoproj/ros_package_manifest.rb +125 -0
  121. data/lib/autoproj/shell_completion.rb +16 -13
  122. data/lib/autoproj/source_package_query.rb +29 -36
  123. data/lib/autoproj/system.rb +32 -21
  124. data/lib/autoproj/test.rb +127 -104
  125. data/lib/autoproj/variable_expansion.rb +7 -9
  126. data/lib/autoproj/vcs_definition.rb +35 -32
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +142 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -55
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +80 -46
  133. data/.travis.yml +0 -24
@@ -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, env: Autobuild.env)
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('/tmp/autoproj_osdeps_lock', 'w') do |lock_io|
9
- begin
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
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
- sudo = Autobuild.tool_in_path('sudo', env: env)
25
- command_line = [sudo, *command_line]
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 'autoproj', 'osdeps', *command_line
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
- auto_install_cmd, needs_root = true)
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
- user_install_cmd: self.user_install_cmd)
122
+ user_install_cmd: self.user_install_cmd)
112
123
  if user_install_cmd
113
- user_install_cmd.join(" ") + " " + os_packages.join("' '")
114
- else generate_auto_os_script(os_packages)
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
- auto_install_cmd: self.auto_install_cmd)
129
- auto_install_cmd.join(" ") + " " + os_packages.join("' '")
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
- #{Autoproj.color('\nIf these packages are already installed, simply ignore this message\n', :red) unless respond_to?(:filter_uptodate_packages)}
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
- auto_install_cmd: self.auto_install_cmd,
187
- user_install_cmd: self.user_install_cmd)
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("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)}
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
- return false
28
+ false
29
29
  else
30
30
  osdeps = osdeps.to_set
31
31
  osdeps -= @installed_osdeps
32
- if !osdeps.empty?
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
- return result
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{yum install},
8
- %w{yum install -y})
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
- if !packages.include?(package_name) # something is wrong, fallback to installing everything
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
- if !packages.include?(package_name) # something is wrong, fallback to installing everything
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
- if !patterns.empty?
43
+ unless patterns.empty?
44
44
  result |= super(patterns,
45
- auto_install_cmd: %w{yum groupinstall -y},
46
- user_install_cmd: %w{yum groupinstall})
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{zypper install},
8
- %w{zypper -n install})
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 !has_all_pkgs
16
- return packages # let zypper filter, we need root now anyways
17
- else
18
- return []
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
- if !patterns.empty?
30
+ unless patterns.empty?
31
31
  result |= super(patterns,
32
- auto_install_cmd: %w{zypper --non-interactive install --type pattern},
33
- user_install_cmd: %w{zypper install --type pattern})
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 ? RosLoader : Loader
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
- path: '<loaded from string>', loader_class: Loader)
35
- manifest = PackageManifest.new(package, path)
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, 'prepare'),
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['package'] || attributes['name']
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['modes'])
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['optional'] == '1'),
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(',').map do |str|
207
- name, email = str.split('/').map(&:strip)
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['url', 'license', 'version', 'description']
214
- AUTHOR_FIELDS = Set['author', 'maintainer', 'rock_maintainer']
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 == 'depend'
221
+ if name == "depend"
218
222
  parse_depend_tag(name, attributes)
219
- elsif name == 'depend_optional'
223
+ elsif name == "depend_optional"
220
224
  parse_depend_tag(name, attributes, optional: true)
221
- elsif name == 'rosdep'
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 == 'description'
226
- if (brief = attributes['brief'])
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 == 'tags'
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 == 'tags'
246
- manifest.tags.concat(@tag_text.strip.split(',').map(&:strip))
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