Correctly re-install extensions when running pristine
for a git source
#6305
Conversation
Can you please follow the PR template and put in the details that this PR is fixing. It's important because the PR description is used for the merge commit that we then use for things like releases. |
@colby-swandale sure! I'll do that tomorrow. |
@colby-swandale updated. Let me know if there's anything else I'm missing. |
@@ -30,6 +30,10 @@ def run | |||
FileUtils.rm_rf spec.full_gem_path | |||
when Source::Git | |||
source.remote! | |||
if extension_cache_path = source.extension_cache_path(spec) |
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.
should we be doing this for rubygems sources as well?
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.
@segiddins from what I could tell, the extension isn't being cached when installed via RubyGems. I may be mistaken, however, as most of my initial investigation was done on the 1.6 which doesn't have the cache.
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.
I believe extension-caching is RubyGems only, so this seems right to me. 👍
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.
Ignore me, that comment doesn't actually make sense.
@bundlerbot r+ |
📌 Commit a936ef3 has been approved by |
@bundlerbot r- After looking at this some more, I think pristine will fail to recompile .gem extensions as well. We should at least be sure one way or the other before merging. 👍 |
@indirect can you elaborate on the uncovered scenario? The other scenario I could see is covered here: https://github.com/wagenet/bundler/blob/a936ef3761c1971055cc438180b43af4315f08f1/spec/commands/pristine_spec.rb#L162, but I'm guessing I'm misunderstanding. |
👍 from me |
ping @indirect |
@bundlerbot r+ |
📌 Commit a936ef3 has been approved by |
Correctly re-install extensions when running `pristine` for a git source ### What was the end-user problem that led to this PR? I have a gem with a native extension that is installed via git. I had to recompile it due to some needed build arguments. ### The problem was... Running `bundle pristine` would not recompile it as expected. ### My diagnosis was... After digging into the source, I discovered that the built extension lived in a different location than the cloned git repo. `bundle pristine` was only removing the git repo so the built extension was not getting rebuilt. ### My fix... Update `bundle pristine` to also remove the built extension. For 2.0, this also required removing the built extension cache. Without doing that, the built extension directory would just be recreated from the cache. ### I chose this fix because... As far as I know, it's the only solution. Resolves #6294
I think it looks right, sorry for the hassle, and thanks for the patch! |
☀️ Test successful - status-travis |
Correctly re-install extensions when running `pristine` for a git source ### What was the end-user problem that led to this PR? I have a gem with a native extension that is installed via git. I had to recompile it due to some needed build arguments. ### The problem was... Running `bundle pristine` would not recompile it as expected. ### My diagnosis was... After digging into the source, I discovered that the built extension lived in a different location than the cloned git repo. `bundle pristine` was only removing the git repo so the built extension was not getting rebuilt. ### My fix... Update `bundle pristine` to also remove the built extension. For 2.0, this also required removing the built extension cache. Without doing that, the built extension directory would just be recreated from the cache. ### I chose this fix because... As far as I know, it's the only solution. Resolves #6294 (cherry picked from commit 77dbd12)
Correctly re-install extensions when running `pristine` for a git source ### What was the end-user problem that led to this PR? I have a gem with a native extension that is installed via git. I had to recompile it due to some needed build arguments. ### The problem was... Running `bundle pristine` would not recompile it as expected. ### My diagnosis was... After digging into the source, I discovered that the built extension lived in a different location than the cloned git repo. `bundle pristine` was only removing the git repo so the built extension was not getting rebuilt. ### My fix... Update `bundle pristine` to also remove the built extension. For 2.0, this also required removing the built extension cache. Without doing that, the built extension directory would just be recreated from the cache. ### I chose this fix because... As far as I know, it's the only solution. Resolves #6294 (cherry picked from commit 77dbd12)
What was the end-user problem that led to this PR?
I have a gem with a native extension that is installed via git. I had to recompile it due to some needed build arguments.
The problem was...
Running
bundle pristine
would not recompile it as expected.My diagnosis was...
After digging into the source, I discovered that the built extension lived in a different location than the cloned git repo.
bundle pristine
was only removing the git repo so the built extension was not getting rebuilt.My fix...
Update
bundle pristine
to also remove the built extension. For 2.0, this also required removing the built extension cache. Without doing that, the built extension directory would just be recreated from the cache.I chose this fix because...
As far as I know, it's the only solution.
Resolves #6294