molinillo 0.5.1 → 0.5.2

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
  SHA1:
3
- metadata.gz: e941ca9751ad429184a78dbb929fba03428d5630
4
- data.tar.gz: a60bb544a0c227c078e49249848e7a93dcc654b5
3
+ metadata.gz: 07ba133d4a53675053e7dcd0951237049e522ea8
4
+ data.tar.gz: 21ef570c95d650318652b77f24a68b46fa60b3db
5
5
  SHA512:
6
- metadata.gz: 7cfb3cbe6a1c524938933f30ad4cce2384b5ddca16632c99609721e841fb70557be98df82fa2feb0980a127dd009d026f9bd5b34edca1d7fa2e39ba6ecae0307
7
- data.tar.gz: 952805cd2f2fc302b2ea5c11181442c3019755cd22dab63afe37e97121ba270e9b3ddebdf2443c83604578dac2f16f8d9252164c490e1dc7cb02a2694421bbe2
6
+ metadata.gz: cb2eb17979338fb368d96effa38d25aa7fc3a19e97e3c41dc4c4e36290260d00d43fe1b206481122d1b4e708963bbb43eb7833c868566e1ff4364840671b1797
7
+ data.tar.gz: 2541587694311be9e41ee3f7778e996fcb01b5d5ad10b25d5a5db7cc00fbad5164b26f5b63ed4ec12534f19dcd3d18fa2ca6212c85ca7719d21094f27a139d4d
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Molinillo
3
3
  # The version of Molinillo.
4
- VERSION = '0.5.1'.freeze
4
+ VERSION = '0.5.2'.freeze
5
5
  end
@@ -356,10 +356,14 @@ module Molinillo
356
356
  # @return [void]
357
357
  def fixup_swapped_children(vertex)
358
358
  payload = vertex.payload
359
- dep_names = dependencies_for(payload).map(&method(:name_for))
360
- vertex.successors.each do |succ|
361
- if !dep_names.include?(succ.name) && !succ.root? && succ.predecessors.to_a == [vertex]
359
+ deps = dependencies_for(payload).group_by(&method(:name_for))
360
+ vertex.outgoing_edges.each do |outgoing_edge|
361
+ @parent_of[outgoing_edge.requirement] = states.size - 1
362
+ succ = outgoing_edge.destination
363
+ matching_deps = Array(deps[succ.name])
364
+ if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex]
362
365
  debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
366
+ succ.requirements.each { |r| @parent_of.delete(r) }
363
367
  activated.detach_vertex_named(succ.name)
364
368
 
365
369
  all_successor_names = succ.recursive_successors.map(&:name)
@@ -368,7 +372,10 @@ module Molinillo
368
372
  requirement_name = name_for(requirement)
369
373
  (requirement_name == succ.name) || all_successor_names.include?(requirement_name)
370
374
  end
375
+ elsif !matching_deps.include?(outgoing_edge.requirement)
376
+ outgoing_edge.requirement = matching_deps.first
371
377
  end
378
+ matching_deps.delete(outgoing_edge.requirement)
372
379
  end
373
380
  end
374
381
 
@@ -122,28 +122,13 @@ module Molinillo
122
122
  end
123
123
 
124
124
  it 'can resolve when two specs have the same dependencies' do
125
- bundler_index = Class.new(TestIndex) do
126
- # The bug we want to write a regression test for only occurs when
127
- # Molinillo processes dependencies in a specific order for the given
128
- # index and demands. This sorting logic ensures we hit the repro case
129
- def sort_dependencies(dependencies, activated, conflicts)
130
- dependencies.sort_by do |dependency|
131
- name = name_for(dependency)
132
- [
133
- activated.vertex_named(name).payload ? 0 : 1,
134
- conflicts[name] ? 0 : 1,
135
- activated.vertex_named(name).payload ? 0 : search_for(dependency).count,
136
- ]
137
- end
138
- end
139
- end
140
-
141
- index = bundler_index.new('rubygems-2016-09-11')
125
+ index = BundlerIndex.new('rubygems-2016-09-11')
142
126
  @resolver = described_class.new(index, TestUI.new)
143
127
  demands = [
144
128
  VersionKit::Dependency.new('chef', '~> 12.1.2'),
145
129
  ]
146
130
 
131
+ demands.each { |d| index.search_for(d) }
147
132
  resolved = @resolver.resolve(demands, DependencyGraph.new)
148
133
 
