dependabot-cargo 0.97.9 → 0.97.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/cargo/file_updater/lockfile_updater.rb +38 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b6dd47e9bcb8b7f5ffa761808e10703f1b9996aece15c537d3907e09f63b2e
|
4
|
+
data.tar.gz: cbbaf03f6eaa0b860e619458449fe5e23971b54b3e37b64ba6a0480245da251f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b1fb432e3e02bf90cee0119e3555ad81b8aa999bb9007d80acf30608bfc666b1b10007d6edfb8a52b73bdc99a9a55f63b2b28a8f4d2b6a65649e170bcafdfc
|
7
|
+
data.tar.gz: a530c5f26bc81fa62584e5d5d247959c148c2442a06dbeb5e0140c589113cbe39ee99f4a769e61a2035ed16b6a3a95213b8076e65d5d8c290b532b987af97901
|
@@ -13,6 +13,13 @@ module Dependabot
|
|
13
13
|
module Cargo
|
14
14
|
class FileUpdater
|
15
15
|
class LockfileUpdater
|
16
|
+
LOCKFILE_ENTRY_REGEX = /
|
17
|
+
\[\[package\]\]\n
|
18
|
+
(?:(?!^\[(\[package|metadata)).)+
|
19
|
+
/mx.freeze
|
20
|
+
|
21
|
+
LOCKFILE_CHECKSUM_REGEX = /^"checksum .*$/.freeze
|
22
|
+
|
16
23
|
def initialize(dependencies:, dependency_files:, credentials:)
|
17
24
|
@dependencies = dependencies
|
18
25
|
@dependency_files = dependency_files
|
@@ -240,6 +247,7 @@ module Dependabot
|
|
240
247
|
def post_process_lockfile(content)
|
241
248
|
git_ssh_requirements_to_swap.each do |ssh_url, https_url|
|
242
249
|
content = content.gsub(https_url, ssh_url)
|
250
|
+
content = remove_duplicate_lockfile_entries(content)
|
243
251
|
end
|
244
252
|
|
245
253
|
content
|
@@ -267,6 +275,36 @@ module Dependabot
|
|
267
275
|
@git_ssh_requirements_to_swap
|
268
276
|
end
|
269
277
|
|
278
|
+
def remove_duplicate_lockfile_entries(lockfile_content)
|
279
|
+
# Loop through the lockfile entries looking for duplicates. Replace
|
280
|
+
# any that are found
|
281
|
+
lockfile_entries = []
|
282
|
+
lockfile_content.scan(LOCKFILE_ENTRY_REGEX) do
|
283
|
+
lockfile_entries << Regexp.last_match.to_s
|
284
|
+
end
|
285
|
+
lockfile_entries.
|
286
|
+
select { |e| lockfile_entries.count(e) > 1 }.uniq.
|
287
|
+
each do |entry|
|
288
|
+
(lockfile_entries.count(entry) - 1).
|
289
|
+
times { lockfile_content = lockfile_content.sub(entry, "") }
|
290
|
+
end
|
291
|
+
|
292
|
+
# Loop through the lockfile checksums looking for duplicates. Replace
|
293
|
+
# any that are found
|
294
|
+
lockfile_checksums = []
|
295
|
+
lockfile_content.scan(LOCKFILE_CHECKSUM_REGEX) do
|
296
|
+
lockfile_checksums << Regexp.last_match.to_s
|
297
|
+
end
|
298
|
+
lockfile_checksums.
|
299
|
+
select { |e| lockfile_checksums.count(e) > 1 }.uniq.
|
300
|
+
each do |cs|
|
301
|
+
(lockfile_checksums.count(cs) - 1).
|
302
|
+
times { lockfile_content = lockfile_content.sub("\n#{cs}", "") }
|
303
|
+
end
|
304
|
+
|
305
|
+
lockfile_content
|
306
|
+
end
|
307
|
+
|
270
308
|
def dummy_app_content
|
271
309
|
%{fn main() {\nprintln!("Hello, world!");\n}}
|
272
310
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-cargo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.97.
|
4
|
+
version: 0.97.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.97.
|
19
|
+
version: 0.97.10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.97.
|
26
|
+
version: 0.97.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|