autoproj 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) 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 +22 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +6 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +2 -2
  14. data/bin/autoproj_bootstrap +186 -183
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +185 -182
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +5 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +61 -44
  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/svn.rb +1 -2
  25. data/lib/autoproj/base.rb +1 -1
  26. data/lib/autoproj/bash_completion.rb +5 -6
  27. data/lib/autoproj/build_option.rb +22 -24
  28. data/lib/autoproj/cli/base.rb +27 -27
  29. data/lib/autoproj/cli/bootstrap.rb +14 -16
  30. data/lib/autoproj/cli/build.rb +18 -10
  31. data/lib/autoproj/cli/cache.rb +51 -8
  32. data/lib/autoproj/cli/clean.rb +10 -10
  33. data/lib/autoproj/cli/commit.rb +7 -8
  34. data/lib/autoproj/cli/doc.rb +2 -2
  35. data/lib/autoproj/cli/envsh.rb +1 -2
  36. data/lib/autoproj/cli/exec.rb +60 -20
  37. data/lib/autoproj/cli/inspection_tool.rb +18 -13
  38. data/lib/autoproj/cli/locate.rb +30 -41
  39. data/lib/autoproj/cli/log.rb +7 -7
  40. data/lib/autoproj/cli/main.rb +217 -205
  41. data/lib/autoproj/cli/main_doc.rb +22 -21
  42. data/lib/autoproj/cli/main_global.rb +44 -19
  43. data/lib/autoproj/cli/main_plugin.rb +18 -18
  44. data/lib/autoproj/cli/main_test.rb +28 -27
  45. data/lib/autoproj/cli/manifest.rb +7 -7
  46. data/lib/autoproj/cli/osdeps.rb +12 -11
  47. data/lib/autoproj/cli/patcher.rb +2 -3
  48. data/lib/autoproj/cli/query.rb +17 -18
  49. data/lib/autoproj/cli/reconfigure.rb +1 -2
  50. data/lib/autoproj/cli/reset.rb +9 -12
  51. data/lib/autoproj/cli/show.rb +48 -55
  52. data/lib/autoproj/cli/status.rb +56 -44
  53. data/lib/autoproj/cli/switch_config.rb +5 -6
  54. data/lib/autoproj/cli/tag.rb +12 -11
  55. data/lib/autoproj/cli/test.rb +7 -7
  56. data/lib/autoproj/cli/update.rb +104 -51
  57. data/lib/autoproj/cli/utility.rb +14 -12
  58. data/lib/autoproj/cli/version.rb +42 -40
  59. data/lib/autoproj/cli/versions.rb +14 -15
  60. data/lib/autoproj/cli/watch.rb +33 -37
  61. data/lib/autoproj/cli/which.rb +16 -20
  62. data/lib/autoproj/cli.rb +4 -2
  63. data/lib/autoproj/configuration.rb +78 -85
  64. data/lib/autoproj/default.osdeps +29 -3
  65. data/lib/autoproj/environment.rb +42 -23
  66. data/lib/autoproj/exceptions.rb +9 -3
  67. data/lib/autoproj/find_workspace.rb +20 -25
  68. data/lib/autoproj/git_server_configuration.rb +40 -44
  69. data/lib/autoproj/gitorious.rb +1 -1
  70. data/lib/autoproj/installation_manifest.rb +64 -29
  71. data/lib/autoproj/local_package_set.rb +13 -11
  72. data/lib/autoproj/manifest.rb +145 -135
  73. data/lib/autoproj/metapackage.rb +2 -6
  74. data/lib/autoproj/ops/atomic_write.rb +7 -6
  75. data/lib/autoproj/ops/build.rb +4 -6
  76. data/lib/autoproj/ops/cache.rb +64 -53
  77. data/lib/autoproj/ops/cached_env.rb +7 -6
  78. data/lib/autoproj/ops/configuration.rb +511 -506
  79. data/lib/autoproj/ops/import.rb +90 -61
  80. data/lib/autoproj/ops/install.rb +179 -175
  81. data/lib/autoproj/ops/loader.rb +77 -76
  82. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  83. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  84. data/lib/autoproj/ops/snapshot.rb +250 -247
  85. data/lib/autoproj/ops/tools.rb +76 -78
  86. data/lib/autoproj/ops/watch.rb +6 -6
  87. data/lib/autoproj/ops/which.rb +17 -14
  88. data/lib/autoproj/options.rb +13 -2
  89. data/lib/autoproj/os_package_installer.rb +102 -92
  90. data/lib/autoproj/os_package_query.rb +7 -13
  91. data/lib/autoproj/os_package_resolver.rb +189 -140
  92. data/lib/autoproj/os_repository_installer.rb +4 -4
  93. data/lib/autoproj/os_repository_resolver.rb +8 -6
  94. data/lib/autoproj/package_definition.rb +12 -13
  95. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +46 -31
  96. data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
  97. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  98. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  99. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  100. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  101. data/lib/autoproj/package_managers/manager.rb +8 -3
  102. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  103. data/lib/autoproj/package_managers/pip_manager.rb +37 -27
  104. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  105. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  106. data/lib/autoproj/package_managers/shell_script_manager.rb +66 -36
  107. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  108. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  109. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  110. data/lib/autoproj/package_manifest.rb +66 -53
  111. data/lib/autoproj/package_selection.rb +187 -187
  112. data/lib/autoproj/package_set.rb +128 -114
  113. data/lib/autoproj/python.rb +285 -0
  114. data/lib/autoproj/query_base.rb +20 -14
  115. data/lib/autoproj/reporter.rb +19 -19
  116. data/lib/autoproj/repository_managers/apt.rb +101 -67
  117. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  118. data/lib/autoproj/shell_completion.rb +16 -13
  119. data/lib/autoproj/source_package_query.rb +29 -36
  120. data/lib/autoproj/system.rb +32 -21
  121. data/lib/autoproj/test.rb +131 -106
  122. data/lib/autoproj/variable_expansion.rb +10 -10
  123. data/lib/autoproj/vcs_definition.rb +53 -37
  124. data/lib/autoproj/version.rb +1 -1
  125. data/lib/autoproj/workspace.rb +162 -117
  126. data/lib/autoproj/zsh_completion.rb +8 -9
  127. data/lib/autoproj.rb +53 -53
  128. data/samples/autoproj/init.rb +1 -2
  129. metadata +62 -72
  130. data/.travis.yml +0 -22
