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
@@ -1,6 +1,6 @@
1
- require 'autoproj/repository_managers/manager'
2
- require 'autoproj/repository_managers/unknown_os_manager'
3
- require 'autoproj/repository_managers/apt'
1
+ require "autoproj/repository_managers/manager"
2
+ require "autoproj/repository_managers/unknown_os_manager"
3
+ require "autoproj/repository_managers/apt"
4
4
 
5
5
  module Autoproj
6
6
  class OSRepositoryInstaller
@@ -11,7 +11,7 @@ module Autoproj
11
11
  attr_reader :repository_managers
12
12
 
13
13
  OS_REPOSITORY_MANAGERS = {
14
- 'debian' => RepositoryManagers::APT
14
+ "debian" => RepositoryManagers::APT
15
15
  }.freeze
16
16
 
17
17
  def initialize(ws)
@@ -1,5 +1,5 @@
1
- require 'tempfile'
2
- require 'json'
1
+ require "tempfile"
2
+ require "json"
3
3
 
4
4
  module Autoproj
5
5
  # Manager for OS repository provided by package sets
@@ -11,7 +11,9 @@ module Autoproj
11
11
  attr_accessor :operating_system
12
12
 
13
13
  def self.load(file)
14
- raise ArgumentError, "no such file or directory: #{file}" unless File.file?(file)
14
+ unless File.file?(file)
15
+ raise ArgumentError, "no such file or directory: #{file}"
16
+ end
15
17
 
16
18
  error_t = if defined? Psych::SyntaxError
17
19
  [ArgumentError, Psych::SyntaxError]
@@ -62,12 +64,12 @@ module Autoproj
62
64
  end
63
65
 
64
66
  def entry_matches?(entry, identifiers)
65
- !(entry.keys.first.split(',').map(&:strip) & identifiers).empty?
67
+ !(entry.keys.first.split(",").map(&:strip) & identifiers).empty?
66
68
  end
67
69
 
68
70
  def resolved_entries
69
71
  os_name, os_version = operating_system
70
- os_version << 'default' unless os_version.include?('default')
72
+ os_version << "default" unless os_version.include?("default")
71
73
 
72
74
  distribution_filtered = definitions.select do |entry|
73
75
  entry_matches?(entry, os_name)
@@ -131,7 +133,7 @@ module Autoproj
131
133
  return if obj.is_a?(type)
132
134
 
133
135
  raise ArgumentError, "invalid osrepos definition in #{path.join('/')}: "\
134
- "expected a #{type}, found a #{obj.class}"
136
+ "expected a #{type}, found a #{obj.class}"
135
137
  end
136
138
  end
137
139
  end
@@ -15,6 +15,7 @@ module Autoproj
15
15
  # @return [String] path to the file that contains this package's
16
16
  # definition
17
17
  attr_reader :file
18
+
18
19
  # Whether this package is completely setup
19
20
  #
20
21
  # If the package is set up, its importer as well as all target
@@ -48,7 +49,7 @@ module Autoproj
48
49
  # @return [Array<String>]
49
50
  def modes
50
51
  @modes + autobuild.utilities
51
- .values.find_all(&:enabled?).map(&:name)
52
+ .values.find_all(&:enabled?).map(&:name)
52
53
  end
53
54
 
54
55
  # The package name
@@ -83,19 +84,17 @@ module Autoproj
83
84
  def apply_dependencies_from_manifest
84
85
  manifest = autobuild.description
85
86
  manifest.each_dependency(modes) do |name, is_optional|
86
- begin
87
- if is_optional
88
- autobuild.optional_dependency name
89
- else
90
- autobuild.depends_on name
91
- end
92
- rescue ConfigError => e
93
- raise PackageNotFound.new(manifest.path),
94
- "manifest #{manifest.path} of #{self.name} from "\
95
- "#{package_set.name} lists '#{name}' as dependency, "\
96
- 'but it is neither a normal package nor an osdeps '\
97
- "package. osdeps reports: #{e.message}", e.backtrace
87
+ if is_optional
88
+ autobuild.optional_dependency name
89
+ else
90
+ autobuild.depends_on name
98
91
  end
92
+ rescue ConfigError => e
93
+ raise PackageNotFound.new(manifest.path),
94
+ "manifest #{manifest.path} of #{self.name} from "\
95
+ "#{package_set.name} lists '#{name}' as dependency, "\
96
+ "but it is neither a normal package nor an osdeps "\
97
+ "package. osdeps reports: #{e.message}", e.backtrace
99
98
  end
