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,93 +1,91 @@
1
1
  module Autoproj
2
2
  module Ops
3
- module Tools
4
- # Data structure used to use autobuild importers without a package, to
5
- # import configuration data.
6
- #
7
- # It has to match the interface of Autobuild::Package that is relevant
8
- # for importers
9
- class FakePackage < Autobuild::Package
10
- attr_reader :srcdir
11
- attr_reader :importer
12
-
13
- # Used by the autobuild importers
14
- attr_accessor :updated
15
-
16
- def autoproj_name
17
- name
18
- end
19
-
20
- def initialize(text_name, srcdir, importer = nil)
21
- super(text_name)
22
- @srcdir = srcdir
23
- @importer = importer
24
- @@packages.delete(text_name)
25
- end
26
-
27
- def import(**options)
28
- importer.import(self, **options)
29
- end
30
-
31
- def add_stat(*args)
3
+ module Tools
4
+ # Data structure used to use autobuild importers without a package, to
5
+ # import configuration data.
6
+ #
7
+ # It has to match the interface of Autobuild::Package that is relevant
8
+ # for importers
9
+ class FakePackage < Autobuild::Package
10
+ attr_reader :srcdir
11
+ attr_reader :importer
12
+
13
+ # Used by the autobuild importers
14
+ attr_accessor :updated
15
+
16
+ def autoproj_name
17
+ name
18
+ end
19
+
20
+ def initialize(text_name, srcdir, importer = nil)
21
+ super(text_name)
22
+ @srcdir = srcdir
23
+ @importer = importer
24
+ @@packages.delete(text_name)
25
+ end
26
+
27
+ def import(**options)
28
+ importer.import(self, **options)
29
+ end
30
+
31
+ def add_stat(*args)
32
+ end
32
33
  end
33
- end
34
-
35
- # Creates an autobuild package whose job is to allow the import of a
36
- # specific repository into a given directory.
37
- #
38
- # +vcs+ is the VCSDefinition file describing the repository, +text_name+
39
- # the name used when displaying the import progress, +pkg_name+ the
40
- # internal name used to represent the package and +into+ the directory
41
- # in which the package should be checked out.
42
- def create_autobuild_package(vcs, text_name, into)
43
- importer = vcs.create_autobuild_importer
44
- FakePackage.new(text_name, into, importer)
45
34
 
46
- rescue Autobuild::ConfigException => e
47
- raise ConfigError.new, "cannot import #{text_name}: #{e.message}", e.backtrace
48
- end
49
-
50
- def load_autoprojrc
51
- Autoproj.warn_deprecated __method__, "use workspace.load_autoprojrc instead"
52
- Autoproj.workspace.load_autoprojrc
53
- end
54
-
55
- def load_main_initrb(*args)
56
- Autoproj.warn_deprecated __method__, "use workspace.load_main_initrb instead"
57
- Autoproj.workspace.load_main_initrb
58
- end
59
-
60
- def common_options(parser)
61
- parser.on '--silent' do
62
- Autoproj.silent = true
35
+ # Creates an autobuild package whose job is to allow the import of a
36
+ # specific repository into a given directory.
37
+ #
38
+ # +vcs+ is the VCSDefinition file describing the repository, +text_name+
39
+ # the name used when displaying the import progress, +pkg_name+ the
40
+ # internal name used to represent the package and +into+ the directory
41
+ # in which the package should be checked out.
42
+ def create_autobuild_package(vcs, text_name, into)
43
+ importer = vcs.create_autobuild_importer
44
+ FakePackage.new(text_name, into, importer)
45
+ rescue Autobuild::ConfigException => e
46
+ raise ConfigError.new, "cannot import #{text_name}: #{e.message}", e.backtrace
63
47
  end
64
48
 
65
- parser.on '--verbose' do
66
- Autoproj.verbose = true
67
- Autobuild.verbose = true
68
- Rake.application.options.trace = false
69
- Autobuild.debug = false
49
+ def load_autoprojrc
50
+ Autoproj.warn_deprecated __method__, "use workspace.load_autoprojrc instead"
51
+ Autoproj.workspace.load_autoprojrc
70
52
  end
