autoproj 2.12.1 → 2.15.1

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 +6 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +3 -3
  14. data/bin/autoproj_bootstrap +225 -200
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +224 -199
  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 +66 -36
  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 +217 -205
  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 +56 -44
  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 +97 -43
  58. data/lib/autoproj/cli/utility.rb +14 -12
  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 +78 -86
  65. data/lib/autoproj/default.osdeps +29 -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 +139 -132
  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 +519 -507
  80. data/lib/autoproj/ops/import.rb +88 -63
  81. data/lib/autoproj/ops/install.rb +218 -192
  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 +145 -114
  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 +131 -106
  125. data/lib/autoproj/variable_expansion.rb +10 -10
  126. data/lib/autoproj/vcs_definition.rb +53 -37
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +143 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -53
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +86 -65
  133. data/.travis.yml +0 -22
@@ -29,18 +29,18 @@ module Autoproj
29
29
  #
30
30
  class SourcePackageQuery < QueryBase
31
31
  ALLOWED_FIELDS = [
32
- 'autobuild.name',
33
- 'autobuild.srcdir',
34
- 'autobuild.class.name',
35
- 'vcs.type',
36
- 'vcs.url',
37
- 'package_set.name'
32
+ "autobuild.name",
33
+ "autobuild.srcdir",
34
+ "autobuild.class.name",
35
+ "vcs.type",
36
+ "vcs.url",
37
+ "package_set.name"
38
38
  ]
39
39
  DEFAULT_FIELDS = {
40
- 'name' => 'autobuild.name',
41
- 'class' => 'autobuild.class.name',
42
- 'vcs' => 'vcs.url',
43
- 'package_set' => 'package_set.name'
40
+ "name" => "autobuild.name",
41
+ "class" => "autobuild.class.name",
42
+ "vcs" => "vcs.url",
43
+ "package_set" => "package_set.name"
44
44
  }
45
45
 
46
46
  # Match priorities
@@ -52,18 +52,18 @@ module Autoproj
52
52
  def initialize(fields, value, partial)
53
53
  super(fields, value, partial)
54
54
 
55
- directories = value.split('/')
56
- if !directories.empty?
55
+ directories = value.split("/")
56
+ unless directories.empty?
57
57
  @use_dir_prefix = true
58
- rx = directories.
59
- map { |d| "#{Regexp.quote(d)}\\w*" }.
60
- join("/")
58
+ rx = directories
59
+ .map { |d| "#{Regexp.quote(d)}\\w*" }
60
+ .join("/")
61
61
  rx = Regexp.new(rx, true)
62
62
  @dir_prefix_weak_rx = rx
63
63
 
64
- rx_strict = directories[0..-2].
65
- map { |d| "#{Regexp.quote(d)}\\w*" }.
66
- join("/")
64
+ rx_strict = directories[0..-2]
65
+ .map { |d| "#{Regexp.quote(d)}\\w*" }
66
+ .join("/")
67
67
  rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$", true)
68
68
  @dir_prefix_strong_rx = rx_strict
69
69
  end
@@ -95,38 +95,32 @@ module Autoproj
95
95
  pkg_value = fields.inject(pkg) { |v, field_name| v.send(field_name) }
96
96
  pkg_value = pkg_value.to_s
97
97
 
98
- if pkg_value == value
99
- return EXACT
100
- end
98
+ return EXACT if pkg_value == value
101
99
 
102
- if !partial?
103
- return
104
- end
100
+ return unless partial?
105
101
 
106
- if @value_rx === pkg_value
107
- return PARTIAL
108
- end
102
+ return PARTIAL if @value_rx === pkg_value
109
103
 
110
104
  # Special match for directories: match directory prefixes
111
105
  if use_dir_prefix?
112
106
  if @dir_prefix_strong_rx === pkg_value
113
- return DIR_PREFIX_STRONG
107
+ DIR_PREFIX_STRONG
114
108
  elsif @dir_prefix_weak_rx === pkg_value
115
- return DIR_PREFIX_WEAK
109
+ DIR_PREFIX_WEAK
116
110
  end
117
111
  end
118
112
  end
119
113
 
120
114
  # Parse a single field in a query (i.e. a FIELD[=~]VALUE string)
121
115
  def self.parse(str)
122
- if str !~ /[=~]/
123
- match_name = parse("autobuild.name~#{str}")
124
- match_dir = parse("autobuild.srcdir~#{str}")
125
- return Or.new([match_name, match_dir])
126
- else
116
+ if str =~ /[=~]/
127
117
  fields, value, partial =
128
118
  super(str, default_fields: DEFAULT_FIELDS, allowed_fields: ALLOWED_FIELDS)
129
- return new(fields, value, partial)
119
+ new(fields, value, partial)
120
+ else
121
+ match_name = parse("autobuild.name~#{str}")
122
+ match_dir = parse("autobuild.srcdir~#{str}")
123
+ Or.new([match_name, match_dir])
130
124
  end
131
125
  end
132
126
  end
@@ -134,4 +128,3 @@ module Autoproj
134
128
  # For backward compatibility
135
129
  Query = SourcePackageQuery
136
130
  end
137
-
@@ -11,7 +11,7 @@ module Autoproj
11
11
 
12
12
  # Returns true if +path+ is part of an autoproj installation
13
13
  def self.in_autoproj_installation?(path)
14
- !!find_workspace_dir(path, 'workspace')
14
+ !!find_workspace_dir(path, "workspace")
15
15
  end
16
16
 
17
17
  # Forcefully sets the root directory
