scint 0.1.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 +7 -0
- data/FEATURES.md +13 -0
- data/README.md +216 -0
- data/bin/bundler-vs-scint +233 -0
- data/bin/scint +35 -0
- data/bin/scint-io-summary +46 -0
- data/bin/scint-syscall-trace +41 -0
- data/lib/bundler/setup.rb +5 -0
- data/lib/bundler.rb +168 -0
- data/lib/scint/cache/layout.rb +131 -0
- data/lib/scint/cache/metadata_store.rb +75 -0
- data/lib/scint/cache/prewarm.rb +192 -0
- data/lib/scint/cli/add.rb +85 -0
- data/lib/scint/cli/cache.rb +316 -0
- data/lib/scint/cli/exec.rb +150 -0
- data/lib/scint/cli/install.rb +1047 -0
- data/lib/scint/cli/remove.rb +60 -0
- data/lib/scint/cli.rb +77 -0
- data/lib/scint/commands/exec.rb +17 -0
- data/lib/scint/commands/install.rb +17 -0
- data/lib/scint/credentials.rb +153 -0
- data/lib/scint/debug/io_trace.rb +218 -0
- data/lib/scint/debug/sampler.rb +138 -0
- data/lib/scint/downloader/fetcher.rb +113 -0
- data/lib/scint/downloader/pool.rb +112 -0
- data/lib/scint/errors.rb +63 -0
- data/lib/scint/fs.rb +119 -0
- data/lib/scint/gem/extractor.rb +86 -0
- data/lib/scint/gem/package.rb +62 -0
- data/lib/scint/gemfile/dependency.rb +30 -0
- data/lib/scint/gemfile/editor.rb +93 -0
- data/lib/scint/gemfile/parser.rb +275 -0
- data/lib/scint/index/cache.rb +166 -0
- data/lib/scint/index/client.rb +301 -0
- data/lib/scint/index/parser.rb +142 -0
- data/lib/scint/installer/extension_builder.rb +264 -0
- data/lib/scint/installer/linker.rb +226 -0
- data/lib/scint/installer/planner.rb +140 -0
- data/lib/scint/installer/preparer.rb +207 -0
- data/lib/scint/lockfile/parser.rb +251 -0
- data/lib/scint/lockfile/writer.rb +178 -0
- data/lib/scint/platform.rb +71 -0
- data/lib/scint/progress.rb +579 -0
- data/lib/scint/resolver/provider.rb +230 -0
- data/lib/scint/resolver/resolver.rb +249 -0
- data/lib/scint/runtime/exec.rb +141 -0
- data/lib/scint/runtime/setup.rb +45 -0
- data/lib/scint/scheduler.rb +392 -0
- data/lib/scint/source/base.rb +46 -0
- data/lib/scint/source/git.rb +92 -0
- data/lib/scint/source/path.rb +70 -0
- data/lib/scint/source/rubygems.rb +79 -0
- data/lib/scint/vendor/pub_grub/assignment.rb +20 -0
- data/lib/scint/vendor/pub_grub/basic_package_source.rb +169 -0
- data/lib/scint/vendor/pub_grub/failure_writer.rb +182 -0
- data/lib/scint/vendor/pub_grub/incompatibility.rb +150 -0
- data/lib/scint/vendor/pub_grub/package.rb +43 -0
- data/lib/scint/vendor/pub_grub/partial_solution.rb +121 -0
- data/lib/scint/vendor/pub_grub/rubygems.rb +45 -0
- data/lib/scint/vendor/pub_grub/solve_failure.rb +19 -0
- data/lib/scint/vendor/pub_grub/static_package_source.rb +61 -0
- data/lib/scint/vendor/pub_grub/strategy.rb +42 -0
- data/lib/scint/vendor/pub_grub/term.rb +105 -0
- data/lib/scint/vendor/pub_grub/version.rb +3 -0
- data/lib/scint/vendor/pub_grub/version_constraint.rb +129 -0
- data/lib/scint/vendor/pub_grub/version_range.rb +423 -0
- data/lib/scint/vendor/pub_grub/version_solver.rb +236 -0
- data/lib/scint/vendor/pub_grub/version_union.rb +178 -0
- data/lib/scint/vendor/pub_grub.rb +32 -0
- data/lib/scint/worker_pool.rb +114 -0
- data/lib/scint.rb +87 -0
- metadata +116 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require_relative 'failure_writer'
|
|
2
|
+
|
|
3
|
+
module Scint::PubGrub
|
|
4
|
+
class SolveFailure < StandardError
|
|
5
|
+
attr_reader :incompatibility
|
|
6
|
+
|
|
7
|
+
def initialize(incompatibility)
|
|
8
|
+
@incompatibility = incompatibility
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def to_s
|
|
12
|
+
"Could not find compatible versions\n\n#{explanation}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def explanation
|
|
16
|
+
@explanation ||= FailureWriter.new(@incompatibility).write
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require_relative 'package'
|
|
2
|
+
require_relative 'rubygems'
|
|
3
|
+
require_relative 'version_constraint'
|
|
4
|
+
require_relative 'incompatibility'
|
|
5
|
+
require_relative 'basic_package_source'
|
|
6
|
+
|
|
7
|
+
module Scint::PubGrub
|
|
8
|
+
class StaticPackageSource < BasicPackageSource
|
|
9
|
+
class DSL
|
|
10
|
+
def initialize(packages, root_deps)
|
|
11
|
+
@packages = packages
|
|
12
|
+
@root_deps = root_deps
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def root(deps:)
|
|
16
|
+
@root_deps.update(deps)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def add(name, version, deps: {})
|
|
20
|
+
version = Gem::Version.new(version)
|
|
21
|
+
@packages[name] ||= {}
|
|
22
|
+
raise ArgumentError, "#{name} #{version} declared twice" if @packages[name].key?(version)
|
|
23
|
+
@packages[name][version] = clean_deps(name, version, deps)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
# Exclude redundant self-referencing dependencies
|
|
29
|
+
def clean_deps(name, version, deps)
|
|
30
|
+
deps.reject {|dep_name, req| name == dep_name && Scint::PubGrub::RubyGems.parse_range(req).include?(version) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize
|
|
35
|
+
@root_deps = {}
|
|
36
|
+
@packages = {}
|
|
37
|
+
|
|
38
|
+
yield DSL.new(@packages, @root_deps)
|
|
39
|
+
|
|
40
|
+
super()
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def all_versions_for(package)
|
|
44
|
+
@packages[package].keys
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def root_dependencies
|
|
48
|
+
@root_deps
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def dependencies_for(package, version)
|
|
52
|
+
@packages[package][version]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def parse_dependency(package, dependency)
|
|
56
|
+
return false unless @packages.key?(package)
|
|
57
|
+
|
|
58
|
+
Scint::PubGrub::RubyGems.parse_constraint(package, dependency)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Scint::PubGrub
|
|
2
|
+
class Strategy
|
|
3
|
+
def initialize(source)
|
|
4
|
+
@source = source
|
|
5
|
+
|
|
6
|
+
@root_package = Package.root
|
|
7
|
+
@root_version = Package.root_version
|
|
8
|
+
|
|
9
|
+
@version_indexes = Hash.new do |h,k|
|
|
10
|
+
if k == @root_package
|
|
11
|
+
h[k] = { @root_version => 0 }
|
|
12
|
+
else
|
|
13
|
+
h[k] = @source.all_versions_for(k).each.with_index.to_h
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def next_package_and_version(unsatisfied)
|
|
19
|
+
package, range = next_term_to_try_from(unsatisfied)
|
|
20
|
+
|
|
21
|
+
[package, most_preferred_version_of(package, range)]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def most_preferred_version_of(package, range)
|
|
27
|
+
versions = @source.versions_for(package, range)
|
|
28
|
+
|
|
29
|
+
indexes = @version_indexes[package]
|
|
30
|
+
versions.min_by { |version| indexes[version] }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def next_term_to_try_from(unsatisfied)
|
|
34
|
+
unsatisfied.min_by do |package, range|
|
|
35
|
+
matching_versions = @source.versions_for(package, range)
|
|
36
|
+
higher_versions = @source.versions_for(package, range.upper_invert)
|
|
37
|
+
|
|
38
|
+
[matching_versions.count <= 1 ? 0 : 1, higher_versions.count]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
module Scint::PubGrub
|
|
2
|
+
class Term
|
|
3
|
+
attr_reader :package, :constraint, :positive
|
|
4
|
+
|
|
5
|
+
def initialize(constraint, positive)
|
|
6
|
+
@constraint = constraint
|
|
7
|
+
@package = @constraint.package
|
|
8
|
+
@positive = positive
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def to_s(allow_every: false)
|
|
12
|
+
if positive
|
|
13
|
+
@constraint.to_s(allow_every: allow_every)
|
|
14
|
+
else
|
|
15
|
+
"not #{@constraint}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def hash
|
|
20
|
+
constraint.hash ^ positive.hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def eql?(other)
|
|
24
|
+
positive == other.positive &&
|
|
25
|
+
constraint.eql?(other.constraint)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def invert
|
|
29
|
+
self.class.new(@constraint, !@positive)
|
|
30
|
+
end
|
|
31
|
+
alias_method :inverse, :invert
|
|
32
|
+
|
|
33
|
+
def intersect(other)
|
|
34
|
+
raise ArgumentError, "packages must match" if package != other.package
|
|
35
|
+
|
|
36
|
+
if positive? && other.positive?
|
|
37
|
+
self.class.new(constraint.intersect(other.constraint), true)
|
|
38
|
+
elsif negative? && other.negative?
|
|
39
|
+
self.class.new(constraint.union(other.constraint), false)
|
|
40
|
+
else
|
|
41
|
+
positive = positive? ? self : other
|
|
42
|
+
negative = negative? ? self : other
|
|
43
|
+
self.class.new(positive.constraint.intersect(negative.constraint.invert), true)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def difference(other)
|
|
48
|
+
intersect(other.invert)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def relation(other)
|
|
52
|
+
if positive? && other.positive?
|
|
53
|
+
constraint.relation(other.constraint)
|
|
54
|
+
elsif negative? && other.positive?
|
|
55
|
+
if constraint.allows_all?(other.constraint)
|
|
56
|
+
:disjoint
|
|
57
|
+
else
|
|
58
|
+
:overlap
|
|
59
|
+
end
|
|
60
|
+
elsif positive? && other.negative?
|
|
61
|
+
if !other.constraint.allows_any?(constraint)
|
|
62
|
+
:subset
|
|
63
|
+
elsif other.constraint.allows_all?(constraint)
|
|
64
|
+
:disjoint
|
|
65
|
+
else
|
|
66
|
+
:overlap
|
|
67
|
+
end
|
|
68
|
+
elsif negative? && other.negative?
|
|
69
|
+
if constraint.allows_all?(other.constraint)
|
|
70
|
+
:subset
|
|
71
|
+
else
|
|
72
|
+
:overlap
|
|
73
|
+
end
|
|
74
|
+
else
|
|
75
|
+
raise
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def normalized_constraint
|
|
80
|
+
@normalized_constraint ||= positive ? constraint : constraint.invert
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def satisfies?(other)
|
|
84
|
+
raise ArgumentError, "packages must match" unless package == other.package
|
|
85
|
+
|
|
86
|
+
relation(other) == :subset
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def positive?
|
|
90
|
+
@positive
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def negative?
|
|
94
|
+
!positive?
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def empty?
|
|
98
|
+
@empty ||= normalized_constraint.empty?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def inspect
|
|
102
|
+
"#<#{self.class} #{self}>"
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
require_relative 'version_range'
|
|
2
|
+
|
|
3
|
+
module Scint::PubGrub
|
|
4
|
+
class VersionConstraint
|
|
5
|
+
attr_reader :package, :range
|
|
6
|
+
|
|
7
|
+
# @param package [Scint::PubGrub::Package]
|
|
8
|
+
# @param range [Scint::PubGrub::VersionRange]
|
|
9
|
+
def initialize(package, range: nil)
|
|
10
|
+
@package = package
|
|
11
|
+
@range = range
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def hash
|
|
15
|
+
package.hash ^ range.hash
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def ==(other)
|
|
19
|
+
package == other.package &&
|
|
20
|
+
range == other.range
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def eql?(other)
|
|
24
|
+
package.eql?(other.package) &&
|
|
25
|
+
range.eql?(other.range)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class << self
|
|
29
|
+
def exact(package, version)
|
|
30
|
+
range = VersionRange.new(min: version, max: version, include_min: true, include_max: true)
|
|
31
|
+
new(package, range: range)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def any(package)
|
|
35
|
+
new(package, range: VersionRange.any)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def empty(package)
|
|
39
|
+
new(package, range: VersionRange.empty)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def intersect(other)
|
|
44
|
+
unless package == other.package
|
|
45
|
+
raise ArgumentError, "Can only intersect between VersionConstraint of the same package"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self.class.new(package, range: range.intersect(other.range))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def union(other)
|
|
52
|
+
unless package == other.package
|
|
53
|
+
raise ArgumentError, "Can only intersect between VersionConstraint of the same package"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
self.class.new(package, range: range.union(other.range))
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def invert
|
|
60
|
+
new_range = range.invert
|
|
61
|
+
self.class.new(package, range: new_range)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def difference(other)
|
|
65
|
+
intersect(other.invert)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def allows_all?(other)
|
|
69
|
+
range.allows_all?(other.range)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def allows_any?(other)
|
|
73
|
+
range.intersects?(other.range)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def subset?(other)
|
|
77
|
+
other.allows_all?(self)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def overlap?(other)
|
|
81
|
+
other.allows_any?(self)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def disjoint?(other)
|
|
85
|
+
!overlap?(other)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def relation(other)
|
|
89
|
+
if subset?(other)
|
|
90
|
+
:subset
|
|
91
|
+
elsif overlap?(other)
|
|
92
|
+
:overlap
|
|
93
|
+
else
|
|
94
|
+
:disjoint
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def to_s(allow_every: false)
|
|
99
|
+
if Package.root?(package)
|
|
100
|
+
package.to_s
|
|
101
|
+
elsif allow_every && any?
|
|
102
|
+
"every version of #{package}"
|
|
103
|
+
else
|
|
104
|
+
"#{package} #{constraint_string}"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def constraint_string
|
|
109
|
+
if any?
|
|
110
|
+
">= 0"
|
|
111
|
+
else
|
|
112
|
+
range.to_s
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def empty?
|
|
117
|
+
range.empty?
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Does this match every version of the package
|
|
121
|
+
def any?
|
|
122
|
+
range.any?
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def inspect
|
|
126
|
+
"#<#{self.class} #{self}>"
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|