71
53
 
72
- parser.on '--debug' do
73
- Autoproj.verbose = true
74
- Autobuild.verbose = true
75
- Rake.application.options.trace = true
76
- Autobuild.debug = true
54
+ def load_main_initrb(*args)
55
+ Autoproj.warn_deprecated __method__, "use workspace.load_main_initrb instead"
56
+ Autoproj.workspace.load_main_initrb
77
57
  end
78
58
 
79
- parser.on("--[no-]color", "enable or disable color in status messages (enabled by default)") do |flag|
80
- Autoproj.color = flag
81
- Autobuild.color = flag
59
+ def common_options(parser)
60
+ parser.on "--silent" do
61
+ Autoproj.silent = true
62
+ end
63
+
64
+ parser.on "--verbose" do
65
+ Autoproj.verbose = true
66
+ Autobuild.verbose = true
67
+ Rake.application.options.trace = false
68
+ Autobuild.debug = false
69
+ end
70
+
71
+ parser.on "--debug" do
72
+ Autoproj.verbose = true
73
+ Autobuild.verbose = true
74
+ Rake.application.options.trace = true
75
+ Autobuild.debug = true
76
+ end
77
+
78
+ parser.on("--[no-]color", "enable or disable color in status messages (enabled by default)") do |flag|
79
+ Autoproj.color = flag
80
+ Autobuild.color = flag
81
+ end
82
+
83
+ parser.on("--[no-]progress", "enable or disable progress display (enabled by default)") do |flag|
84
+ Autobuild.progress_display_enabled = flag
85
+ end
82
86
  end
83
87
 
84
- parser.on("--[no-]progress", "enable or disable progress display (enabled by default)") do |flag|
85
- Autobuild.progress_display_enabled = flag
86
- end
88
+ extend Tools
87
89
  end
88
-
89
- extend Tools
90
- end
91
90
  end
92
91
  end
93
-
@@ -1,7 +1,7 @@
1
1
  module Autoproj
2
2
  module Ops
3
3
  def self.watch_marker_path(root_dir)
4
- File.join(root_dir, '.autoproj', 'watch')
4
+ File.join(root_dir, ".autoproj", "watch")
5
5
  end
6
6
 
7
7
  def self.watch_running?(root_dir)
@@ -10,22 +10,22 @@ module Autoproj
10
10
  rescue Errno::ENOENT
11
11
  false
12
12
  ensure
13
- io.close if io
13
+ io&.close
14
14
  end
15
15
 
16
16
  class WatchAlreadyRunning < RuntimeError; end
17
17
 
18
18
  def self.watch_create_marker(root_dir)
19
- io = File.open(watch_marker_path(root_dir), 'a+')
20
- if !io.flock(File::LOCK_EX | File::LOCK_NB)
19
+ io = File.open(watch_marker_path(root_dir), "a+")
20
+ unless io.flock(File::LOCK_EX | File::LOCK_NB)
21
21
  raise WatchAlreadyRunning, "autoproj watch is already running as PID #{io.read.strip}"
22
22
  end
23
+
23
24
  io.truncate(0)
24
25
  io.puts Process.pid
25
26
  io.flush
26
-
27
27
  rescue Exception
28
- io.close if io
28
+ io&.close
29
29
  raise
30
30
  end
31
31
 
@@ -1,6 +1,6 @@
1
- require 'pathname'
2
- require 'autoproj/exceptions'
3
- require 'autobuild/environment'
1
+ require "pathname"
2
+ require "autoproj/exceptions"
3
+ require "autobuild/environment"
4
4
 
5
5
  module Autoproj
6
6
  module Ops
@@ -10,7 +10,7 @@ module Autoproj
10
10
  # `cmd` is not executable. Otherwise, looks for an executable named
11
11
  # `cmd` in PATH and returns it, or raises if it cannot be found. The
12
12
  # exception contains a more detailed reason for failure
13
- #
13
+ #
14
14
  #
15
15
  # @param [String] cmd
16
16
  # @return [String] the resolved program
@@ -20,24 +20,27 @@ module Autoproj
20
20
  path = Pathname.new(cmd)
21
21
  if path.absolute?