100
99
  end
101
100
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'autoproj/package_managers/debian_version'
3
+ require "autoproj/package_managers/debian_version"
4
4
 
5
5
  module Autoproj
6
6
  module PackageManagers
@@ -9,6 +9,12 @@ module Autoproj
9
9
  class AptDpkgManager < ShellScriptManager
10
10
  attr_accessor :status_file
11
11
 
12
+ class << self
13
+ def inherit
14
+ @inherit ||= Set.new
15
+ end
16
+ end
17
+
12
18
  def initialize(ws, status_file = "/var/lib/dpkg/status")
13
19
  @status_file = status_file
14
20
  @installed_packages = nil
@@ -21,19 +27,19 @@ module Autoproj
21
27
  def configure_manager
22
28
  super
23
29
  ws.config.declare(
24
- 'apt_dpkg_update', 'boolean',
25
- default: 'yes',
26
- doc: ['Would you like autoproj to keep apt packages up-to-date?']
30
+ "apt_dpkg_update", "boolean",
31
+ default: "yes",
32
+ doc: ["Would you like autoproj to keep apt packages up-to-date?"]
27
33
  )
28
34
  keep_uptodate?
29
35
  end
30
36
 
31
37
  def keep_uptodate?
32
- ws.config.get('apt_dpkg_update')
38
+ ws.config.get("apt_dpkg_update")
33
39
  end
34
40
 
35
41
  def keep_uptodate=(flag)
36
- ws.config.set('apt_dpkg_update', flag, true)
42
+ ws.config.set("apt_dpkg_update", flag, true)
37
43
  end
38
44
 
39
45
  def self.parse_package_status(
@@ -48,7 +54,7 @@ module Autoproj
48
54
  end
49
55
  end
50
56
  if virtual && paragraph =~ /^Provides: (.*)$/
51
- installed_packages.merge($1.split(',').map(&:strip))
57
+ installed_packages.merge($1.split(",").map(&:strip))
52
58
  end
53
59
  end
54
60
  end
@@ -76,7 +82,7 @@ module Autoproj
76
82
  end
77
83
 
78
84
  def self.parse_apt_cache_paragraph(paragraph)
79
- version = '0'
85
+ version = "0"
80
86
  if (paragraph_m = /^Package: (.*)$/.match(paragraph))
81
87
  package_name = paragraph_m[1]
82
88
  version_m = /^Version: (.*)$/.match(paragraph)
@@ -87,7 +93,7 @@ module Autoproj
87
93
 
88
94
  def self.parse_packages_versions(packages)
89
95
  packages_versions = {}
90
- apt_cache_show = `apt-cache show --no-all-versions #{packages.join(' ')}`
96
+ apt_cache_show = `apt-cache show --no-all-versions #{packages.join(" ")}`
91
97
  apt_cache_show = StringScanner.new(apt_cache_show)
92
98
  return packages_versions unless apt_cache_show.scan(/Package: /)
93
99
 
@@ -115,7 +121,7 @@ module Autoproj
115
121
  # On a dpkg-enabled system, checks if the provided package is installed
116
122
  # and returns true if it is the case
117
123
  def installed?(package_name, filter_uptodate_packages: false,
118
- install_only: false)
124
+ install_only: false)
119
125
  unless @installed_packages && @installed_versions
120
126
  @installed_packages, @installed_versions =
121
127
  self.class.parse_dpkg_status(status_file)
@@ -129,6 +135,7 @@ module Autoproj
129
135
  end
130
136
  end
131
137
 
138
+ # rubocop:disable Metrics/AbcSize
132
139
  def install(packages, filter_uptodate_packages: false, install_only: false)
133
140
  if filter_uptodate_packages || install_only
134
141
  already_installed, missing = packages.partition do |package_name|
@@ -144,12 +151,13 @@ module Autoproj
144
151
  packages = missing + (need_update || [])
145
152
  end
146
153
 
147
- if super(packages)
154
+ if super(packages, inherit: self.class.inherit)
148
155
  # Invalidate caching of installed packages, as we just
149
156
  # installed new packages !
150
157
  @installed_packages = nil
151
158
  end
152
159
  end
160
+ # rubocop:enable Metrics/AbcSize
153
161
  end
154
162
  end
155
163
  end