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,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 ConfigError.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
@@ -14,24 +14,26 @@ module Autoproj
14
14
  @installed_packages = nil
15
15
  @installed_versions = nil
16
16
  super(ws, true,
17
- %w{apt-get install},
18
- %w{DEBIAN_FRONTEND=noninteractive apt-get install -y})
17
+ %w[apt-get install],
18
+ %w[DEBIAN_FRONTEND=noninteractive apt-get install -y])
19
19
  end
20
20
 
21
21
  def configure_manager
22
22
  super
23
- ws.config.declare 'apt_dpkg_update', 'boolean',
24
- default: 'yes',
25
- doc: ['Would you like autoproj to keep apt packages up-to-date?']
23
+ ws.config.declare(
24
+ "apt_dpkg_update", "boolean",
25
+ default: "yes",
26
+ doc: ["Would you like autoproj to keep apt packages up-to-date?"]
27
+ )
26
28
  keep_uptodate?
27
29
  end
28
30
 
29
31
  def keep_uptodate?
30
- ws.config.get('apt_dpkg_update')
32
+ ws.config.get("apt_dpkg_update")
31
33
  end
32
34
 
33
35
  def keep_uptodate=(flag)
34
- ws.config.set('apt_dpkg_update', flag, true)
36
+ ws.config.set("apt_dpkg_update", flag, true)
35
37
  end
36
38
 
37
39
  def self.parse_package_status(
@@ -46,7 +48,7 @@ module Autoproj
46
48
  end
47
49
  end
48
50
  if virtual && paragraph =~ /^Provides: (.*)$/
49
- installed_packages.merge($1.split(',').map(&:strip))
51
+ installed_packages.merge($1.split(",").map(&:strip))
50
52
  end
51
53
  end
52
54
  end
@@ -58,11 +60,12 @@ module Autoproj
58
60
  dpkg_status << "\n"
59
61
 
60
62
  dpkg_status = StringScanner.new(dpkg_status)
61
- if !dpkg_status.scan(/Package: /)
62
- raise ArgumentError, "expected #{status_file} to have Package: lines but found none"
63
+ unless dpkg_status.scan(/Package: /)
64
+ raise ArgumentError, "expected #{status_file} to have Package: "\
65
+ "lines but found none"
63
66
  end
64
67
 
65
- while paragraph_end = dpkg_status.scan_until(/Package: /)
68
+ while (paragraph_end = dpkg_status.scan_until(/Package: /))
66
69
  paragraph = "Package: #{paragraph_end[0..-10]}"
67
70
  parse_package_status(installed_packages, installed_versions,
68
71
  paragraph, virtual: virtual)
@@ -73,37 +76,37 @@ module Autoproj
73
76
  end
74
77
 
75
78
  def self.parse_apt_cache_paragraph(paragraph)
76
- version = '0'
77
- if paragraph =~ /^Package: (.*)$/
78
- package_name = $1
79
- if paragraph =~ /^Version: (.*)$/
80
- version = $1
81
- end
79
+ version = "0"
80
+ if (paragraph_m = /^Package: (.*)$/.match(paragraph))
81
+ package_name = paragraph_m[1]
82
+ version_m = /^Version: (.*)$/.match(paragraph)
83
+ version = version_m[1] if version_m
82
84
  end
83
85
  [package_name, version]
84
86
  end
85
87
 
86
88
  def self.parse_packages_versions(packages)
87
89
  packages_versions = {}
88
- apt_cache_show = `apt-cache show --no-all-versions #{packages.join(' ')}`
90
+ apt_cache_show = `apt-cache show --no-all-versions #{packages.join(" ")}`
89
91
  apt_cache_show = StringScanner.new(apt_cache_show)
90
- if !apt_cache_show.scan(/Package: /)
91
- return packages_versions
92
- end
92
+ return packages_versions unless apt_cache_show.scan(/Package: /)
93
93
 
94
- while paragraph_end = apt_cache_show.scan_until(/Package: /)
94
+ while (paragraph_end = apt_cache_show.scan_until(/Package: /))
95
95
  paragraph = "Package: #{paragraph_end[0..-10]}"
96
96
  package_name, version = parse_apt_cache_paragraph(paragraph)
97
97
  packages_versions[package_name] = DebianVersion.new(version)
98
98
  end
99
- package_name, version = parse_apt_cache_paragraph("Package: #{apt_cache_show.rest}")
99
+ package_name, version = parse_apt_cache_paragraph(
100
+ "Package: #{apt_cache_show.rest}"
101
+ )
100
102
  packages_versions[package_name] = DebianVersion.new(version)
101
103
  packages_versions
102
104
  end
103
105
 
104
106
  def updated?(package, available_version)
105
- # Consider up-to-date if the package is provided by another package (purely virtual)
106
- # Ideally, we should check the version of the package that provides it
107
+ # Consider up-to-date if the package is provided by another
108
+ # package (purely virtual) Ideally, we should check the version
109
+ # of the package that provides it
107
110
  return true unless available_version && @installed_versions[package]
108
111
 
109
112
  (available_version <= @installed_versions[package])
@@ -111,8 +114,13 @@ module Autoproj
111
114
 
112
115
  # On a dpkg-enabled system, checks if the provided package is installed
113
116
  # and returns true if it is the case
114
- def installed?(package_name, filter_uptodate_packages: false, install_only: false)
115
- @installed_packages, @installed_versions = self.class.parse_dpkg_status(status_file) unless @installed_packages && @installed_versions
117
+ def installed?(package_name, filter_uptodate_packages: false,
118
+ install_only: false)
119
+ unless @installed_packages && @installed_versions
120
+ @installed_packages, @installed_versions =
121
+ self.class.parse_dpkg_status(status_file)
122
+ end
123
+
116
124
  if package_name =~ /^(\w[a-z0-9+-.]+)/
117
125
  @installed_packages.include?($1)
118
126
  else
@@ -122,11 +130,18 @@ module Autoproj
122
130
  end
123
131
 
124
132
  def install(packages, filter_uptodate_packages: false, install_only: false)
125
- packages_versions = self.class.parse_packages_versions(packages)
126
133
  if filter_uptodate_packages || install_only
127
- packages = packages.find_all do |package_name|
128
- !installed?(package_name) || (keep_uptodate? && !updated?(package_name, packages_versions[package_name]))
134
+ already_installed, missing = packages.partition do |package_name|
135
+ installed?(package_name)
136
+ end
137
+
138
+ if keep_uptodate? && !install_only
139
+ packages_versions = self.class.parse_packages_versions(already_installed)
140
+ need_update = already_installed.find_all do |package_name|
141
+ !updated?(package_name, packages_versions[package_name])
142
+ end
129
143
  end
144
+ packages = missing + (need_update || [])
130
145
  end
131
146
 
132
147
  if super(packages)