22
22
  if path.file? && path.executable?
23
- return cmd
23
+ cmd
24
24
  elsif path.exist?
25
- raise ExecutableNotFound.new(cmd), "given command `#{cmd}` exists but is not an executable file"
25
+ raise ExecutableNotFound.new(cmd),
26
+ "given command `#{cmd}` exists but is not an executable file"
26
27
  else
27
- raise ExecutableNotFound.new(cmd), "given command `#{cmd}` does not exist, an executable file was expected"
28
+ raise ExecutableNotFound.new(cmd),
29
+ "given command `#{cmd}` does not exist, "\
30
+ "an executable file was expected"
28
31
  end
29
32
  else
30
- if path_entries.respond_to?(:call)
31
- path_entries = path_entries.call
32
- end
33
+ path_entries = path_entries.call if path_entries.respond_to?(:call)
33
34
  absolute = Autobuild::Environment.find_executable_in_path(cmd, path_entries)
34
35
 
35
36
  if absolute
36
- return absolute
37
- elsif file = Autobuild::Environment.find_in_path(cmd, path_entries)
38
- raise ExecutableNotFound.new(cmd), "`#{cmd}` resolves to #{file} which is not executable"
37
+ absolute
38
+ elsif (file = Autobuild::Environment.find_in_path(cmd, path_entries))
39
+ raise ExecutableNotFound.new(cmd),
40
+ "`#{cmd}` resolves to #{file} which is not executable"
39
41
  else
40
- raise ExecutableNotFound.new(cmd), "cannot resolve `#{cmd}` to an executable in the workspace"
42
+ raise ExecutableNotFound.new(cmd),
43
+ "cannot resolve `#{cmd}` to an executable in the workspace"
41
44
  end
42
45
  end
43
46
  end
@@ -4,51 +4,61 @@ module Autoproj
4
4
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
5
5
  config.override(option_name, value)
6
6
  end
7
+
7
8
  # @deprecated use config.reset instead
8
9
  def self.reset_option(key)
9
10
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
10
11
  config.reset(key)
11
12
  end
13
+
12
14
  # @deprecated use config.set(key, value, user_validated) instead
13
15
  def self.change_option(key, value, user_validated = false)
14
16
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
15
17
  config.set(key, value, user_validated)
16
18
  end
19
+
17
20
  # @deprecated use config.validated_values instead
18
21
  def self.option_set
19
22
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
20
23
  config.validated_values
21
24
  end
25
+
22
26
  # @deprecated use config.get(key) instead
23
27
  def self.user_config(key)
24
28
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
25
29
  config.get(key)
26
30
  end
31
+
27
32
  # @deprecated use config.declare(name, type, options, &validator) instead
28
33
  def self.configuration_option(name, type, options, &validator)
29
34
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
30
35
  config.declare(name, type, options, &validator)
31
36
  end
37
+
32
38
  # @deprecated use config.declared?(name, type, options, &validator) instead
33
39
  def self.declared_option?(name)
34
40
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
35
41
  config.declared?(name)
36
42
  end
43
+
37
44
  # @deprecated use config.configure(option_name) instead
38
45
  def self.configure(option_name)
39
46
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
40
47
  config.configure(option_name)
41
48
  end
49
+
42
50
  # @deprecated use config.has_value_for?(name)
43
51
  def self.has_config_key?(name)
44
52
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
45
53
  config.has_value_for?(name)
46
54
  end
55
+
47
56
  # @deprecated use config.shell_helpers? instead
48
57
  def self.shell_helpers?
49
58
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
50
59
  config.shell_helpers?
51
60
  end
61
+
52
62
  # @deprecated use config.shell_helpers= instead
53
63
  def self.shell_helpers=(flag)
54
64
  Autoproj.warn_deprecated __method__, "use the API on Autoproj.config (from Autoproj::Configuration) instead"
@@ -67,6 +77,7 @@ module Autoproj
67
77
  class << self
68
78
  attr_accessor :reconfigure
69
79
  end
70
- def self.reconfigure?; @reconfigure end
80
+ def self.reconfigure?
81
+ @reconfigure
82
+ end
71
83
  end
72
-