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,10 +1,10 @@
1
- require 'pathname'
2
- require 'yaml'
1
+ require "pathname"
2
+ require "yaml"
3
3
 
4
4
  module Autoproj
5
5
  # The base path from which we search for workspaces
6
6
  def self.default_find_base_dir
7
- ENV['AUTOPROJ_CURRENT_ROOT'] || Dir.pwd
7
+ ENV["AUTOPROJ_CURRENT_ROOT"] || Dir.pwd
8
8
  end
9
9
 
10
10
  # Looks for the autoproj workspace that is related to a given directory
@@ -29,19 +29,16 @@ module Autoproj
29
29
  # if base_dir is not part of a workspace
30
30
  def self.find_v2_workspace_config(base_dir)
31
31
  path = Pathname.new(base_dir).expand_path
32
- while !path.root?
33
- if (path + ".autoproj" + "config.yml").exist?
34
- break
35
- end
32
+ until path.root?
33
+ break if path.join(".autoproj", "config.yml").exist?
34
+
36
35
  path = path.parent
37
36
  end
38
37
 
39
- if path.root?
40
- return
41
- end
38
+ return if path.root?
42
39
 
43
- config_path = path + ".autoproj" + "config.yml"
44
- return path.to_s, (YAML.load(config_path.read) || Hash.new)
40
+ config_path = path.join(".autoproj", "config.yml")
41
+ [path.to_s, (YAML.load(config_path.read) || Hash.new)]
45
42
  end
46
43
 
47
44
  # @private
@@ -58,17 +55,18 @@ module Autoproj
58
55
  # there's none
59
56
  def self.find_v2_root_dir(base_dir, config_field_name)
60
57
  path, config = find_v2_workspace_config(base_dir)
61
- return if !path
58
+ return unless path
59
+
62
60
  result = config[config_field_name] || path.to_s
63
61
  result = File.expand_path(result, path.to_s)
64
- if result == path.to_s
65
- return result
66
- end
62
+ return result if result == path.to_s
63
+
67
64
  resolved = find_v2_root_dir(result, config_field_name)
68
65
 
69
66
  if !resolved || (resolved != result)
70
67
  raise ArgumentError, "found #{path} as possible workspace root for #{base_dir}, but it contains a configuration file that points to #{result} and #{result} is not an autoproj workspace root"
71
68
  end
69
+
72
70
  resolved
73
71
  end
74
72
 
@@ -84,7 +82,7 @@ module Autoproj
84
82
  ws_path, ws_config = find_v2_workspace_config(p)
85
83
  if ws_path
86
84
  known_workspace_dirs << "#{ws_path}/"
87
- if ws_dir = ws_config['workspace']
85
+ if (ws_dir = ws_config["workspace"])
88
86
  known_workspace_dirs << "#{ws_dir}/"
89
87
  end
90
88
  false
@@ -97,12 +95,12 @@ module Autoproj
97
95
 
98
96
  # {#find_workspace_dir} for v2 workspaces
99
97
  def self.find_v2_workspace_dir(base_dir = default_find_base_dir)
100
- find_v2_root_dir(base_dir, 'workspace')
98
+ find_v2_root_dir(base_dir, "workspace")
101
99
  end
102
100
 
103
101
  # {#find_prefix_dir} for v2 workspaces
104
102
  def self.find_v2_prefix_dir(base_dir = default_find_base_dir)
105
- find_v2_root_dir(base_dir, 'prefix')
103
+ find_v2_root_dir(base_dir, "prefix")
106
104
  end
107
105
 
108
106
  # {#find_workspace_dir} for v1 workspaces
@@ -110,15 +108,12 @@ module Autoproj
110
108
  # Note that for v1 workspaces {#find_prefix_dir} cannot be implemented
111
109
  def self.find_v1_workspace_dir(base_dir = default_find_base_dir)
112
110
  path = Pathname.new(base_dir)
113
- while !path.root?
114
- if (path + "autoproj").exist?
115
- if !(path + ".autoproj").exist?
116
- return path.to_s
117
- end
111
+ until path.root?
112
+ if path.join("autoproj").exist?
113
+ return path.to_s unless path.join(".autoproj").exist?
118
114
  end
119
115
  path = path.parent
120
116
  end
121
117
  nil
122
118
  end
123
119
  end
124
-
@@ -1,16 +1,15 @@
1
1
  module Autoproj