@@ -1,20 +1,19 @@
1
1
  #! /usr/bin/ruby
2
2
 
3
- if RUBY_VERSION < "2.3.0"
4
- STDERR.puts "autoproj requires Ruby >= 2.3.0"
3
+ if RUBY_VERSION < "2.5.0"
4
+ STDERR.puts "autoproj requires Ruby >= 2.5.0"
5
5
  exit 1
6
- elsif ENV['AUTOPROJ_CURRENT_ROOT'] && (ENV['AUTOPROJ_CURRENT_ROOT'] != Dir.pwd)
6
+ elsif ENV["AUTOPROJ_CURRENT_ROOT"] && (ENV["AUTOPROJ_CURRENT_ROOT"] != Dir.pwd)
7
7
  STDERR.puts "it seems that you've already loaded an env.sh script in this console, open a new console and try again"
8
8
  exit 1
9
9
  end
10
10
 
11
11
  require 'autoproj/ops/install'
12
-
13
- ENV.delete('BUNDLE_GEMFILE')
14
- ENV.delete('RUBYLIB')
12
+ ENV.delete("BUNDLE_GEMFILE")
13
+ ENV.delete("RUBYLIB")
15
14
  ops = Autoproj::Ops::Install.new(Dir.pwd)
16
15
 
17
- existing_config = File.join(Dir.pwd, '.autoproj', 'config.yml')
16
+ existing_config = File.join(Dir.pwd, ".autoproj", "config.yml")
18
17
  if File.file?(existing_config)
19
18
  puts "Found existing configuration, using it as seed"
20
19
  puts "use --no-seed-config to avoid this behavior"
@@ -1,4 +1,4 @@
1
- require 'aruba/api'
1
+ require "aruba/api"
2
2
 
3
3
  module Autoproj
4
4
  # Minitest-usable Aruba wrapper
@@ -27,10 +27,10 @@ module Autoproj
27
27
 
28
28
  def generate_local_gemfile
29
29
  path = expand_path("Gemfile.local")
30
- File.open(path, 'w') do |io|
30
+ File.open(path, "w") do |io|
31
31
  io.write <<~GEMFILE
32
32
  source "https://rubygems.org"
33
- gem "autoproj", path: "#{File.expand_path("../../", __dir__)}"
33
+ gem "autoproj", path: "#{File.expand_path('../../', __dir__)}"
34
34
  GEMFILE
35
35
  end
36
36
  path
