Skip to content
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 dependency locking for path source #4293

Merged
merged 1 commit into from Jan 18, 2021

Conversation

mtsmfm
Copy link
Contributor

@mtsmfm mtsmfm commented Jan 17, 2021

What was the end-user or developer problem that led to this PR?

Fix #4098

What is your fix for the problem, implemented in this PR?

To be honest, I don't have enough confidence though I think these dependency check is not necessary because no test fails.

It was added in rubygems/bundler@19192a3 and the test still be there.

describe "when dependencies in the path are updated" do
before :each do
build_lib "foo", "1.0", :path => lib_path("foo")
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
G
end
it "gets dependencies that are updated in the path" do
build_lib "foo", "1.0", :path => lib_path("foo") do |s|
s.add_dependency "rack"
end
bundle "install"
expect(the_bundle).to include_gems "rack 1.0.0"
end

Please let me know if you find a problem with this change.

Make sure the following tasks are checked

@welcome
Copy link

welcome bot commented Jan 17, 2021

Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

old_runtime_deps = s.dependencies.select {|d| d.type != :development }
# If the dependencies of the path source have changed and locked spec can't satisfy new dependencies, unlock it
next unless new_runtime_deps.sort == old_runtime_deps.sort || new_runtime_deps.all? {|d| satisfies_locked_spec?(d) }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes https://github.com/ayanko/bundler-gemspec-issue.
Not sure how does it impact on other cases.

Method converge_locked_specs is huge and complicated.
Should we split it to more multiple methods to increase clarity?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be my guest!

Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome @mtsmfm, thanks so much!

We have a whole different logic for unlocking path sources under converge_paths, so I don't see any immediate issues with doing this.

Plus, I'm strongly opposed to rejecting PRs that remove code, fix an issue and add a spec for the fixed issue. 😃

@deivid-rodriguez deivid-rodriguez merged commit a127c6c into rubygems:master Jan 18, 2021
@mtsmfm mtsmfm deleted the fix-4098 branch January 18, 2021 12:17
deivid-rodriguez added a commit that referenced this pull request Jan 18, 2021
Fix dependency locking for path source

(cherry picked from commit a127c6c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conservative updating for gemspec dependencies
4 participants