autoproj 2.14.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) 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 +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 +185 -182
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +184 -181
  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 +38 -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/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 +26 -26
  29. data/lib/autoproj/cli/bootstrap.rb +14 -16
  30. data/lib/autoproj/cli/build.rb +10 -7
  31. data/lib/autoproj/cli/cache.rb +11 -11
  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 +13 -7
  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 +213 -204
  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 +38 -39
  52. data/lib/autoproj/cli/status.rb +45 -39
  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 +35 -37
  57. data/lib/autoproj/cli/utility.rb +11 -10
  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 +77 -84
  64. data/lib/autoproj/environment.rb +28 -13
  65. data/lib/autoproj/exceptions.rb +9 -3
  66. data/lib/autoproj/find_workspace.rb +20 -25
  67. data/lib/autoproj/git_server_configuration.rb +40 -44
  68. data/lib/autoproj/gitorious.rb +1 -1
  69. data/lib/autoproj/installation_manifest.rb +64 -29
  70. data/lib/autoproj/local_package_set.rb +13 -11
  71. data/lib/autoproj/manifest.rb +132 -130
  72. data/lib/autoproj/metapackage.rb +2 -6
  73. data/lib/autoproj/ops/atomic_write.rb +7 -6
  74. data/lib/autoproj/ops/build.rb +4 -6
  75. data/lib/autoproj/ops/cache.rb +41 -43
  76. data/lib/autoproj/ops/cached_env.rb +5 -4
  77. data/lib/autoproj/ops/configuration.rb +511 -506
  78. data/lib/autoproj/ops/import.rb +73 -63
  79. data/lib/autoproj/ops/install.rb +178 -174
  80. data/lib/autoproj/ops/loader.rb +77 -76
  81. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  82. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  83. data/lib/autoproj/ops/snapshot.rb +250 -247
  84. data/lib/autoproj/ops/tools.rb +76 -78
  85. data/lib/autoproj/ops/watch.rb +6 -6
  86. data/lib/autoproj/ops/which.rb +17 -14
  87. data/lib/autoproj/options.rb +13 -2
  88. data/lib/autoproj/os_package_installer.rb +102 -92
  89. data/lib/autoproj/os_package_query.rb +7 -13
  90. data/lib/autoproj/os_package_resolver.rb +189 -140
  91. data/lib/autoproj/os_repository_installer.rb +4 -4
  92. data/lib/autoproj/os_repository_resolver.rb +8 -6
  93. data/lib/autoproj/package_definition.rb +12 -13
  94. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +10 -10
  95. data/lib/autoproj/package_managers/bundler_manager.rb +147 -111
  96. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  97. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  98. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  99. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  100. data/lib/autoproj/package_managers/manager.rb +8 -3
  101. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  102. data/lib/autoproj/package_managers/pip_manager.rb +20 -22
  103. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  104. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  105. data/lib/autoproj/package_managers/shell_script_manager.rb +32 -22
  106. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  107. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  108. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  109. data/lib/autoproj/package_manifest.rb +27 -26
  110. data/lib/autoproj/package_selection.rb +187 -187
  111. data/lib/autoproj/package_set.rb +127 -113
  112. data/lib/autoproj/python.rb +55 -55
  113. data/lib/autoproj/query_base.rb +20 -14
  114. data/lib/autoproj/reporter.rb +19 -19
  115. data/lib/autoproj/repository_managers/apt.rb +101 -67
  116. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  117. data/lib/autoproj/shell_completion.rb +16 -13
  118. data/lib/autoproj/source_package_query.rb +29 -36
  119. data/lib/autoproj/system.rb +32 -21
  120. data/lib/autoproj/test.rb +127 -104
  121. data/lib/autoproj/variable_expansion.rb +7 -9
  122. data/lib/autoproj/vcs_definition.rb +35 -32
  123. data/lib/autoproj/version.rb +1 -1
  124. data/lib/autoproj/workspace.rb +123 -107
  125. data/lib/autoproj/zsh_completion.rb +8 -9
  126. data/lib/autoproj.rb +53 -55
  127. data/samples/autoproj/init.rb +1 -2
  128. metadata +53 -51
  129. data/.travis.yml +0 -24
@@ -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
@@ -68,11 +68,11 @@ module Autoproj
68
68
  def self.define(package_type, spec, &block)
69
69
  Autoproj.warn_deprecated(
70
70
  __method__, "use Autoproj.workspace.define_package "\
71
- "instead (and beware that the return value changed from "\
72
- "Autobuild::Package to Autoproj::PackageDefinition)"
71
+ "instead (and beware that the return value changed from "\
72
+ "Autobuild::Package to Autoproj::PackageDefinition)"
73
73
  )
74
- workspace.define_package(package_type, spec, block, *current_file).
75
- autobuild
74
+ workspace.define_package(package_type, spec, block, *current_file)
75
+ .autobuild
76
76
  end
77
77
 
78
78
  def self.loaded_autobuild_files
@@ -117,25 +117,26 @@ module Autoproj
117
117
  ["orogen_package", full_path]
118
118
  elsif File.file?(File.join(full_path, "Makefile.am"))
119
119
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
120
- configure_ac = File.join(dir, 'configure.ac')
121
- configure_in = File.join(dir, 'configure.in')
120
+ configure_ac = File.join(dir, "configure.ac")
121
+ configure_in = File.join(dir, "configure.in")
122
122
  File.file?(configure_ac) || File.file?(configure_in)
123
123
  end
124
- ['autotools_package', toplevel_dir] if toplevel_dir
124
+ ["autotools_package", toplevel_dir] if toplevel_dir
125
125
  elsif File.file?(File.join(full_path, "configure.ac")) ||
126
126
  File.file?(File.join(full_path, "configure.in"))
127
- ['autotools_package', full_path]
127
+ ["autotools_package", full_path]
128
128
  elsif File.file?(File.join(full_path, "CMakeLists.txt"))
129
129
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
130
- cmakelists = File.join(dir, 'CMakeLists.txt')
130
+ cmakelists = File.join(dir, "CMakeLists.txt")
131
131
  File.file?(cmakelists) &&
132
132
  (File.read(cmakelists) =~ /PROJECT/i)
133
133
  end
134
134
  toplevel_dir ||= find_topmost_directory_containing(
135
- full_path, 'CMakeLists.txt')
135
+ full_path, "CMakeLists.txt"
136
+ )
136
137
 
137
- manifest_xml = File.join(toplevel_dir, 'manifest.xml')
138
- 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")
139
140
  if File.file?(package_xml) && !File.file?(manifest_xml)
140
141
  return "catkin_package", toplevel_dir
141
142
  end
@@ -145,9 +146,9 @@ module Autoproj
145
146
  find_topmost_directory_containing(full_path, "lib/*.rb")))
146
147
 
147
148
  ["ruby_package", dir]