@@ -39,9 +39,7 @@ module Autoproj
39
39
  def run_command_and_stop(*args, fail_on_error: true, **kwargs)
40
40
  cmd = run_command(*args, **kwargs)
41
41
  cmd.stop
42
- if fail_on_error
43
- assert_command_finished_successfully(cmd)
44
- end
42
+ assert_command_finished_successfully(cmd) if fail_on_error
45
43
  cmd
46
44
  end
47
45
 
@@ -59,7 +57,7 @@ module Autoproj
59
57
 
60
58
  def method_missing(m, *args, &block)
61
59
  if @aruba_api.respond_to?(m)
62
- return @aruba_api.send(m, *args, &block)
60
+ @aruba_api.send(m, *args, &block)
63
61
  else
64
62
  super
65
63
  end
@@ -67,9 +65,7 @@ module Autoproj
67
65
 
68
66
  def assert_command_stops(cmd, fail_on_error: true)
69
67
  cmd.stop
70
- if fail_on_error
71
- assert_command_finished_successfully(cmd)
72
- end
68
+ assert_command_finished_successfully(cmd) if fail_on_error
73
69
  end
74
70
 
75
71
  def assert_command_finished_successfully(cmd)
@@ -78,4 +74,3 @@ module Autoproj
78
74
  end
79
75
  end
80
76
  end
81
-
@@ -1,8 +1,8 @@
1
- require 'autoproj/autobuild_extensions/package'
2
- require 'autoproj/autobuild_extensions/archive_importer'
3
- require 'autoproj/autobuild_extensions/git'
4
- require 'autoproj/autobuild_extensions/svn'
5
- require 'autoproj/autobuild_extensions/dsl'
1
+ require "autoproj/autobuild_extensions/package"
2
+ require "autoproj/autobuild_extensions/archive_importer"
3
+ require "autoproj/autobuild_extensions/git"
4
+ require "autoproj/autobuild_extensions/svn"
5
+ require "autoproj/autobuild_extensions/dsl"
6
6
 
7
7
  Autobuild::Package.class_eval do
8
8
  prepend Autoproj::AutobuildExtensions::Package
@@ -16,4 +16,3 @@ end
16
16
  Autobuild::SVN.class_eval do
17
17
  prepend Autoproj::AutobuildExtensions::SVN
18
18
  end
19
-
@@ -9,36 +9,35 @@ module Autoproj
9
9
  # manifest
10
10
  def pick_from_autoproj_root(package, installation_manifest)
11
11
  # Get the cachefile w.r.t. the autoproj root
12
- cachefile = Pathname.new(self.cachefile).
13
- relative_path_from(Pathname.new(ws.root_dir)).to_s
12
+ cachefile = Pathname.new(self.cachefile)
13
+ .relative_path_from(Pathname.new(ws.root_dir)).to_s
14
14
 
15
15
  # The cachefile in the other autoproj installation
16
16
  other_cachefile = File.join(installation_manifest.path, cachefile)
17
17
  if File.file?(other_cachefile)
18
- self.relocate("file://" + other_cachefile)
18
+ relocate("file://#{other_cachefile}")
19
19
  true
20
20
  end
21
21
  end
22
22
 
23
23
  def snapshot(package, target_dir = nil, options = Hash.new)
24
24
  result = Hash[
25
- 'mode' => mode,
26
- 'no_subdirectory' => !has_subdirectory?,
27
- 'archive_dir' => archive_dir || tardir]
25
+ "mode" => mode,
26
+ "no_subdirectory" => !has_subdirectory?,
27
+ "archive_dir" => archive_dir || tardir]
28
28
 
29
29
  if target_dir
30
- archive_dir = File.join(target_dir, 'archives')
30
+ archive_dir = File.join(target_dir, "archives")
31
31
  FileUtils.mkdir_p archive_dir
32
32
  FileUtils.cp @cachefile, archive_dir
33
33
 
34
- result['url'] = "file://$AUTOPROJ_SOURCE_DIR/archives/#{File.basename(@cachefile)}"
34
+ result["url"] = "file://$AUTOPROJ_SOURCE_DIR/archives/#{File.basename(@cachefile)}"
35
35
  else
36
- result['url'] = @url.to_s
36
+ result["url"] = @url.to_s
37
37
  end
38
-
38
+
39
39
  result
40
40
  end
41
41
  end
42
42
  end
43
43
  end