149
134
  expected = [
@@ -196,6 +181,67 @@ module Molinillo
196
181
  expect(resolved.map(&:payload).map(&:to_s)).to match_array(expected)
197
182
  end
198
183
 
184
+ it 'can resolve when two specs have the same dependencies and swapping happens' do
185
+ index = BundlerIndex.new('rubygems-2016-10-06')
186
+ @resolver = described_class.new(index, TestUI.new)
187
+ demands = [
188
+ VersionKit::Dependency.new('avro_turf', '0.6.2'),
189
+ VersionKit::Dependency.new('fog', '1.38.0'),
190
+ ]
191
+ demands.each { |d| index.search_for(d) }
192
+
193
+ resolved = @resolver.resolve(demands, DependencyGraph.new)
194
+
195
+ expected = [
196
+ 'pkg-config (1.1.7)',
197
+ 'CFPropertyList (2.3.3)',
198
+ 'multi_json (1.12.1)',
199
+ 'excon (0.45.4)',
200
+ 'builder (3.2.2)',
201
+ 'formatador (0.2.5)',
202
+ 'ipaddress (0.8.3)',
203
+ 'xml-simple (1.1.5)',
204
+ 'mini_portile2 (2.1.0)',
205
+ 'inflecto (0.0.2)',
206
+ 'trollop (2.1.2)',
207
+ 'fission (0.5.0)',
208
+ 'avro (1.8.1)',
209
+ 'fog-core (1.37.0)',
210
+ 'nokogiri (1.6.8)',
211
+ 'avro_turf (0.6.2)',
212
+ 'fog-json (1.0.2)',
213
+ 'fog-local (0.3.0)',
214
+ 'fog-vmfusion (0.1.0)',
215
+ 'fog-xml (0.1.2)',
216
+ 'rbvmomi (1.8.2)',
217
+ 'fog-aliyun (0.1.0)',
218
+ 'fog-brightbox (0.11.0)',
219
+ 'fog-sakuracloud (1.7.5)',
220
+ 'fog-serverlove (0.1.2)',
221
+ 'fog-softlayer (1.1.4)',
222
+ 'fog-storm_on_demand (0.1.1)',
223
+ 'fog-atmos (0.1.0)',
224
+ 'fog-aws (0.9.2)',
225
+ 'fog-cloudatcost (0.1.2)',
226
+ 'fog-dynect (0.0.3)',
227
+ 'fog-ecloud (0.3.0)',
228
+ 'fog-google (0.1.0)',
229
+ 'fog-openstack (0.1.3)',
230
+ 'fog-powerdns (0.1.1)',
231
+ 'fog-profitbricks (0.0.5)',
232
+ 'fog-rackspace (0.1.1)',
233
+ 'fog-radosgw (0.0.5)',
234
+ 'fog-riakcs (0.1.0)',
235
+ 'fog-terremark (0.1.0)',
236
+ 'fog-voxel (0.1.0)',
237
+ 'fog-xenserver (0.2.3)',
238
+ 'fog-vsphere (1.2.0)',
239
+ 'fog (1.38.0)',
240
+ ]
241
+
242
+ expect(resolved.map(&:payload).map(&:to_s).sort).to eq(expected.sort)
243
+ end
244
+
199
245
  # Regression test. See: https://github.com/CocoaPods/Molinillo/pull/38
200
246
  it 'can resolve when swapping children with successors' do
201
247
  swap_child_with_successors_index = Class.new(TestIndex) do
@@ -61,4 +61,20 @@ module Molinillo
61
61
  end
62
62
  end
63
63
  end
64
+
65
+ class BundlerIndex < TestIndex
66
+ # Some bugs we want to write a regression test for only occurs when
67
+ # Molinillo processes dependencies in a specific order for the given
68
+ # index and demands. This sorting logic ensures we hit the repro case
69
+ def sort_dependencies(dependencies, activated, conflicts)
70
+ dependencies.sort_by do |dependency|
71
+ name = name_for(dependency)
72
+ [
73
+ activated.vertex_named(name).payload ? 0 : 1,
74
+ conflicts[name] ? 0 : 1,
75
+ activated.vertex_named(name).payload ? 0 : search_for(dependency).count,
76
+ ]
77
+ end
78
+ end
79
+ end
64
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molinillo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel E. Giddins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-12 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.6.6
99
+ rubygems_version: 2.6.7
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Provides support for dependency resolution