dependabot-cargo 0.340.0 → 0.341.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81b5078d121895148890b7f204e56c8622297d1abe48d29f6a18f1f161d5a324
|
|
4
|
+
data.tar.gz: 127662908e03a996f1b62197083dace776b60854f6e797f769979768816a1a96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 453ee1deb7b4f3ef0518cfe7fe4e5455c30969df7595532af8b1e1a95999a082cf795327cd6c7d380ca8f29c9465f6af82659a6ee51ac77b07a4eeda2f84e78c
|
|
7
|
+
data.tar.gz: e1997255b35b8baa728b4cd5b97ad723dd1d3d64868f7a2e6d6e0eaca97d2a72d66fe28bae5bc1f52b9eda0af3e4e8ebfdfc07f88ec182a820e05bd9158e896a
|
|
@@ -57,6 +57,13 @@ module Dependabot
|
|
|
57
57
|
fetched_files << T.must(rust_toolchain) if rust_toolchain
|
|
58
58
|
fetched_files += fetch_path_dependency_and_workspace_files
|
|
59
59
|
|
|
60
|
+
# If the main Cargo.toml uses workspace dependencies, ensure we have the workspace root
|
|
61
|
+
parsed_manifest = parsed_file(cargo_toml)
|
|
62
|
+
if uses_workspace_dependencies?(parsed_manifest) || workspace_member?(parsed_manifest)
|
|
63
|
+
workspace_root = find_workspace_root(cargo_toml)
|
|
64
|
+
fetched_files << workspace_root if workspace_root && !fetched_files.include?(workspace_root)
|
|
65
|
+
end
|
|
66
|
+
|
|
60
67
|
# Filter excluded files from final collection
|
|
61
68
|
filtered_files = fetched_files.reject do |file|
|
|
62
69
|
Dependabot::FileFiltering.should_exclude_path?(file.name, "file from final collection", @exclude_paths)
|
|
@@ -131,17 +138,17 @@ module Dependabot
|
|
|
131
138
|
|
|
132
139
|
next if previously_fetched_files.map(&:name).include?(path)
|
|
133
140
|
next if file.name == path
|
|
134
|
-
|
|
135
141
|
next if Dependabot::FileFiltering.should_exclude_path?(path, "file from final collection", @exclude_paths)
|
|
136
142
|
|
|
137
143
|
fetched_file = fetch_file_from_host(path, fetch_submodules: true)
|
|
138
144
|
previously_fetched_files << fetched_file
|
|
139
|
-
grandchild_requirement_files =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
grandchild_requirement_files = fetch_workspace_files(
|
|
146
|
+
file: fetched_file,
|
|
147
|
+
previously_fetched_files: previously_fetched_files
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
workspace_root = workspace_root_for_file(fetched_file)
|
|
151
|
+
[fetched_file, *grandchild_requirement_files, workspace_root]
|
|
145
152
|
end.compact
|
|
146
153
|
|
|
147
154
|
files.each { |f| f.support_file = file != cargo_toml }
|
|
@@ -168,24 +175,18 @@ module Dependabot
|
|
|
168
175
|
|
|
169
176
|
next if previously_fetched_files.map(&:name).include?(path)
|
|
170
177
|
next if file.name == path
|
|
171
|
-
|
|
172
178
|
next if Dependabot::FileFiltering.should_exclude_path?(path, "file from final collection", @exclude_paths)
|
|
173
179
|
|
|
174
180
|
fetched_file = fetch_file_from_host(path, fetch_submodules: true)
|
|
175
181
|
.tap { |f| f.support_file = true }
|
|
176
182
|
previously_fetched_files << fetched_file
|
|
177
|
-
grandchild_requirement_files =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
# its root workspace, we search for the root to include it so Cargo can
|
|
185
|
-
# resolve the path dependency file manifest properly.
|
|
186
|
-
root = find_workspace_root(fetched_file) if workspace_member?(parsed_file(fetched_file))
|
|
187
|
-
|
|
188
|
-
[fetched_file, *grandchild_requirement_files, root]
|
|
183
|
+
grandchild_requirement_files = fetch_path_dependency_files(
|
|
184
|
+
file: fetched_file,
|
|
185
|
+
previously_fetched_files: previously_fetched_files
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
workspace_root = workspace_root_for_file(fetched_file)
|
|
189
|
+
[fetched_file, *grandchild_requirement_files, workspace_root]
|
|
189
190
|
rescue Dependabot::DependencyFileNotFound
|
|
190
191
|
next unless required_path?(file, path)
|
|
191
192
|
|
|
@@ -198,15 +199,21 @@ module Dependabot
|
|
|
198
199
|
unfetchable_required_path_deps
|
|
199
200
|
end
|
|
200
201
|
|
|
202
|
+
sig { params(file: Dependabot::DependencyFile).returns(T.nilable(Dependabot::DependencyFile)) }
|
|
203
|
+
def workspace_root_for_file(file)
|
|
204
|
+
parsed_manifest = parsed_file(file)
|
|
205
|
+
return unless workspace_member?(parsed_manifest) || uses_workspace_dependencies?(parsed_manifest)
|
|
206
|
+
|
|
207
|
+
find_workspace_root(file)
|
|
208
|
+
end
|
|
209
|
+
|
|
201
210
|
sig { params(dependencies: T::Hash[T.untyped, T.untyped]).returns(T::Array[String]) }
|
|
202
211
|
def collect_path_dependencies_paths(dependencies)
|
|
203
|
-
|
|
204
|
-
dependencies.each do |_, details|
|
|
212
|
+
dependencies.filter_map do |_, details|
|
|
205
213
|
next unless details.is_a?(Hash) && details["path"]
|
|
206
214
|
|
|
207
|
-
|
|
215
|
+
File.join(details["path"], "Cargo.toml").delete_prefix("/")
|
|
208
216
|
end
|
|
209
|
-
paths
|
|
210
217
|
end
|
|
211
218
|
|
|
212
219
|
# rubocop:enable Metrics/PerceivedComplexity
|
|
@@ -229,8 +236,7 @@ module Dependabot
|
|
|
229
236
|
end
|
|
230
237
|
end
|
|
231
238
|
|
|
232
|
-
paths
|
|
233
|
-
paths
|
|
239
|
+
paths + replacement_path_dependency_paths_from_file(file)
|
|
234
240
|
end
|
|
235
241
|
|
|
236
242
|
sig { params(file: Dependabot::DependencyFile).returns(T::Array[String]) }
|
|
@@ -239,8 +245,7 @@ module Dependabot
|
|
|
239
245
|
|
|
240
246
|
# Paths specified as replacements
|
|
241
247
|
parsed_file(file).fetch("replace", {}).each do |_, details|
|
|
242
|
-
next unless details.is_a?(Hash)
|
|
243
|
-
next unless details["path"]
|
|
248
|
+
next unless details.is_a?(Hash) && details["path"]
|
|
244
249
|
|
|
245
250
|
paths << File.join(details["path"], "Cargo.toml")
|
|
246
251
|
end
|
|
@@ -250,8 +255,7 @@ module Dependabot
|
|
|
250
255
|
next unless details.is_a?(Hash)
|
|
251
256
|
|
|
252
257
|
details.each do |_, dep_details|
|
|
253
|
-
next unless dep_details.is_a?(Hash)
|
|
254
|
-
next unless dep_details["path"]
|
|
258
|
+
next unless dep_details.is_a?(Hash) && dep_details["path"]
|
|
255
259
|
|
|
256
260
|
paths << File.join(dep_details["path"], "Cargo.toml")
|
|
257
261
|
end
|
|
@@ -260,6 +264,35 @@ module Dependabot
|
|
|
260
264
|
paths
|
|
261
265
|
end
|
|
262
266
|
|
|
267
|
+
# Check if this Cargo manifest uses workspace dependencies
|
|
268
|
+
# (e.g. dependency = { workspace = true }).
|
|
269
|
+
sig { params(parsed_manifest: T::Hash[T.untyped, T.untyped]).returns(T::Boolean) }
|
|
270
|
+
def uses_workspace_dependencies?(parsed_manifest)
|
|
271
|
+
# Check regular dependencies
|
|
272
|
+
workspace_deps = Cargo::FileParser::DEPENDENCY_TYPES.any? do |type|
|
|
273
|
+
deps = parsed_manifest.fetch(type, {})
|
|
274
|
+
deps.any? do |_, details|
|
|
275
|
+
next false unless details.is_a?(Hash)
|
|
276
|
+
|
|
277
|
+
details["workspace"] == true
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
return true if workspace_deps
|
|
282
|
+
|
|
283
|
+
# Check target-specific dependencies
|
|
284
|
+
parsed_manifest.fetch("target", {}).any? do |_, target_details|
|
|
285
|
+
Cargo::FileParser::DEPENDENCY_TYPES.any? do |type|
|
|
286
|
+
deps = target_details.fetch(type, {})
|
|
287
|
+
deps.any? do |_, details|
|
|
288
|
+
next false unless details.is_a?(Hash)
|
|
289
|
+
|
|
290
|
+
details["workspace"] == true
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
263
296
|
# See if this Cargo manifest inherits any property from a workspace
|
|
264
297
|
# (e.g. edition = { workspace = true }).
|
|
265
298
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T::Boolean) }
|
|
@@ -200,6 +200,12 @@ module Dependabot
|
|
|
200
200
|
raise Dependabot::DependencyFileNotEvaluatable, "Dependabot only supports toolchain 1.68 and up."
|
|
201
201
|
end
|
|
202
202
|
|
|
203
|
+
# ambiguous package specification
|
|
204
|
+
ambiguous_match = stdout.match(/There are multiple `([^`]+)` packages.*specification `([^`]+)` is ambiguous/)
|
|
205
|
+
if ambiguous_match
|
|
206
|
+
raise Dependabot::DependencyFileNotEvaluatable, "Ambiguous package specification: #{ambiguous_match[2]}"
|
|
207
|
+
end
|
|
208
|
+
|
|
203
209
|
# package doesn't exist in the index
|
|
204
210
|
if (match = stdout.match(/no matching package named `([^`]+)` found/))
|
|
205
211
|
raise Dependabot::DependencyFileNotResolvable, match[1]
|
|
@@ -18,14 +18,6 @@ module Dependabot
|
|
|
18
18
|
require_relative "file_updater/lockfile_updater"
|
|
19
19
|
require_relative "file_updater/workspace_manifest_updater"
|
|
20
20
|
|
|
21
|
-
sig { override.returns(T::Array[Regexp]) }
|
|
22
|
-
def self.updated_files_regex
|
|
23
|
-
[
|
|
24
|
-
/Cargo\.toml$/, # Matches Cargo.toml in the root directory or any subdirectory
|
|
25
|
-
/Cargo\.lock$/ # Matches Cargo.lock in the root directory or any subdirectory
|
|
26
|
-
]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
21
|
sig { override.returns(T::Array[Dependabot::DependencyFile]) }
|
|
30
22
|
def updated_dependency_files
|
|
31
23
|
# Returns an array of updated files. Only files that have been updated
|
|
@@ -118,6 +118,7 @@ module Dependabot
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
replace_req_on_target_specific_deps!(parsed_manifest, filename)
|
|
121
|
+
replace_req_on_workspace_deps!(parsed_manifest, filename)
|
|
121
122
|
|
|
122
123
|
TomlRB.dump(parsed_manifest)
|
|
123
124
|
end
|
|
@@ -148,6 +149,24 @@ module Dependabot
|
|
|
148
149
|
end
|
|
149
150
|
end
|
|
150
151
|
|
|
152
|
+
sig { params(parsed_manifest: T::Hash[String, T.untyped], filename: String).void }
|
|
153
|
+
def replace_req_on_workspace_deps!(parsed_manifest, filename)
|
|
154
|
+
workspace = parsed_manifest.fetch("workspace", {})
|
|
155
|
+
workspace_deps = workspace.fetch("dependencies", {})
|
|
156
|
+
|
|
157
|
+
workspace_deps.each do |name, req|
|
|
158
|
+
next unless dependency.name == name_from_declaration(name, req)
|
|
159
|
+
|
|
160
|
+
updated_req = temporary_requirement_for_resolution(filename)
|
|
161
|
+
|
|
162
|
+
if req.is_a?(Hash)
|
|
163
|
+
parsed_manifest["workspace"]["dependencies"][name]["version"] = updated_req
|
|
164
|
+
else
|
|
165
|
+
parsed_manifest["workspace"]["dependencies"][name] = updated_req
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
151
170
|
sig { params(content: String).returns(String) }
|
|
152
171
|
def replace_git_pin(content)
|
|
153
172
|
parsed_manifest = TomlRB.parse(content)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-cargo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.341.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.341.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.341.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -266,7 +266,7 @@ licenses:
|
|
|
266
266
|
- MIT
|
|
267
267
|
metadata:
|
|
268
268
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
269
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
269
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.341.0
|
|
270
270
|
rdoc_options: []
|
|
271
271
|
require_paths:
|
|
272
272
|
- lib
|