2
- GIT_SERVER_CONFIG_VARS = %w{_ROOT _PUSH_ROOT _PRIVATE_ROOT}
2
+ GIT_SERVER_CONFIG_VARS = %w[_ROOT _PUSH_ROOT _PRIVATE_ROOT]
3
3
 
4
4
  GIT_SERVER_ACCESS_METHODS = Hash[
5
- 'git' => 'git,ssh',
6
- 'ssh' => 'ssh,ssh',
7
- 'http' => 'http,http']
8
-
5
+ "git" => "git,ssh",
6
+ "ssh" => "ssh,ssh",
7
+ "http" => "http,http"]
9
8
 
10
9
  # @api private
11
10
  #
12
11
  # Helper for {.git_server_configuration}
13
- def self.git_server_validate_config_value(base_url, value, disabled_methods: )
12
+ def self.git_server_validate_config_value(base_url, value, disabled_methods:)
14
13
  values = (GIT_SERVER_ACCESS_METHODS[value] || value).split(",")
15
14
  values.each do |access_method|
16
15
  if !GIT_SERVER_ACCESS_METHODS.has_key?(access_method)
@@ -25,7 +24,7 @@ module Autoproj
25
24
  # @api private
26
25
  #
27
26
  # Helper for {.git_server_configuration}
28
- def self.git_server_resolve_master_config(name, config, base_url: , git_url: , http_url: , ssh_url: , disabled_methods: )
27
+ def self.git_server_resolve_master_config(name, config, base_url:, git_url:, http_url:, ssh_url:, disabled_methods:)
29
28
  access_mode = config.get(name)
30
29
  begin
31
30
  git_server_validate_config_value(base_url, access_mode, disabled_methods: disabled_methods)
@@ -35,7 +34,7 @@ module Autoproj
35
34
  access_mode = config.get(name)
36
35
  end
37
36
  access_mode = GIT_SERVER_ACCESS_METHODS[access_mode] || access_mode
38
- pull, push, private_pull = access_mode.split(',')
37
+ pull, push, private_pull = access_mode.split(",")
39
38
  private_pull ||= push
40
39
  [[pull, "_ROOT"], [push, "_PUSH_ROOT"], [private_pull, "_PRIVATE_ROOT"]].each do |method, var_suffix|
41
40
  url = if method == "git" then git_url
@@ -44,7 +43,7 @@ module Autoproj
44
43
  end
45
44
  config.set("#{name}#{var_suffix}", url)
46
45
  end
47
- return pull, push, private_pull
46
+ [pull, push, private_pull]
48
47
  end
49
48
 
50
49
  # Adds the relevant options to handle a gitorious server
@@ -67,53 +66,50 @@ module Autoproj
67
66
  # which would be expanded to the expected URLs for pull and push.
68
67
  #
69
68
  def self.git_server_configuration(name, base_url,
70
- git_url: "git://#{base_url}",
71
- http_url: "https://git.#{base_url}",
72
- ssh_url: "git@#{base_url}:",
73
- default: 'http,ssh',
74
- disabled_methods: [],
75
- config: Autoproj.config,
76
- fallback_to_http: nil,
77
- lazy: false)
69
+ git_url: "git://#{base_url}",
70
+ http_url: "https://git.#{base_url}",
71
+ ssh_url: "git@#{base_url}:",
72
+ default: "http,ssh",
73
+ disabled_methods: [],
74
+ config: Autoproj.config,
75
+ fallback_to_http: nil,
76
+ lazy: false)
78
77
 
79
78
  disabled_methods = Array(disabled_methods)
80
79
 
81
80
  long_doc = [
82
- "How should I interact with #{base_url} (#{(GIT_SERVER_ACCESS_METHODS.keys - disabled_methods).sort.join(", ")})",
81
+ "How should I interact with #{base_url} (#{(GIT_SERVER_ACCESS_METHODS.keys - disabled_methods).sort.join(', ')})",
83
82
  "If you give one value, it's going to be the method used for all access",
84
83
  "If you give multiple values, comma-separated, the first one will be",
85
84
  "used for pulling and the second one for pushing. An optional third value",
86
85
  "will be used to pull from private repositories (the same than pushing is",
87
- "used by default)"]
86
+ "used by default)"
87
+ ]
88
88
 
89
- config.declare name, 'string', default: default, doc: long_doc do |value|
89
+ config.declare name, "string", default: default, doc: long_doc do |value|
90
90
  git_server_validate_config_value(base_url, value, disabled_methods: disabled_methods)