44
-
@@ -1,7 +1,7 @@
1
- require 'find'
2
- require 'fileutils'
3
- require 'autobuild'
4
- require 'set'
1
+ require "find"
2
+ require "fileutils"
3
+ require "autobuild"
4
+ require "set"
5
5
 
6
6
  module Autoproj
7
7
  # @deprecated use Workspace.config.ruby_executable instead, or
@@ -35,24 +35,30 @@ module Autoproj
35
35
  # @deprecated use Autoproj.workspace.in_package_set or add a proper Loader
36
36
  # object to your class
37
37
  def self.in_package_set(package_set, path, &block)
38
- Autoproj.warn_deprecated __method__,
38
+ Autoproj.warn_deprecated(
39
+ __method__,
39
40
  "use Autoproj.workspace.in_package_set instead"
41
+ )
40
42
  Autoproj.workspace.in_package_set(package_set, path, &block)
41
43
  end
42
44
 
43
45
  # @deprecated use Autoproj.workspace.current_file or add a proper Loader
44
46
  # object to your class
45
47
  def self.current_file
46
- Autoproj.warn_deprecated __method__,
48
+ Autoproj.warn_deprecated(
49
+ __method__,
47
50
  "use AUtoproj.workspace.current_file instead"
51
+ )
48
52
  Autoproj.workspace.current_file
49
53
  end
50
54
 
51
55
  # @deprecated use Autoproj.workspace.current_package_set or add a proper
52
56
  # Loader object to your class
53
57
  def self.current_package_set
54
- Autoproj.warn_deprecated __method__,
58
+ Autoproj.warn_deprecated(
59
+ __method__,
55
60
  "use Autoproj.workspace.current_package_set instead"
61
+ )
56
62
  Autoproj.workspace.current_package_set
57
63
  end
58
64
 
@@ -60,22 +66,27 @@ module Autoproj
60
66
  # Beware that the return value changed from Autobuild::Package to
61
67
  # Autoproj::PackageDefinition
62
68
  def self.define(package_type, spec, &block)
63
- Autoproj.warn_deprecated __method__, "use Autoproj.workspace.define_package "\
64
- "instead (and beware that the return value changed from "\
65
- "Autobuild::Package to Autoproj::PackageDefinition)"
66
- workspace.define_package(package_type, spec, block, *current_file).
67
- autobuild
69
+ Autoproj.warn_deprecated(
70
+ __method__, "use Autoproj.workspace.define_package "\
71
+ "instead (and beware that the return value changed from "\
72
+ "Autobuild::Package to Autoproj::PackageDefinition)"
73
+ )
74
+ workspace.define_package(package_type, spec, block, *current_file)
75
+ .autobuild
68
76
  end
69
77
 
70
78
  def self.loaded_autobuild_files
71
- Autoproj.warn_deprecated __method__,
72
- "use Autoproj.workspace.loaded_autobuild_files"
79
+ Autoproj.warn_deprecated(
80
+ __method__, "use Autoproj.workspace.loaded_autobuild_files"
81
+ )
73
82
  Autoproj.workspace.loaded_autobuild_files
74
83
  end
75
84
 
76
85
  def self.import_autobuild_file(package_set, path)
77
- Autoproj.warn_deprecated __method__,
86
+ Autoproj.warn_deprecated(
87
+ __method__,
78
88
  "use Autoproj.workspace.import_autobuild_file"
89
+ )
79
90
  Autoproj.workspace.import_autobuild_file(package_set, path)
80
91
  end
81
92
 
@@ -106,25 +117,26 @@ module Autoproj
106
117
  ["orogen_package", full_path]
107
118
  elsif File.file?(File.join(full_path, "Makefile.am"))
108
119
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
109
- configure_ac = File.join(dir, 'configure.ac')
110
- configure_in = File.join(dir, 'configure.in')
120
+ configure_ac = File.join(dir, "configure.ac")
121
+ configure_in = File.join(dir, "configure.in")
111
122
  File.file?(configure_ac) || File.file?(configure_in)
112
123
  end
113
- ['autotools_package', toplevel_dir] if toplevel_dir
124
+ ["autotools_package", toplevel_dir] if toplevel_dir
114
125
  elsif File.file?(File.join(full_path, "configure.ac")) ||
115
126
  File.file?(File.join(full_path, "configure.in"))
116
- ['autotools_package', full_path]
127
+ ["autotools_package", full_path]
117
128
  elsif File.file?(File.join(full_path, "CMakeLists.txt"))
