Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Correctly re-install extensions when running pristine for a git source #6305

Merged
merged 1 commit into from Mar 27, 2018

Conversation

wagenet
Copy link
Contributor

@wagenet wagenet commented Feb 22, 2018

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

@colby-swandale
Copy link
Member

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 colby-swandale added this to the 1.16.2 milestone Feb 22, 2018
@wagenet
Copy link
Contributor Author

wagenet commented Feb 23, 2018

@colby-swandale sure! I'll do that tomorrow.

@wagenet
Copy link
Contributor Author

wagenet commented Feb 23, 2018

@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)
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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. 👍

Copy link
Member

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.

@indirect
Copy link
Member

indirect commented Mar 5, 2018

@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit a936ef3 has been approved by indirect

@indirect
Copy link
Member

indirect commented Mar 5, 2018

@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. 👍

@wagenet
Copy link
Contributor Author

wagenet commented Mar 5, 2018

@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.

@segiddins
Copy link
Member

👍 from me

@colby-swandale
Copy link
Member

ping @indirect

@indirect
Copy link
Member

@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit a936ef3 has been approved by indirect

@bundlerbot
Copy link
Collaborator

⌛ Testing commit a936ef3 with merge 77dbd12...

bundlerbot added a commit that referenced this pull request Mar 27, 2018
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
@indirect
Copy link
Member

I think it looks right, sorry for the hassle, and thanks for the patch!

@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: indirect
Pushing 77dbd12 to master...

@bundlerbot bundlerbot merged commit a936ef3 into rubygems:master Mar 27, 2018
@wagenet wagenet deleted the fix-git-pristine branch March 28, 2018 00:26
@colby-swandale colby-swandale modified the milestones: 1.16.2, 1.17.0 Apr 4, 2018
colby-swandale pushed a commit that referenced this pull request Sep 20, 2018
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)
colby-swandale pushed a commit that referenced this pull request Oct 5, 2018
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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running bundle pristine on a git source gem doesn't rebuild the native extension
5 participants