91
91
  end
92
92
 
93
- if !lazy
93
+ unless lazy
94
94
  pull, push, private_pull = git_server_resolve_master_config(name, config,
95
- base_url: base_url,
96
- git_url: git_url,
97
- http_url: http_url,
98
- ssh_url: ssh_url,
99
- disabled_methods: disabled_methods)
95
+ base_url: base_url,
96
+ git_url: git_url,
97
+ http_url: http_url,
98
+ ssh_url: ssh_url,
99
+ disabled_methods: disabled_methods)
100
100
  end
101
101
 
102
102
  Autoproj.add_source_handler name.downcase do |url, private: false, **vcs_options|
103
- if url !~ /\.git$/
104
- url += ".git"
105
- end
106
- if url !~ /^\//
107
- url = "/#{url}"
108
- end
103
+ url += ".git" if url !~ /\.git$/
104
+ url = "/#{url}" if url !~ /^\//
109
105
 
110
- if !GIT_SERVER_CONFIG_VARS.all? { |v| config.has_value_for?("#{name}#{v}") }
106
+ unless GIT_SERVER_CONFIG_VARS.all? { |v| config.has_value_for?("#{name}#{v}") }
111
107
  pull, push, private_pull = git_server_resolve_master_config(name, config,
112
- base_url: base_url,
113
- git_url: git_url,
114
- http_url: http_url,
115
- ssh_url: ssh_url,
116
- disabled_methods: disabled_methods)
108
+ base_url: base_url,
109
+ git_url: git_url,
110
+ http_url: http_url,
111
+ ssh_url: ssh_url,
112
+ disabled_methods: disabled_methods)
117
113
  end
118
114
  pull_base_url =
119
115
  if private
@@ -122,10 +118,10 @@ module Autoproj
122
118
  config.get("#{name}_ROOT")
123
119
  end
124
120
  push_base_url = config.get("#{name}_PUSH_ROOT")