118
129
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
119
- cmakelists = File.join(dir, 'CMakeLists.txt')
130
+ cmakelists = File.join(dir, "CMakeLists.txt")
120
131
  File.file?(cmakelists) &&
121
132
  (File.read(cmakelists) =~ /PROJECT/i)
122
133
  end
123
134
  toplevel_dir ||= find_topmost_directory_containing(
124
- full_path, 'CMakeLists.txt')
135
+ full_path, "CMakeLists.txt"
136
+ )
125
137
 
126
- manifest_xml = File.join(toplevel_dir, 'manifest.xml')
127
- package_xml = File.join(toplevel_dir, 'package.xml')
138
+ manifest_xml = File.join(toplevel_dir, "manifest.xml")
139
+ package_xml = File.join(toplevel_dir, "package.xml")
128
140
  if File.file?(package_xml) && !File.file?(manifest_xml)
129
141
  return "catkin_package", toplevel_dir
130
142
  end
@@ -134,9 +146,9 @@ module Autoproj
134
146
  find_topmost_directory_containing(full_path, "lib/*.rb")))
135
147
 
136
148
  ["ruby_package", dir]
137
- elsif (dir = (find_topmost_directory_containing(full_path, 'setup.py') ||
149
+ elsif (dir = (find_topmost_directory_containing(full_path, "setup.py") ||
138
150
  find_topmost_directory_containing(full_path, pyglob)))
139
- ['python_package', dir]
151
+ ["python_package", dir]
140
152
  end
141
153
  end
142
154
  end
@@ -150,7 +162,7 @@ end
150
162
  # Adds a new setup block to an existing package
151
163
  def setup_package(package_name, workspace: Autoproj.workspace, &block)
152
164
  unless block
153
- raise Autoproj::ConfigError.new, 'you must give a block to #setup_package'
165
+ raise Autoproj::ConfigError.new, "you must give a block to #setup_package"
154
166
  end
155
167
 
156
168
  package_definition = workspace.manifest.find_package_definition(package_name)
@@ -171,7 +183,7 @@ def package_common(package_type, spec, workspace: Autoproj.workspace, &block)
171
183
  current_file = workspace.current_file[1]
172
184
  old_file = existing_package.file
173
185
  Autoproj.warn "#{package_name} from #{current_file} is overridden "\
174
- "by the definition in #{old_file}"
186
+ "by the definition in #{old_file}"
175
187
  return existing_package.autobuild
176
188
  end
177
189
 
@@ -186,9 +198,9 @@ end
186
198
 
187
199
  def python_package(name, workspace: Autoproj.workspace)
188
200
  package_common(:python, name, workspace: workspace) do |pkg|
189
- pkg.internal_dependency 'python'
201
+ pkg.internal_dependency "python"
190
202
  pkg.post_import do
191
- pkg.depends_on 'python-setuptools' if pkg.install_mode?
203
+ pkg.depends_on "python-setuptools" if pkg.install_mode?
192
204
  end
193
205
  yield(pkg) if block_given?
194
206
  end
@@ -196,9 +208,9 @@ end
196
208
 
197
209
  def common_make_default_test_task(pkg)
198
210
  unless pkg.test_utility.source_dir
199
- test_dir = File.join(pkg.srcdir, 'test')
211
+ test_dir = File.join(pkg.srcdir, "test")
200
212
  if File.directory?(test_dir)
201
- pkg.test_utility.source_dir = File.join(pkg.builddir, 'test', 'results')
213
+ pkg.test_utility.source_dir = File.join(pkg.builddir, "test", "results")
202
214
  end
203
215
  end
204
216
 
@@ -208,7 +220,7 @@ end
208
220
  def common_make_based_package_setup(pkg)
209
221
  unless pkg.has_doc? && pkg.doc_dir
210
222
  pkg.with_doc do
211
- doc_html = File.join(pkg.builddir, 'doc', 'html')
223
+ doc_html = File.join(pkg.builddir, "doc", "html")
212
224
  pkg.doc_dir = doc_html if File.directory?(doc_html)
213
225
  end
214
226
  end
@@ -234,7 +246,7 @@ end
234
246
  # information.
235
247
  def cmake_package(name, workspace: Autoproj.workspace)
236
248
  package_common(:cmake, name, workspace: workspace) do |pkg|
237
- pkg.depends_on 'cmake'
249
+ pkg.depends_on "cmake"
238
250
  common_make_based_package_setup(pkg)
239
251
  yield(pkg) if block_given?
240
252
  end
@@ -259,7 +271,7 @@ end
259
271
  # information.
260
272
  def autotools_package(name, workspace: Autoproj.workspace)
261
273
  package_common(:autotools, name, workspace: workspace) do |pkg|
262
- pkg.depends_on 'autotools'
274
+ pkg.depends_on "autotools"
263
275
  common_make_based_package_setup(pkg)
264
276
  yield(pkg) if block_given?
265
277
  end
@@ -279,9 +291,9 @@ end
279
291
 
280
292
  def ruby_package_default_test_task(pkg)
281
293
  unless pkg.test_utility.source_dir
282
- test_dir = File.join(pkg.srcdir, 'test')
294
+ test_dir = File.join(pkg.srcdir, "test")
283
295
  if File.directory?(test_dir)
284
- pkg.test_utility.source_dir = File.join(pkg.srcdir, '.test-results')
296
+ pkg.test_utility.source_dir = File.join(pkg.srcdir, ".test-results")
285
297
  FileUtils.mkdir_p pkg.test_utility.source_dir
286
298
  end
287
299
  end
@@ -347,7 +359,8 @@ def only_on(*architectures)
347
359
  architectures = architectures.map do |name|
348
360
  if name.respond_to?(:to_str)
349
361
  [name]
350
- else name
362
+ else
363
+ name
351
364
  end
352
365
  end
353
366
 
@@ -372,7 +385,8 @@ def not_on(*architectures)
372
385
  architectures = architectures.map do |name|
373
386
  if name.respond_to?(:to_str)
374
387
  [name]
375
- else name
388
+ else
389
+ name
376
390
  end
377
391
  end
378
392
 
@@ -396,7 +410,8 @@ def not_on(*architectures)
396
410
 
397
411
  new_packages.each do |pkg_name|
398
412
  manifest.exclude_package(
399
- pkg_name, "#{pkg_name} is disabled on this operating system")
413
+ pkg_name, "#{pkg_name} is disabled on this operating system"
414
+ )
400
415
  end
401
416
  end
402
417
 
@@ -410,9 +425,9 @@ def source_package(options, workspace: Autoproj.workspace)
410
425
  end
411
426
 
412
427
  # @deprecated use Autoproj.config.declare instead
413
- def configuration_option(*opts, &block)
428
+ def configuration_option(*opts, **kw, &block)
414
429
  Autoproj.warn_deprecated __method__, "use Autoproj.config.declare instead"
415
- Autoproj.config.declare(*opts, &block)
430
+ Autoproj.config.declare(*opts, **kw, &block)
416
431
  end
417
432
 
418
433
  # @deprecated use Autoproj.config.get instead
@@ -486,15 +501,17 @@ def remove_from_default(*names)
486
501
  end
487
502
 
488
503
  def renamed_package(current_name, old_name, options)
489
- explicit_selection = Autoproj.workspace.manifest.
490
- explicitely_selected_in_layout?(old_name)
504
+ explicit_selection = Autoproj.workspace.manifest
505
+ .explicitely_selected_in_layout?(old_name)
491
506
  if options[:obsolete] && !explicit_selection
492
507
  import_package old_name
493
- Autoproj.workspace.manifest.exclude_package old_name,
508
+ Autoproj.workspace.manifest.exclude_package(
509
+ old_name,
494
510
  "#{old_name} has been renamed to #{current_name}, you still have "\
495
511
  "the option of using the old name by adding '- #{old_name}' explicitely "\
496
512
  "in the layout in autoproj/manifest, but be warned that the name will "\
497
513
  "stop being usable at all in the near future"
514
+ )
498
515
  else
499
516
  metapackage old_name, current_name
500
517
  end
@@ -10,7 +10,8 @@ module Autoproj
10
10
  def pick_from_autoproj_root(package, installation_manifest)
11
11
  other_pkg = installation_manifest[package.name]
12
12
  return if !other_pkg || !File.directory?(other_pkg.srcdir)
13
- self.relocate(other_pkg.srcdir)
13
+
14
+ relocate(other_pkg.srcdir)
14
15
  true
15
16
  end
16
17
 
@@ -35,7 +36,7 @@ module Autoproj
35
36
 
36
37
  def normalize_branch_name(name)
37
38
  if name =~ /^refs\/heads\//
38
- return name
39
+ name
39
40
  else
40
41
  "refs/heads/#{name}"
41
42
  end
@@ -47,45 +48,45 @@ module Autoproj
47
48
  # It tests only against the parameters returned by {#snapshot}
48
49
  def snapshot_overrides?(snapshot)
49
50
  # We have to normalize the branch and tag names
50
- if snapshot_local = (snapshot['local_branch'] || snapshot['branch'])
51
+ if (snapshot_local = snapshot["local_branch"] || snapshot["branch"])
51
52
  snapshot_local = normalize_branch_name(snapshot_local)
52
- local_branch = normalize_branch_name(self.local_branch)
53
+ local_branch = normalize_branch_name(self.local_branch)
53
54
  return true if snapshot_local != local_branch
54
55
  end
55
- if snapshot_remote = (snapshot['remote_branch'] || snapshot['branch'])
56
+ if (snapshot_remote = snapshot["remote_branch"] || snapshot["branch"])
56
57
  snapshot_remote = normalize_branch_name(snapshot_remote)
57
58
  remote_branch = normalize_branch_name(self.remote_branch)
58
59
  return true if snapshot_remote != remote_branch
59
60
  end
60
- if snapshot_id = snapshot['commit']
61
- return true if self.commit != snapshot_id
61
+ if (snapshot_id = snapshot["commit"])
62
+ return true if commit != snapshot_id
62
63
  end
63
64
  false
64
65
  end
65
66
 
66
67
  # @api private
67
68
  def snapshot_against_remote(package, options = Hash.new)
68
- info = Hash['tag' => nil, 'commit' => nil]
69
- remote_revname = describe_commit_on_remote(package, 'HEAD', tags: options[:exact_state])
69
+ info = Hash["tag" => nil, "commit" => nil]
70
+ remote_revname = describe_commit_on_remote(package, "HEAD", tags: options[:exact_state])
70
71
 
71
72
  case remote_revname
72
73
  when /^refs\/heads\/(.*)/
73
74
  remote_branch = $1
74
75
  if local_branch == remote_branch
75
- info['branch'] = local_branch
76
+ info["branch"] = local_branch
76
77
  else
77
- info['local_branch'] = local_branch
78
- info['remote_branch'] = remote_branch
78
+ info["local_branch"] = local_branch
79
+ info["remote_branch"] = remote_branch
79
80
  end
80
81
  when /^refs\/tags\/(.*)/
81
- info['tag'] = $1
82
+ info["tag"] = $1
82
83
  else
83
- info['local_branch'] = local_branch
84
- info['remote_branch'] = remote_revname
84
+ info["local_branch"] = local_branch
85
+ info["remote_branch"] = remote_revname
85
86
  end
86
87
 
87
- if options[:exact_state] && !info['tag']
88
- info['commit'] = rev_parse(package, 'HEAD')
88
+ if options[:exact_state] && !info["tag"]
89
+ info["commit"] = rev_parse(package, "HEAD")
89
90
  end
90
91
  info
91
92
  end
@@ -93,21 +94,21 @@ module Autoproj
93
94
  # @api private
94
95
  def snapshot_local(package, options = Hash.new)
95
96
  info = Hash.new
96
- if local_branch != remote_branch
97
- info['local_branch'] = local_branch
98
- info['remote_branch'] = remote_branch
97
+ if local_branch == remote_branch
98
+ info["branch"] = branch
99
99
  else
100
- info['branch'] = branch
100
+ info["local_branch"] = local_branch
101
+ info["remote_branch"] = remote_branch
101
102
  end
102
103
 
103
104
  if options[:exact_state]
104
- has_tag, described = describe_rev(package, 'HEAD')
105
+ has_tag, described = describe_rev(package, "HEAD")
105
106
  if has_tag
106
- info['tag'] = described
107
- info['commit'] = nil
107
+ info["tag"] = described
108
+ info["commit"] = nil
108
109
  else
109
- info['tag'] = nil
110
- info['commit'] = described
110
+ info["tag"] = nil
111
+ info["commit"] = described
111
112
  end
112
113
  end
113
114
  info
@@ -8,6 +8,7 @@ module Autoproj
8
8
  attr_reader :os_packages
9
9
 
10
10
  attr_writer :ws
11
+
11
12
  def ws
12
13
  @ws ||= Autoproj.workspace
13
14
  end
@@ -46,9 +47,7 @@ module Autoproj
46
47
  # #add_tag
47
48
  def tags
48
49
  result = @added_tags.dup
49
- if description
50
- result |= description.tags.to_set
51
- end
50
+ result |= description.tags.to_set if description
52
51
  result
53
52
  end
54
53
 
@@ -68,7 +67,7 @@ module Autoproj
68
67
  # package
69
68
  def remove_obsolete_installed_orogen_package(name)
70
69
  post_install do
71
- path = File.join(prefix, 'lib', 'pkgconfig')
70
+ path = File.join(prefix, "lib", "pkgconfig")
72
71
  Dir.glob(File.join(path, "#{name}-*.pc")) do |pcfile|
73
72
  Autoproj.message " removing obsolete file #{pcfile}", :bold
74
73
  FileUtils.rm_f pcfile
@@ -100,13 +99,11 @@ module Autoproj
100
99
  end
101
100
 
102
101
  def autoproj_name # :nodoc:
103
- srcdir.gsub(/^#{Regexp.quote(ws.root_dir)}\//, '')
102
+ srcdir.gsub(/^#{Regexp.quote(ws.root_dir)}\//, "")
104
103
  end
105
104
 
106
105
  def depends_on(name)
107
- if name.respond_to?(:name) # probably a Package object
108
- name = name.name
109
- end
106
+ name = name.name if name.respond_to?(:name) # probably a Package object
110
107
 
111
108
  pkg_autobuild, pkg_os = partition_package(name)
112
109
  pkg_autobuild.each do |pkg|
@@ -120,10 +117,13 @@ module Autoproj
120
117
  all_dependencies(set)
121
118
  set.dup.each do |dep_pkg_name|
122
119
  next if original_set.include?(dep_pkg_name)
123
- if dep_pkg = ws.manifest.find_autobuild_package(dep_pkg_name)
120
+
121
+ if (dep_pkg = ws.manifest.find_autobuild_package(dep_pkg_name))
124
122
  set.merge(dep_pkg.os_packages)
125
123
  else
126
- raise ArgumentError, "#{dep_pkg_name}, which is listed as a dependency of #{name}, is not the name of a known package"
124
+ raise ArgumentError,
125
+ "#{dep_pkg_name}, which is listed as a dependency "\
126
+ "of #{name}, is not the name of a known package"
127
127
  end
128
128
  end
129
129
  set.merge(os_packages)
@@ -160,30 +160,31 @@ module Autoproj
160
160
  end
161
161
 
162
162
  def partition_package(pkg_name)
163
- pkg_autobuild, pkg_osdeps = [], []
163
+ pkg_autobuild = []
164
+ pkg_osdeps = []
164
165
  ws.manifest.resolve_package_name(pkg_name, include_unavailable: true).each do |type, dep_name|
165
166
  if type == :osdeps
166
167
  pkg_osdeps << dep_name
167
168
  elsif type == :package
168
169
  pkg_autobuild << dep_name
169
- else raise Autoproj::InternalError, "expected package type to be either :osdeps or :package, got #{type.inspect}"
170
+ else
171
+ raise Autoproj::InternalError, "expected package type to be either :osdeps or :package, got #{type.inspect}"
170
172
  end
171
173
  end
172
- return pkg_autobuild, pkg_osdeps
174
+ [pkg_autobuild, pkg_osdeps]
173
175
  end
174
176
 
175
177
  def partition_optional_dependencies
176
- packages, osdeps = [], []
178
+ packages = []
179
+ osdeps = []
177
180
  optional_dependencies.each do |name|
178
- begin
179
- pkg_autobuild, pkg_osdeps = partition_package(name)
180
- packages.concat(pkg_autobuild)
181
- osdeps.concat(pkg_osdeps)
182
- rescue Autoproj::PackageNotFound
183
- # Simply ignore non-existent optional dependencies
184
- end
181
+ pkg_autobuild, pkg_osdeps = partition_package(name)
182
+ packages.concat(pkg_autobuild)
183
+ osdeps.concat(pkg_osdeps)
184
+ rescue Autoproj::PackageNotFound
185
+ # Simply ignore non-existent optional dependencies
185
186
  end
186
- return packages, osdeps
187
+ [packages, osdeps]
187
188
  end
188
189
  end
189
190
  end
@@ -3,9 +3,8 @@ module Autoproj
3
3
  module SVN
4
4
  def snapshot(package, target_dir = nil, options = Hash.new)
5
5
  version = svn_revision(package)
6
- Hash['revision' => version]
6
+ Hash["revision" => version]
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
-
data/lib/autoproj/base.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'yaml'
1
+ require "yaml"
2
2
  module Autoproj
3
3
  YAML_LOAD_ERROR =
4
4
  if defined? Psych::SyntaxError