@@ -22,6 +22,7 @@ module Autoproj
22
22
  if @workspace && dir != @workspace.root_dir
23
23
  raise WorkspaceAlreadyCreated, "cannot switch global root directory after a workspace object got created"
24
24
  end
25
+
25
26
  @root_dir = dir
26
27
  end
27
28
 
@@ -36,10 +37,10 @@ module Autoproj
36
37
  @root_dir = ni
37
38
  return
38
39
  end
40
+
39
41
  path = Autoproj.find_workspace_dir(dir)
40
- if !path
41
- raise UserError, "not in a Autoproj installation"
42
- end
42
+ raise UserError, "not in a Autoproj installation" unless path
43
+
43
44
  path
44
45
  end
45
46
 
@@ -49,12 +50,14 @@ module Autoproj
49
50
  caller.each { |l| Autoproj.warn " #{l}" }
50
51
  workspace.config_dir
51
52
  end
53
+
52
54
  # @deprecated use workspace.overrides_dir instead
53
55
  def self.overrides_dir
54
56
  Autoproj.warn "#{__method__} is deprecated, use workspace.overrides_dir instead"
55
57
  caller.each { |l| Autoproj.warn " #{l}" }
56
58
  workspace.overrides_dir
57
59
  end
60
+
58
61
  # @deprecated use Autobuild.find_in_path instead
59
62
  #
60
63
  # Warning: the autobuild method returns nil (instead of raising) if the
@@ -62,62 +65,71 @@ module Autoproj
62
65
  def self.find_in_path(name)
63
66
  Autoproj.warn "#{__method__} is deprecated, use Autobuild.find_in_path instead"
64
67
  caller.each { |l| Autoproj.warn " #{l}" }
65
- if path = Autobuild.find_in_path(name)
66
- return path
67
- else raise ArgumentError, "cannot find #{name} in PATH (#{ENV['PATH']})"
68
+ unless (path = Autobuild.find_in_path(name))
69
+ raise ArgumentError, "cannot find #{name} in PATH (#{ENV['PATH']})"
68
70
  end
71
+
72
+ path
69
73
  end
74
+
70
75
  # @deprecated use workspace.prefix_dir instead
71
76
  def self.prefix
72
- Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir')
77
+ Autoproj.warn_deprecated(__method__, "workspace.prefix_dir")
73
78
  workspace.prefix_dir
74
79
  end
80
+
75
81
  # @deprecated use workspace.prefix_dir= instead
76
82
  def self.prefix=(path)
77
- Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir=')
83
+ Autoproj.warn_deprecated(__method__, "workspace.prefix_dir=")
78
84
  workspace.prefix_dir = path
79
85
  end
86
+
80
87
  # @deprecated use workspace.prefix_dir instead
81
88
  def self.build_dir
82
- Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir')
89
+ Autoproj.warn_deprecated(__method__, "workspace.prefix_dir")
83
90
  workspace.prefix_dir
84
91
  end
92
+
85
93
  # @deprecated compute the full path with File.join(config_dir, file)
86
94
  # directly instead
87
95
  def self.config_file(file)
88
- Autoproj.warn_deprecated(__method__, 'compute the full path with File.join(config_dir, ...) instead')
96
+ Autoproj.warn_deprecated(__method__, "compute the full path with File.join(config_dir, ...) instead")
89
97
  File.join(config_dir, file)
90
98
  end
99
+
91
100
  # @deprecated use workspace.remotes_dir instead
92
101
  def self.remotes_dir
93
- Autoproj.warn_deprecated(__method__, 'use workspace.remotes_dir instead')
102
+ Autoproj.warn_deprecated(__method__, "use workspace.remotes_dir instead")
94
103
  workspace.remotes_dir
95
104
  end
105
+
96
106
  # @deprecated use workspace.load or add a separate Loader object to your class
97
107
  def self.load(package_set, *path)
98
108
  Autoproj.warn_deprecated(
99
109
  __method__,
100
- 'use workspace.load or add a separate Loader object to your class')
110
+ "use workspace.load or add a separate Loader object to your class"
111
+ )
101
112
  workspace.load(package_set, *path)
102
113
  end
114
+
103
115
  # @deprecated use workspace.load_if_present or add a separate Loader object to your class
104
116
  def self.load_if_present(package_set, *path)
105
117
  Autoproj.warn_deprecated(
106
118
  __method__,
107
- 'use workspace.load_if_present or add a separate Loader object to your class')
119
+ "use workspace.load_if_present or add a separate Loader object to your class"
120
+ )
108
121
  workspace.load_if_present(package_set, *path)
109
122
  end
110
123
 
111
124
  # Run the provided command as user
112
125
  def self.run_as_user(*args)
113
- if !system(*args)
114
- raise "failed to run #{args.join(" ")}"
115
- end
126
+ raise "failed to run #{args.join(' ')}" unless system(*args)
116
127
  end
128
+
117
129
  # Run the provided command as root, using sudo to gain root access
118
- def self.run_as_root(*args, env: self.workspace.env)
119
- if !system(Autobuild.tool_in_path('sudo', env: env), *args)
120
- raise "failed to run #{args.join(" ")} as root"
130
+ def self.run_as_root(*args, env: workspace.env)
131
+ unless system(Autobuild.tool_in_path("sudo", env: env), *args)
132
+ raise "failed to run #{args.join(' ')} as root"
121
133
  end
122
134
  end
123
135
 
@@ -135,4 +147,3 @@ module Autoproj
135
147
  end
136
148
  end
137
149
  end
138
-