125
- Hash[type: 'git',
121
+ Hash[type: "git",
126
122
  url: "#{pull_base_url}#{url}",
127
123
  push_to: "#{push_base_url}#{url}",
128
- interactive: (private && private_pull == 'http'),
124
+ interactive: (private && private_pull == "http"),
129
125
  retry_count: 10,
130
126
  repository_id: "#{name.downcase}:#{url}"].merge(vcs_options)
131
127
  end
@@ -133,14 +129,14 @@ module Autoproj
133
129
 
134
130
  def self.gitorious_server_configuration(name, base_url, **options)
135
131
  Autoproj.warn_deprecated "gitorious_server_configuration",
136
- "use require 'git_server_configuration' and
132
+ "use require 'git_server_configuration' and
137
133
  Autoproj.git_server_configuration instead. note that the method call
138
134
  interface has not changed, you just have to change the name(s)"
139
135
  git_server_configuration(name, base_url, **options)
140
136
  end
141
137
  end
142
138
 
143
- if !$autoproj_disable_github_gitorious_definitions
144
- Autoproj.git_server_configuration('GITORIOUS', 'gitorious.org', default: 'http,ssh', disabled_methods: 'git', lazy: true)
145
- Autoproj.git_server_configuration('GITHUB', 'github.com', http_url: 'https://github.com', default: 'http,ssh')
139
+ unless $autoproj_disable_github_gitorious_definitions
140
+ Autoproj.git_server_configuration("GITORIOUS", "gitorious.org", default: "http,ssh", disabled_methods: "git", lazy: true)
141
+ Autoproj.git_server_configuration("GITHUB", "github.com", http_url: "https://github.com", default: "http,ssh")
146
142
  end
@@ -1 +1 @@
1
- require 'autoproj/git_server_configuration'
1
+ require "autoproj/git_server_configuration"
@@ -8,33 +8,76 @@ module Autoproj
8
8
  attr_reader :path
9
9
  attr_reader :packages
10
10
  attr_reader :package_sets
11
- def initialize(path)
11
+
12
+ def initialize(path = nil)
12
13
  @path = path
13
14
  @packages = Hash.new
14
15
  @package_sets = Hash.new
15
16
  end
16
17
 
17
18
  def exist?
18
- File.exist?(path)
19
+ File.exist?(path) if path
19
20
  end
20
21
 
22
+ # Add a {PackageDefinition} to this manifest
23
+ #
24
+ # @return [Package] the package in the installation manifest format
21
25
  def add_package(pkg)
22
- packages[pkg.name] = pkg
26
+ packages[pkg.name] =
27
+ case pkg
28
+ when PackageDefinition
29
+ v = pkg.autobuild
30
+ Package.new(
31
+ v.name, v.class.name, pkg.vcs.to_hash, v.srcdir,
32
+ (v.importdir if v.respond_to?(:importdir)),
33
+ v.prefix,
34
+ (v.builddir if v.respond_to?(:builddir)),
35
+ v.logdir, v.dependencies
36
+ )
37
+ else
38
+ pkg
39
+ end
23
40
  end
24
41
 
42
+ # Add a {Autoproj::PackageSet} to this manifest
43
+ #
44
+ # @return [PackageSet] the package set in the installation manifest format
25
45
  def add_package_set(pkg_set)
26
- package_sets[pkg_set.name] = pkg_set
46
+ package_sets[pkg_set.name] = PackageSet.new(
47
+ pkg_set.name, pkg_set.vcs.to_hash,
48
+ pkg_set.raw_local_dir, pkg_set.user_local_dir
49
+ )
27
50
  end
28
51
 
52
+ # Enumerate this {InstallationManifest}'s package sets
53
+ #
54
+ # @yieldparam [PackageSet]
29
55
  def each_package_set(&block)
30
56
  package_sets.each_value(&block)
31
57
  end
32
58
 
59
+ # Enumerate this {InstallationManifest}'s packages
60
+ #
61
+ # @yieldparam [Package]
33
62
  def each_package(&block)
34
63
  packages.each_value(&block)
35
64
  end
36
65
 
37
- def load
66
+ # Resolve a package set by name
67
+ #
68
+ # @return [Package]
69
+ def find_package_set_by_name(name)
70
+ @package_sets[name]
71
+ end
72
+
73
+ # Resolve a package by name
74
+ #
75
+ # @return [Package]
76
+ def find_package_by_name(name)
77
+ @packages[name]
78
+ end
79
+
80
+ def load(path = @path)
38
81
  @packages = Hash.new
39
82
  raw = YAML.load(File.open(path))
40
83
  if raw.respond_to?(:to_str) # old CSV-based format
@@ -46,14 +89,16 @@ module Autoproj
46
89
  save(path)
47
90
  else
48
91
  raw.each do |entry|
49
- if entry['package_set']
92
+ if entry["package_set"]
50
93
  pkg_set = PackageSet.new(
51
- entry['package_set'], entry['vcs'], entry['raw_local_dir'], entry['user_local_dir'])
94
+ entry["package_set"], entry["vcs"], entry["raw_local_dir"], entry["user_local_dir"]
95
+ )
52
96
  package_sets[pkg_set.name] = pkg_set
53
97
  else
54
98
  pkg = Package.new(
55
- entry['name'], entry['type'], entry['vcs'], entry['srcdir'], entry['importdir'],
56
- entry['prefix'], entry['builddir'], entry['logdir'], entry['dependencies'])
99
+ entry["name"], entry["type"], entry["vcs"], entry["srcdir"], entry["importdir"],
100
+ entry["prefix"], entry["builddir"], entry["logdir"], entry["dependencies"]
101
+ )
57
102
  packages[pkg.name] = pkg
58
103
  end
59
104
  end
@@ -61,25 +106,15 @@ module Autoproj
61
106
  end
62
107
 
63
108
  # Save the installation manifest
64
- def save(path = self.path)
109
+ def save(path = @path)
65
110
  Ops.atomic_write(path) do |io|
66
- marshalled_package_sets = each_package_set.map do |v|
67
- Hash['package_set' => v.name,
68
- 'vcs' => v.vcs.to_hash,
69
- 'raw_local_dir' => v.raw_local_dir,
70
- 'user_local_dir' => v.user_local_dir]
111
+ marshalled_package_sets = each_package_set.map do |pkg_set|
112
+ set = pkg_set.to_h.transform_keys(&:to_s)
113
+ set["package_set"] = set["name"]
114
+ set
71
115
  end
