-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Respect --no-install option for git: sources #6088
Respect --no-install option for git: sources #6088
Conversation
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 |
I think the underlying root cause of this is related to #3204? |
oof. That issue seems like a lot. Sorry you had to deal with that ❤️ So yeah, @thedanbob already noticed this: #3204 (comment)
I think fixing the "the install path is the same as the cache path" is a necessary but not sufficient condition. If my reading of what the rubygems source is doing is correct, this is what I think the expected behaviour should be... (apologies in advance for my wording here, I'm not too familiar with the correct Rubygems terminology) For
For
For
Sound about right? Question about native gems: AFAICT native extensions installed by bundler wind up in two places - both in
Should they actually wind up in both places? Any idea what's going on here? Question about Does the |
@deivid-rodriguez - any thoughts on the above? If I'm on the right track there I'll definitely try and contribute a patch. |
@KJTsanaktsidis Sorry for the lack of feedback! Let's start with this patch, which seems correct and indeed a related but separate issue. More issues with caching git sources should get fixed by #4469. Once we introduced the fix here and that PR we can reevaluate if there's still anything missing/incorrect. Can you add a test for this patch? You can find related specs at |
a944145
to
90b75ef
Compare
Hey @deivid-rodriguez, @Julzerator and I put our heads together in the new year and put together a test for this fix. PTAL - thanks! |
90b75ef
to
7812ec7
Compare
Hei @KJTsanaktsidis, thanks for working on this. That spec seems to also pass without the fix in this PR. Can you write it so that it fails without this change, and passes with it? |
@KJTsanaktsidis still interested? |
8330086
to
90ffe4b
Compare
Sorry @deivid-rodriguez - this totally fell off my radar. I think I wrote a much better test now, WDYT? |
90ffe4b
to
2e7b677
Compare
a70919d
to
e720646
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the thorough comments and test, hopefully we can remove the second comment block once #4469 is out!
Ooops, unfortunately the spec needs to be adapted to also work in "bundler 3" mode, where Bundler will install to |
Head branch was pushed to by a user without write access
e720646
to
2c7c8d1
Compare
OK, think I got it working - should be good to go when you run the workflow. Thanks! |
2c7c8d1
to
5bb9bfa
Compare
Currently, the --no-install option to `bundle package` is totally ignored for git sources. This can have very strange effects if you have: - a git-sourced gem, - with native extensions, - whose extconf.rb script depends on another gem, - which is installed from Rubygems in the gemfile. In that circumstance, `bundle package --no-install --all` will download the Rubygems dependencies to `vendor/cache` but NOT install them. It will also check out the git gems to `vendor/cache` (good), and attempt to build their native extensions (bad!). The native extension build will fail because the extconf.rb script crashes, since the dependency it needs is missing. I implemented a fix for this in `source/git.rb`, since this is analogous to what's happening in `source/rubygems.rb`. I do admit though the whole thing is a little strange though - an "install" method that.... proceeds to look at a global flag to not install anything. Add test to confirm cache respects the --no-install flag Co-authored-by: KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
5bb9bfa
to
5a77d1c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems good now. There were two lint issues but I fixed them myself to not delay this fix anymore!
Great, thanks for your help, sorry it took me so long! |
Thanks to you for the fix! |
…ll_git_gems_with_noinstall Respect --no-install option for git: sources (cherry picked from commit 5272c1e)
What was the end-user or developer problem that led to this PR?
Currently, the --no-install option to
bundle package
is totally ignored for git sources. This can have very strange effects if you have:In that circumstance,
bundle package --no-install --all
will download the Rubygems dependencies tovendor/cache
but NOT install them. It will also check out the git gems tovendor/cache
(good), and attempt to build their native extensions (bad!).The native extension build will fail because the extconf.rb script crashes, since the dependency it needs is missing.
What is your fix for the problem, implemented in this PR?
I implemented a fix for this in
source/git.rb
as an early return ifBundle.settings[:no_install]
, since this is analogous to what's happening insource/rubygems.rb
.I do admit though the whole thing is a little strange though - an "install" method that.... proceeds to look at a global flag to not install anything.
At this point, if you think this is the right solution for the problem, I can whip up a test and then get this merged. If you think there's a better way to factor this package functionality though I'm all ears.
Make sure the following tasks are checked