pub_grub 0.5.0.alpha1 → 0.5.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/pub_grub/incompatibility.rb +9 -0
- data/lib/pub_grub/rubygems.rb +2 -1
- data/lib/pub_grub/term.rb +9 -0
- data/lib/pub_grub/version.rb +1 -1
- data/lib/pub_grub/version_constraint.rb +9 -0
- data/lib/pub_grub/version_range.rb +55 -31
- data/lib/pub_grub/version_solver.rb +8 -0
- data/lib/pub_grub/version_union.rb +32 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d938331a11c5c808f24935dbecaba4ddebf099c5b511fe9d4308eedbafcf9c
|
4
|
+
data.tar.gz: 1c728638783ac576a475b29269b05d486c049b0d4725dd5fd030f95045f61390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ec023a28a5981e6835d5f20cee1534c05b98494c0f97638e161049f18bd9e11ee353563f0b705b119af52c318da829fe2056c773db200c09db077e674ee22eb
|
7
|
+
data.tar.gz: 88f857cbe30f1e30426fa68be1d3d293ea269e05fac2fdbcdadc83d6c928b9c9e360322da55e2ba5d0ccf512659010260cbc713787b42a0d39541db2f83e8f4e
|
data/Gemfile.lock
CHANGED
@@ -22,6 +22,15 @@ module PubGrub
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def hash
|
26
|
+
cause.hash ^ terms.hash
|
27
|
+
end
|
28
|
+
|
29
|
+
def eql?(other)
|
30
|
+
cause.eql?(other.cause) &&
|
31
|
+
terms.eql?(other.terms)
|
32
|
+
end
|
33
|
+
|
25
34
|
def failure?
|
26
35
|
terms.empty? || (terms.length == 1 && terms[0].package == Package.root && terms[0].positive?)
|
27
36
|
end
|
data/lib/pub_grub/rubygems.rb
CHANGED
@@ -6,8 +6,9 @@ module PubGrub
|
|
6
6
|
ranges = requirement.requirements.map do |(op, ver)|
|
7
7
|
case op
|
8
8
|
when "~>"
|
9
|
+
name = "~> #{ver}"
|
9
10
|
bump = ver.class.new(ver.bump.to_s + ".A")
|
10
|
-
VersionRange.new(min: ver, max: bump, include_min: true)
|
11
|
+
VersionRange.new(name: name, min: ver, max: bump, include_min: true)
|
11
12
|
when ">"
|
12
13
|
VersionRange.new(min: ver)
|
13
14
|
when ">="
|
data/lib/pub_grub/term.rb
CHANGED
@@ -18,6 +18,15 @@ module PubGrub
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def hash
|
22
|
+
constraint.hash ^ positive.hash
|
23
|
+
end
|
24
|
+
|
25
|
+
def eql?(other)
|
26
|
+
positive == other.positive &&
|
27
|
+
constraint.eql?(other.constraint)
|
28
|
+
end
|
29
|
+
|
21
30
|
def invert
|
22
31
|
self.class.new(@constraint, !@positive)
|
23
32
|
end
|
data/lib/pub_grub/version.rb
CHANGED
@@ -11,6 +11,15 @@ module PubGrub
|
|
11
11
|
@range = range
|
12
12
|
end
|
13
13
|
|
14
|
+
def hash
|
15
|
+
package.hash ^ range.hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def eql?(other)
|
19
|
+
package.eql?(other.package) &&
|
20
|
+
range.eql?(other.range)
|
21
|
+
end
|
22
|
+
|
14
23
|
class << self
|
15
24
|
def exact(package, version)
|
16
25
|
range = VersionRange.new(min: version, max: version, include_min: true, include_max: true)
|
@@ -19,10 +19,18 @@ module PubGrub
|
|
19
19
|
true
|
20
20
|
end
|
21
21
|
|
22
|
+
def eql?
|
23
|
+
other.empty?
|
24
|
+
end
|
25
|
+
|
22
26
|
def intersects?(_)
|
23
27
|
false
|
24
28
|
end
|
25
29
|
|
30
|
+
def intersect(other)
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
26
34
|
def allows_all?(other)
|
27
35
|
other.empty?
|
28
36
|
end
|
@@ -35,8 +43,8 @@ module PubGrub
|
|
35
43
|
false
|
36
44
|
end
|
37
45
|
|
38
|
-
def
|
39
|
-
|
46
|
+
def to_s
|
47
|
+
"(no versions)"
|
40
48
|
end
|
41
49
|
|
42
50
|
def ==(other)
|
@@ -52,27 +60,33 @@ module PubGrub
|
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
63
|
+
EMPTY = Empty.new
|
64
|
+
|
55
65
|
def self.empty
|
56
|
-
|
66
|
+
EMPTY
|
57
67
|
end
|
58
68
|
|
59
69
|
def self.any
|
60
70
|
new
|
61
71
|
end
|
62
72
|
|
63
|
-
def initialize(min: nil, max: nil, include_min: false, include_max: false)
|
73
|
+
def initialize(min: nil, max: nil, include_min: false, include_max: false, name: nil)
|
64
74
|
@min = min
|
65
75
|
@max = max
|
66
76
|
@include_min = include_min
|
67
77
|
@include_max = include_max
|
78
|
+
@name = name
|
79
|
+
end
|
68
80
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
81
|
+
def hash
|
82
|
+
min.hash ^ max.hash ^ include_min.hash ^ include_max.hash
|
83
|
+
end
|
84
|
+
|
85
|
+
def eql?(other)
|
86
|
+
min.eql?(other.min) &&
|
87
|
+
max.eql?(other.max) &&
|
88
|
+
include_min.eql?(other.include_min) &&
|
89
|
+
include_max.eql?(other.include_max)
|
76
90
|
end
|
77
91
|
|
78
92
|
def ranges
|
@@ -173,7 +187,7 @@ module PubGrub
|
|
173
187
|
alias_method :allows_any?, :intersects?
|
174
188
|
|
175
189
|
def intersect(other)
|
176
|
-
return
|
190
|
+
return other if other.empty?
|
177
191
|
return other.intersect(self) if other.is_a?(VersionUnion)
|
178
192
|
|
179
193
|
min_range =
|
@@ -208,7 +222,19 @@ module PubGrub
|
|
208
222
|
end
|
209
223
|
end
|
210
224
|
|
211
|
-
|
225
|
+
if !min_range.equal?(max_range) && min_range.min && max_range.max
|
226
|
+
case min_range.min <=> max_range.max
|
227
|
+
when -1
|
228
|
+
when 0
|
229
|
+
if !min_range.include_min || !max_range.include_max
|
230
|
+
return EMPTY
|
231
|
+
end
|
232
|
+
when 1
|
233
|
+
return EMPTY
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
VersionRange.new(
|
212
238
|
min: min_range.min,
|
213
239
|
include_min: min_range.include_min,
|
214
240
|
max: max_range.max,
|
@@ -255,7 +281,7 @@ module PubGrub
|
|
255
281
|
end
|
256
282
|
end
|
257
283
|
|
258
|
-
|
284
|
+
VersionRange.new(
|
259
285
|
min: min_range.min,
|
260
286
|
include_min: min_range.include_min,
|
261
287
|
max: max_range.max,
|
@@ -285,7 +311,7 @@ module PubGrub
|
|
285
311
|
return true if other.empty?
|
286
312
|
|
287
313
|
if other.is_a?(VersionUnion)
|
288
|
-
return
|
314
|
+
return VersionUnion.new([self]).allows_all?(other)
|
289
315
|
end
|
290
316
|
|
291
317
|
return false if max && !other.max
|
@@ -314,21 +340,6 @@ module PubGrub
|
|
314
340
|
true
|
315
341
|
end
|
316
342
|
|
317
|
-
def constraints
|
318
|
-
return ["any"] if any?
|
319
|
-
return ["#{min}"] if min == max
|
320
|
-
|
321
|
-
# FIXME: remove this
|
322
|
-
if min && max && include_min && !include_max && min.respond_to?(:bump) && (min.bump.to_s + ".A") == max.to_s
|
323
|
-
return ["~> #{min}"]
|
324
|
-
end
|
325
|
-
|
326
|
-
c = []
|
327
|
-
c << "#{include_min ? ">=" : ">"} #{min}" if min
|
328
|
-
c << "#{include_max ? "<=" : "<"} #{max}" if max
|
329
|
-
c
|
330
|
-
end
|
331
|
-
|
332
343
|
def any?
|
333
344
|
!min && !max
|
334
345
|
end
|
@@ -338,7 +349,7 @@ module PubGrub
|
|
338
349
|
end
|
339
350
|
|
340
351
|
def to_s
|
341
|
-
constraints.join(", ")
|
352
|
+
@name ||= constraints.join(", ")
|
342
353
|
end
|
343
354
|
|
344
355
|
def inspect
|
@@ -367,5 +378,18 @@ module PubGrub
|
|
367
378
|
include_min == other.include_min &&
|
368
379
|
include_max == other.include_max
|
369
380
|
end
|
381
|
+
|
382
|
+
private
|
383
|
+
|
384
|
+
def constraints
|
385
|
+
return ["any"] if any?
|
386
|
+
return ["= #{min}"] if min == max
|
387
|
+
|
388
|
+
c = []
|
389
|
+
c << "#{include_min ? ">=" : ">"} #{min}" if min
|
390
|
+
c << "#{include_max ? "<=" : "<"} #{max}" if max
|
391
|
+
c
|
392
|
+
end
|
393
|
+
|
370
394
|
end
|
371
395
|
end
|
@@ -16,6 +16,8 @@ module PubGrub
|
|
16
16
|
h[k] = []
|
17
17
|
end
|
18
18
|
|
19
|
+
@seen_incompatibilities = Set.new
|
20
|
+
|
19
21
|
@solution = PartialSolution.new
|
20
22
|
|
21
23
|
@package_depth = { root => 0 }
|
@@ -130,6 +132,12 @@ module PubGrub
|
|
130
132
|
conflict = false
|
131
133
|
|
132
134
|
source.incompatibilities_for(package, version).each do |incompatibility|
|
135
|
+
if @seen_incompatibilities.include?(incompatibility)
|
136
|
+
logger.debug { "knew: #{incompatibility}" }
|
137
|
+
next
|
138
|
+
end
|
139
|
+
@seen_incompatibilities.add(incompatibility)
|
140
|
+
|
133
141
|
add_incompatibility incompatibility
|
134
142
|
|
135
143
|
conflict ||= incompatibility.terms.all? do |term|
|
@@ -44,6 +44,14 @@ module PubGrub
|
|
44
44
|
@ranges = ranges
|
45
45
|
end
|
46
46
|
|
47
|
+
def hash
|
48
|
+
ranges.hash
|
49
|
+
end
|
50
|
+
|
51
|
+
def eql?(other)
|
52
|
+
ranges.eql?(other.ranges)
|
53
|
+
end
|
54
|
+
|
47
55
|
def include?(version)
|
48
56
|
!!ranges.bsearch {|r| r.compare_version(version) }
|
49
57
|
end
|
@@ -79,12 +87,17 @@ module PubGrub
|
|
79
87
|
alias_method :allows_any?, :intersects?
|
80
88
|
|
81
89
|
def allows_all?(other)
|
82
|
-
|
90
|
+
my_ranges = ranges.dup
|
91
|
+
|
92
|
+
my_range = my_ranges.shift
|
83
93
|
|
84
|
-
|
85
|
-
|
86
|
-
|
94
|
+
other.ranges.all? do |other_range|
|
95
|
+
while my_range
|
96
|
+
break if my_range.allows_all?(other_range)
|
97
|
+
my_range = my_ranges.shift
|
87
98
|
end
|
99
|
+
|
100
|
+
!!my_range
|
88
101
|
end
|
89
102
|
end
|
90
103
|
|
@@ -97,10 +110,22 @@ module PubGrub
|
|
97
110
|
end
|
98
111
|
|
99
112
|
def intersect(other)
|
100
|
-
|
101
|
-
|
102
|
-
new_ranges
|
113
|
+
my_ranges = ranges.dup
|
114
|
+
other_ranges = other.ranges.dup
|
115
|
+
new_ranges = []
|
103
116
|
|
117
|
+
my_range = my_ranges.shift
|
118
|
+
other_range = other_ranges.shift
|
119
|
+
while my_range && other_range
|
120
|
+
new_ranges << my_range.intersect(other_range)
|
121
|
+
|
122
|
+
if !my_range.max || (other_range.max && other_range.max < my_range.max)
|
123
|
+
other_range = other_ranges.shift
|
124
|
+
else
|
125
|
+
my_range = my_ranges.shift
|
126
|
+
end
|
127
|
+
end
|
128
|
+
new_ranges.reject!(&:empty?)
|
104
129
|
VersionUnion.union(new_ranges, normalize: false)
|
105
130
|
end
|
106
131
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pub_grub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: 1.3.1
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.7.
|
138
|
+
rubygems_version: 2.7.6
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: A version solver based on dart's PubGrub
|