Skip to content

Commit f97de10

Browse files
Merge pull request #6512 from rubygems/fix-flaky
Fix flaky when making materialized specs uniq
2 parents b37185e + 382e79f commit f97de10

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

bundler/lib/bundler/endpoint_specification.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ def fetch_platform
2626
@platform
2727
end
2828

29-
def identifier
30-
@__identifier ||= [name, version, platform.to_s]
31-
end
32-
3329
# needed for standalone, load required_paths from local gemspec
3430
# after the gem is installed
3531
def require_paths

bundler/lib/bundler/lazy_specification.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ def initialize(name, version, platform, source = nil)
2020
end
2121

2222
def full_name
23-
if platform == Gem::Platform::RUBY
23+
@full_name ||= if platform == Gem::Platform::RUBY
2424
"#{@name}-#{@version}"
2525
else
2626
"#{@name}-#{@version}-#{platform}"
2727
end
2828
end
2929

3030
def ==(other)
31-
identifier == other.identifier
31+
full_name == other.full_name
3232
end
3333

3434
def eql?(other)
35-
identifier.eql?(other.identifier)
35+
full_name.eql?(other.full_name)
3636
end
3737

3838
def hash
39-
identifier.hash
39+
full_name.hash
4040
end
4141

4242
##
@@ -129,10 +129,6 @@ def to_s
129129
end
130130
end
131131

132-
def identifier
133-
@__identifier ||= [name, version, platform.to_s]
134-
end
135-
136132
def git_version
137133
return unless source.is_a?(Bundler::Source::Git)
138134
" #{source.revision[0..6]}"

bundler/lib/bundler/lockfile_parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def initialize(lockfile)
8686
send("parse_#{@state}", line)
8787
end
8888
end
89-
@specs = @specs.values.sort_by(&:identifier)
89+
@specs = @specs.values.sort_by(&:full_name)
9090
rescue ArgumentError => e
9191
Bundler.ui.debug(e)
9292
raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
@@ -199,7 +199,7 @@ def parse_spec(line)
199199
@current_spec.source = @current_source
200200
@current_source.add_dependency_names(name)
201201

202-
@specs[@current_spec.identifier] = @current_spec
202+
@specs[@current_spec.full_name] = @current_spec
203203
elsif spaces.size == 6
204204
version = version.split(",").map(&:strip) if version
205205
dep = Gem::Dependency.new(name, version)

bundler/lib/bundler/remote_specification.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ def fetch_platform
2929
@platform = _remote_specification.platform
3030
end
3131

32-
def identifier
33-
@__identifier ||= [name, version, @platform.to_s]
34-
end
35-
3632
def full_name
37-
if @platform == Gem::Platform::RUBY
33+
@full_name ||= if @platform == Gem::Platform::RUBY
3834
"#{@name}-#{@version}"
3935
else
4036
"#{@name}-#{@version}-#{@platform}"

0 commit comments

Comments
 (0)