72
- marshalled_packages = each_package.map do |package_def|
73
- v = package_def.autobuild
74
- Hash['name' => v.name,
75
- 'type' => v.class.name,
76
- 'vcs' => package_def.vcs.to_hash,
77
- 'srcdir' => v.srcdir,
78
- 'importdir' => (v.importdir if v.respond_to?(:importdir)),
79
- 'builddir' => (v.builddir if v.respond_to?(:builddir)),
80
- 'logdir' => v.logdir,
81
- 'prefix' => v.prefix,
82
- 'dependencies' => v.dependencies]
116
+ marshalled_packages = each_package.map do |pkg|
117
+ pkg.to_h.transform_keys(&:to_s)
83
118
  end
84
119
  io.write YAML.dump(marshalled_package_sets + marshalled_packages)
85
120
  end
@@ -91,18 +126,18 @@ module Autoproj
91
126
  # @param [String] root_dir
92
127
  # @return [String]
93
128
  def self.path_for_workspace_root(root_dir)
94
- File.join(root_dir, '.autoproj', 'installation-manifest')
129
+ File.join(root_dir, ".autoproj", "installation-manifest")
95
130
  end
96
131
 
97
132
  def self.from_workspace_root(root_dir)
98
133
  path = path_for_workspace_root(root_dir)
99
134
  manifest = InstallationManifest.new(path)
100
- if !manifest.exist?
135
+ unless manifest.exist?
101
136
  raise ConfigError.new, "no #{path} file found. You should probably rerun autoproj envsh in that folder first"
102
137
  end
138
+
103
139
  manifest.load
104
140
  manifest
105
141
  end
106
142
  end
107
143
  end
108
-
@@ -3,7 +3,7 @@ module Autoproj
3
3
  # in autoproj/
4
4
  class LocalPackageSet < PackageSet
5
5
  def initialize(ws, local_dir: ws.config_dir)
6
- super(ws, VCSDefinition.none, name: 'main configuration', raw_local_dir: local_dir)
6
+ super(ws, VCSDefinition.none, name: "main configuration", raw_local_dir: local_dir)
7
7
  @local_dir = local_dir
8
8
  end
9
9
 
@@ -28,7 +28,7 @@ module Autoproj
28
28
  end
29
29
 
30
30
  def overrides_file_path
31
- if d = local_dir
31
+ if (d = local_dir)
32
32
  File.join(d, "overrides.yml")
33
33
  end
34
34
  end
@@ -47,7 +47,7 @@ module Autoproj
47
47
  # Load the files in overrides.d in addition to the overrides: field in
48
48
  # the yaml file
49
49
  def load_overrides(source_definition)
50
- files = Dir.glob(File.join( ws.overrides_dir, "*.yml" ) ).sort
50
+ files = Dir.glob(File.join(ws.overrides_dir, "*.yml")).sort
51
51
  overrides = files.map do |file|
52
52
  source_data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do
53
53
  YAML.load(File.read(file)) || Array.new
@@ -55,7 +55,8 @@ module Autoproj
55
55
  source_data =
56
56
  if source_data.respond_to?(:to_ary)
57
57
  source_data
58
- else source_data['overrides'] || Hash.new
58
+ else
59
+ source_data["overrides"] || Hash.new
59
60
  end
60
61
  [file, source_data]
61
62
  end
@@ -64,24 +65,25 @@ module Autoproj
64
65
 
65
66
  def raw_description_file
66
67
  description = Hash[
67
- 'imports' => Array.new,
68
- 'version_control' => Array.new,
69
- 'overrides' => Array.new]
68
+ "imports" => Array.new,
69
+ "version_control" => Array.new,
70
+ "overrides" => Array.new]
70
71
  if File.file?(overrides_file_path)
71
72
  overrides_data = Autoproj.in_file(overrides_file_path, Autoproj::YAML_LOAD_ERROR) do
72
73
  YAML.load(File.read(overrides_file_path)) || Hash.new
73
74
  end
74
75
  overrides_data = PackageSet.validate_and_normalize_source_file(
75
- overrides_file_path, overrides_data)
76
+ overrides_file_path, overrides_data
77
+ )
76
78
  description = description.merge(overrides_data)
77
79
  end
78
80
 
79
81
  manifest_data = Autoproj.in_file(manifest_path, Autoproj::YAML_LOAD_ERROR) do
80
82
  YAML.load(File.read(manifest_path)) || Hash.new
81
83
  end
82
- description['imports'] = description['imports'].
83
- concat(manifest_data['package_sets'] || Array.new)
84
- description['name'] = name
84
+ description["imports"] = description["imports"]
85
+ .concat(manifest_data["package_sets"] || Array.new)
86
+ description["name"] = name
85
87
  description
86
88
  end
87
89
  end