dependabot-cargo 0.94.9 → 0.94.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e5953038e397819b0e452787de404808289166087115745f1d91a74fcf8bfae
4
- data.tar.gz: 982cc2453a7fa8017b53d24893fd8535da1f31ad6fb492285ea02e180bd74337
3
+ metadata.gz: 67ed474b240b8ed58885a07a73f6d0f68e5a7bc0b0dbbf5775b691e799916370
4
+ data.tar.gz: 147153e98c1510df7db16ae0de22efc5603bae18087ced11a43fdb66ee826395
5
5
  SHA512:
6
- metadata.gz: fedb3235fedcdf476a100035df39a1d5a5a86cf6d7c1f61a082357db656f0168a978e9bc3d0623bb35de7724df8915361f96812ff846c07013cd1cc2c5195cff
7
- data.tar.gz: 6ba8562c203071312052020128a29730a3e0777da9af6951380e92d8905dce65070c7e1e3edf55fa256cba0348f138f91073d45bfb7b2990ab254f88b0083526
6
+ metadata.gz: 1c086ef837871301436582cdbdc6cbd1fb4696fe665af43739e63668f71806eaaffc3e0e72aec02f70d521fa585571a114c78d9eb57bc2f1057ffbe65b9a62af
7
+ data.tar.gz: 4c789583a7f959bdf8298420baf194bb2987b2e698c8b7171d61fdb1757029993ee1c4c6221e82554e76c3fe47ddce25d666ea633deca43ea4a72f3e65748ba0
@@ -40,6 +40,7 @@ module Dependabot
40
40
  raise "Failed to update #{dependency.name}!"
41
41
  end
42
42
  rescue Dependabot::SharedHelpers::HelperSubprocessFailed => error
43
+ retry if better_specification_needed?(error)
43
44
  handle_cargo_error(error)
44
45
  end
45
46
 
@@ -60,13 +61,47 @@ module Dependabot
60
61
  raise Dependabot::DependencyFileNotResolvable, error.message
61
62
  end
62
63
 
64
+ # rubocop:disable Metrics/AbcSize
65
+ # rubocop:disable Metrics/CyclomaticComplexity
63
66
  # rubocop:disable Metrics/PerceivedComplexity
67
+ def better_specification_needed?(error)
68
+ return false if @custom_specification
69
+ return false unless error.message.match?(/specification .* is ambigu/)
70
+
71
+ spec_options = error.message.gsub(/.*following:\n/m, "").
72
+ lines.map(&:strip)
73
+
74
+ ver = if git_dependency? && git_dependency_version
75
+ git_dependency_version
76
+ else
77
+ dependency.version
78
+ end
79
+
80
+ if spec_options.count { |s| s.end_with?(ver) } == 1
81
+ @custom_specification = spec_options.find { |s| s.end_with?(ver) }
82
+ return true
83
+ elsif spec_options.count { |s| s.end_with?(ver) } > 1
84
+ spec_options.select! { |s| s.end_with?(ver) }
85
+ end
86
+
87
+ if git_dependency? && git_source_url &&
88
+ spec_options.count { |s| s.include?(git_source_url) } >= 1
89
+ spec_options.select! { |s| s.include?(git_source_url) }
90
+ end
91
+
92
+ @custom_specification = spec_options.first
93
+ true
94
+ end
95
+ # rubocop:enable Metrics/AbcSize
96
+ # rubocop:enable Metrics/CyclomaticComplexity
97
+ # rubocop:enable Metrics/PerceivedComplexity
98
+
64
99
  def dependency_spec
100
+ return @custom_specification if @custom_specification
101
+
65
102
  spec = dependency.name
66
103
 
67
- if git_dependency? && git_source_url && git_previous_version
68
- spec = "#{git_source_url}##{git_previous_version}"
69
- elsif git_dependency?
104
+ if git_dependency?
70
105
  spec += ":#{git_previous_version}" if git_previous_version
71
106
  elsif dependency.previous_version
72
107
  spec += ":#{dependency.previous_version}"
@@ -75,7 +110,6 @@ module Dependabot
75
110
 
76
111
  spec
77
112
  end
78
- # rubocop:enable Metrics/PerceivedComplexity
79
113
 
80
114
  def git_previous_version
81
115
  TomlRB.parse(lockfile.content).
@@ -55,6 +55,7 @@ module Dependabot
55
55
  version_class.new(updated_version)
56
56
  end
57
57
  rescue SharedHelpers::HelperSubprocessFailed => error
58
+ retry if better_specification_needed?(error)
58
59
  handle_cargo_errors(error)
59
60
  end
60
61
 
@@ -78,13 +79,47 @@ module Dependabot
78
79
  end
79
80
  end
80
81
 
82
+ # rubocop:disable Metrics/AbcSize
83
+ # rubocop:disable Metrics/CyclomaticComplexity
81
84
  # rubocop:disable Metrics/PerceivedComplexity
85
+ def better_specification_needed?(error)
86
+ return false if @custom_specification
87
+ return false unless error.message.match?(/specification .* is ambigu/)
88
+
89
+ spec_options = error.message.gsub(/.*following:\n/m, "").
90
+ lines.map(&:strip)
91
+
92
+ ver = if git_dependency? && git_dependency_version
93
+ git_dependency_version
94
+ else
95
+ dependency.version
96
+ end
97
+
98
+ if spec_options.count { |s| s.end_with?(ver) } == 1
99
+ @custom_specification = spec_options.find { |s| s.end_with?(ver) }
100
+ return true
101
+ elsif spec_options.count { |s| s.end_with?(ver) } > 1
102
+ spec_options.select! { |s| s.end_with?(ver) }
103
+ end
104
+
105
+ if git_dependency? && git_source_url &&
106
+ spec_options.count { |s| s.include?(git_source_url) } >= 1
107
+ spec_options.select! { |s| s.include?(git_source_url) }
108
+ end
109
+
110
+ @custom_specification = spec_options.first
111
+ true
112
+ end
113
+ # rubocop:enable Metrics/AbcSize
114
+ # rubocop:enable Metrics/CyclomaticComplexity
115
+ # rubocop:enable Metrics/PerceivedComplexity
116
+
82
117
  def dependency_spec
118
+ return @custom_specification if @custom_specification
119
+
83
120
  spec = dependency.name
84
121
 
85
- if git_dependency? && git_source_url && git_dependency_version
86
- spec = "#{git_source_url}##{git_dependency_version}"
87
- elsif git_dependency?
122
+ if git_dependency?
88
123
  spec += ":#{git_dependency_version}" if git_dependency_version
89
124
  elsif dependency.version
90
125
  spec += ":#{dependency.version}"
@@ -93,7 +128,6 @@ module Dependabot
93
128
 
94
129
  spec
95
130
  end
96
- # rubocop:enable Metrics/PerceivedComplexity
97
131
 
98
132
  def run_cargo_command(command)
99
133
  start = Time.now
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.94.9
4
+ version: 0.94.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.94.9
19
+ version: 0.94.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.94.9
26
+ version: 0.94.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement