New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix --standalone
installation of default gems
#4782
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deivid-rodriguez
force-pushed
the
fix_standalone_default_gems
branch
6 times, most recently
from
July 26, 2021 11:29
0e1a765
to
7d4122c
Compare
4 tasks
These gems are built and installed to system directly as default gems. There's no need to also build a remote repo.
TSort was released as a library so we can install it, and also other gems that are loaded by the spec. Also, Ruby on Windows apparently loads fiddle 1.0.6, so we need to also install that to make that not fail.
Rubygems source replacement was broken.
…mode Since this mode is only enabled in frozen mode, it's fine to use the lockfile and means we don't have to "prepare" the replacement for materialization.
No need to fill up missing names from sources anymore since they should now be properly set up correctly from the beginning.
deivid-rodriguez
force-pushed
the
fix_standalone_default_gems
branch
from
July 28, 2021 06:56
7d4122c
to
706fd28
Compare
deivid-rodriguez
added a commit
that referenced
this pull request
Jul 30, 2021
Fix `--standalone` installation of default gems (cherry picked from commit 719c249)
deivid-rodriguez
added a commit
that referenced
this pull request
Jul 30, 2021
Fix `--standalone` installation of default gems (cherry picked from commit 719c249)
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this pull request
Aug 2, 2021
This PR is a workaround for `undefined method `add_dependency_names' for nil:NilClass` CI build error when using Bundler 2.2.25 on Windows. ```console Failures: 1) RuboCop::Lockfile#gems returns all the dependencies Failure/Error: @parser = lockfile ? Bundler::LockfileParser.new(lockfile) : nil NoMethodError: undefined method `add_dependency_names' for nil:NilClass # ./lib/rubocop/lockfile.rb:35:in `new' # ./lib/rubocop/lockfile.rb:35:in `parser' # ./lib/rubocop/lockfile.rb:17:in `gems' # ./spec/rubocop/lockfile_spec.rb:77:in `block (3 levels) in <top (required)>' # ./spec/rubocop/lockfile_spec.rb:79:in `block (3 levels) in <top (required)>' 4) RuboCop::Lockfile#includes_gem? for an included dependency Failure/Error: @parser = lockfile ? Bundler::LockfileParser.new(lockfile) : nil NoMethodError: undefined method `add_dependency_names' for nil:NilClass # ./lib/rubocop/lockfile.rb:35:in `new' # ./lib/rubocop/lockfile.rb:35:in `parser' # ./lib/rubocop/lockfile.rb:17:in `gems' # ./lib/rubocop/lockfile.rb:25:in `includes_gem?' # ./spec/rubocop/lockfile_spec.rb:95:in `block (3 levels) in <top (required)>' # ./spec/rubocop/lockfile_spec.rb:100:in `block (4 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (4 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `chdir' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (3 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:7:in `block (2 levels) in <top (required)>' # tasks/spec_runner.rake:32:in `block in run_specs' # tasks/spec_runner.rake:44:in `with_encoding' # tasks/spec_runner.rake:28:in `run_specs' # tasks/spec_runner.rake:115:in `block in <top (required)>' 5) RuboCop::Lockfile#dependencies returns all the dependencies Failure/Error: @parser = lockfile ? Bundler::LockfileParser.new(lockfile) : nil NoMethodError: undefined method `add_dependency_names' for nil:NilClass # ./lib/rubocop/lockfile.rb:35:in `new' # ./lib/rubocop/lockfile.rb:35:in `parser' # ./lib/rubocop/lockfile.rb:10:in `dependencies' # ./spec/rubocop/lockfile_spec.rb:59:in `block (3 levels) in <top (required)>' # ./spec/rubocop/lockfile_spec.rb:61:in `block (3 levels) in <top (required)>' # ./spec/rubocop/lockfile_spec.rb:66:in `block (3 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (4 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `chdir' # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (3 levels) in <top (required)>' # ./lib/rubocop/rspec/shared_contexts.rb:7:in `block (2 levels) in <top (required)>' # tasks/spec_runner.rake:32:in `block in run_specs' # tasks/spec_runner.rake:44:in `with_encoding' # tasks/spec_runner.rake:28:in `run_specs' # tasks/spec_runner.rake:115:in `block in <top (required)>' Finished in 4 minutes 9 seconds (files took 3.81 seconds to load) 16350 examples, 5 failures, 14 pending Failed examples: rspec ./spec/rubocop/lockfile_spec.rb:83 # RuboCop::Lockfile#gems returns all the dependencies rspec ./spec/rubocop/lockfile_spec.rb:112 # RuboCop::Lockfile#includes_gem? for an excluded gem rspec ./spec/rubocop/lockfile_spec.rb:106 # RuboCop::Lockfile#includes_gem? for an included gem rspec ./spec/rubocop/lockfile_spec.rb:100 # RuboCop::Lockfile#includes_gem? for an included dependency rspec ./spec/rubocop/lockfile_spec.rb:65 # RuboCop::Lockfile#dependencies returns all the dependencies ``` https://github.com/rubocop/rubocop/runs/3211951622 It may be affected by the following Bundler's changes. bundler/lib/bundler/lockfile_parser.rb: ```diff platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY @current_spec = LazySpecification.new(name, version, platform) @current_spec.source = @current_source + @current_source.add_dependency_names(name) @specs[@current_spec.identifier] = @current_spec elsif spaces.size == 6 ``` rubygems/rubygems#4782
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
Since recent versions,
bundle install --standalone
will fail if your Gemfile includes default gems.What is your fix for the problem, implemented in this PR?
Source replacement in
Bundler::Definition
is the process that decides whether sources from the lockfile can be used directly or whether sources from theGemfile
include changes over the lockfile and need to be considered instead.This process was not happening correctly for rubygems sources, meaning that sometimes the chosen sources to pick up specs from were not correctly setup and failed to fetch some gems. We were workarounding the issue by "fixing" the incorrect sources at materialization time, but the workaround was not working for this particular case.
This PR fixes the root of the issue and allows us to remove all the workarounds at materialization time (which should also result in less unnecessary network activity).
Fixes #4760.
Make sure the following tasks are checked