148
- elsif (dir = (find_topmost_directory_containing(full_path, 'setup.py') ||
149
+ elsif (dir = (find_topmost_directory_containing(full_path, "setup.py") ||
149
150
  find_topmost_directory_containing(full_path, pyglob)))
150
- ['python_package', dir]
151
+ ["python_package", dir]
151
152
  end
152
153
  end
153
154
  end
@@ -161,7 +162,7 @@ end
161
162
  # Adds a new setup block to an existing package
162
163
  def setup_package(package_name, workspace: Autoproj.workspace, &block)
163
164
  unless block
164
- 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"
165
166
  end
166
167
 
167
168
  package_definition = workspace.manifest.find_package_definition(package_name)
@@ -182,7 +183,7 @@ def package_common(package_type, spec, workspace: Autoproj.workspace, &block)
182
183
  current_file = workspace.current_file[1]
183
184
  old_file = existing_package.file
184
185
  Autoproj.warn "#{package_name} from #{current_file} is overridden "\
185
- "by the definition in #{old_file}"
186
+ "by the definition in #{old_file}"
186
187
  return existing_package.autobuild
187
188
  end
188
189
 
@@ -197,9 +198,9 @@ end
197
198
 
198
199
  def python_package(name, workspace: Autoproj.workspace)
199
200
  package_common(:python, name, workspace: workspace) do |pkg|
200
- pkg.internal_dependency 'python'
201
+ pkg.internal_dependency "python"
201
202
  pkg.post_import do
202
- pkg.depends_on 'python-setuptools' if pkg.install_mode?
203
+ pkg.depends_on "python-setuptools" if pkg.install_mode?
203
204
  end
204
205
  yield(pkg) if block_given?
205
206
  end
@@ -207,9 +208,9 @@ end
207
208
 
208
209
  def common_make_default_test_task(pkg)
209
210
  unless pkg.test_utility.source_dir
210
- test_dir = File.join(pkg.srcdir, 'test')
211
+ test_dir = File.join(pkg.srcdir, "test")
211
212
  if File.directory?(test_dir)
212
- pkg.test_utility.source_dir = File.join(pkg.builddir, 'test', 'results')
213
+ pkg.test_utility.source_dir = File.join(pkg.builddir, "test", "results")
213
214
  end
214
215
  end
215
216
 
@@ -219,7 +220,7 @@ end
219
220
  def common_make_based_package_setup(pkg)
220
221
  unless pkg.has_doc? && pkg.doc_dir
221
222
  pkg.with_doc do
222
- doc_html = File.join(pkg.builddir, 'doc', 'html')
223
+ doc_html = File.join(pkg.builddir, "doc", "html")
223
224
  pkg.doc_dir = doc_html if File.directory?(doc_html)
224
225
  end
225
226
  end
@@ -245,7 +246,7 @@ end
245
246
  # information.
246
247
  def cmake_package(name, workspace: Autoproj.workspace)
247
248
  package_common(:cmake, name, workspace: workspace) do |pkg|
248
- pkg.depends_on 'cmake'
249
+ pkg.depends_on "cmake"
249
250
  common_make_based_package_setup(pkg)
250
251
  yield(pkg) if block_given?
251
252
  end
@@ -270,7 +271,7 @@ end
270
271
  # information.
271
272
  def autotools_package(name, workspace: Autoproj.workspace)
272
273
  package_common(:autotools, name, workspace: workspace) do |pkg|
273
- pkg.depends_on 'autotools'
274
+ pkg.depends_on "autotools"
274
275
  common_make_based_package_setup(pkg)
275
276
  yield(pkg) if block_given?
276
277
  end
@@ -290,9 +291,9 @@ end
290
291
 
291
292
  def ruby_package_default_test_task(pkg)
292
293
  unless pkg.test_utility.source_dir
293
- test_dir = File.join(pkg.srcdir, 'test')
294
+ test_dir = File.join(pkg.srcdir, "test")
294
295
  if File.directory?(test_dir)
295
- pkg.test_utility.source_dir = File.join(pkg.srcdir, '.test-results')
296
+ pkg.test_utility.source_dir = File.join(pkg.srcdir, ".test-results")
296
297
  FileUtils.mkdir_p pkg.test_utility.source_dir
297
298
  end
298
299
  end
@@ -358,7 +359,8 @@ def only_on(*architectures)
358
359
  architectures = architectures.map do |name|
359
360
  if name.respond_to?(:to_str)
360
361
  [name]
361
- else name
362
+ else
363
+ name
362
364
  end
363
365
  end
364
366
 
@@ -383,7 +385,8 @@ def not_on(*architectures)
383
385
  architectures = architectures.map do |name|
384
386
  if name.respond_to?(:to_str)
385
387
  [name]
386
- else name
388
+ else
389
+ name
387
390
  end
388
391
  end
389
392
 
@@ -407,7 +410,8 @@ def not_on(*architectures)
407
410
 
408
411
  new_packages.each do |pkg_name|
409
412
  manifest.exclude_package(
410
- pkg_name, "#{pkg_name} is disabled on this operating system")
413
+ pkg_name, "#{pkg_name} is disabled on this operating system"
414
+ )
411
415
  end
412
416
  end
413
417
 
@@ -497,8 +501,8 @@ def remove_from_default(*names)
497
501
  end
498
502
 
499
503
  def renamed_package(current_name, old_name, options)
500
- explicit_selection = Autoproj.workspace.manifest.
501
- explicitely_selected_in_layout?(old_name)
504
+ explicit_selection = Autoproj.workspace.manifest
505
+ .explicitely_selected_in_layout?(old_name)
502
506
  if options[:obsolete] && !explicit_selection
503
507
  import_package old_name
504
508
  Autoproj.workspace.manifest.exclude_package(
@@ -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
@@ -1,13 +1,13 @@
1
- require 'autoproj/shell_completion'
1
+ require "autoproj/shell_completion"
2
2
 
3
3
  module Autoproj
4
4
  # This class generates shell completion for code for a given Thor subclasss
5
5
  class BashCompletion < ShellCompletion
6
- MAIN_FUNCTION_TEMPLATE = 'main.bash.erb'
7
- SUBCOMMAND_FUNCTION_TEMPLATE = 'subcommand.bash.erb'
6
+ MAIN_FUNCTION_TEMPLATE = "main.bash.erb"
7
+ SUBCOMMAND_FUNCTION_TEMPLATE = "subcommand.bash.erb"
8
8
 
9
9
  def setup_file_completion(metadata)
10
- metadata[:completer] = '_filedir'
10
+ metadata[:completer] = "_filedir"
11
11
  end
12
12
 
13
13
  def setup_executable_completion(metadata)
@@ -15,7 +15,7 @@ module Autoproj
15
15
  end
16
16
 
17
17
  def setup_package_completion(metadata)
18
- metadata[:completer] = '_autoproj_installed_packages'
18
+ metadata[:completer] = "_autoproj_installed_packages"
19
19
  end
20
20
 
21
21
  def disable_completion(metadata)
@@ -23,4 +23,3 @@ module Autoproj
23
23
  end
24
24
  end
25
25
  end
26
-