Skip to content

Use UnpackedInstaller to install default gems. #2545

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

Closed
wants to merge 0 commits into from

Conversation

voxik
Copy link
Contributor

@voxik voxik commented Oct 10, 2019

This builds on top of #2515 and uses UnpackedInstaller for installation of default gems similarly it is already used to install bundled gems.

This allows to reuse RubyGems functionality instead of custom code full of exceptions.

@voxik
Copy link
Contributor Author

voxik commented Oct 10, 2019

Honestly, I'd be more than happy if the .gemspec files of default gems in repository used similar position and format. For example compare these:

https://github.com/ruby/ruby/blob/master/lib/prime.gemspec
https://github.com/ruby/ruby/blob/master/lib/irb/irb.gemspec

These files are for no reason placed in different subdirectory. Would it be problem, if I submitted patch shuffling these around? Of course the best location would be the source root directory. That way, the file list would be usable without too much magic. Second and third options are placing all the .gemspec files either directly into the "lib" directory or have the subdirectories for each gem. Both are possible and both should be easily doable.

Also, it is pain that the executables are placed in "libexec" directory, but the .gemspec files does not respect the placement. They sometimes specify "bin", other times "exe". Sometimes, the location is even modified comparing to the upstream, such as in Bundler case [1]. Frankly, I consider this case the worst of all, because it cannot be synchronized with upstream and places yet another exception.

@voxik voxik force-pushed the unpacked-installer-for-default-gems branch 5 times, most recently from a57a97b to c54583e Compare October 16, 2019 16:05
@voxik voxik force-pushed the unpacked-installer-for-default-gems branch from c54583e to 87c715c Compare February 24, 2020 16:53
@hsbt
Copy link
Member

hsbt commented Feb 26, 2020

@voxik Can you rebase with the current master branch?

@voxik
Copy link
Contributor Author

voxik commented Feb 26, 2020

@voxik Can you rebase with the current master branch?

I'll take a look. It seems there are now 55bf0ef and 8dab71b apart from my changes. Have to investigate their impact

@voxik voxik mentioned this pull request Feb 27, 2020
2 tasks
@voxik voxik force-pushed the unpacked-installer-for-default-gems branch from 87c715c to b2ead15 Compare February 27, 2020 11:02
@voxik
Copy link
Contributor Author

voxik commented Feb 27, 2020

@voxik Can you rebase with the current master branch?

Done.

@voxik voxik force-pushed the unpacked-installer-for-default-gems branch from b2ead15 to 1eaa68b Compare February 27, 2020 11:05
@deivid-rodriguez
Copy link
Contributor

These files are for no reason placed in different subdirectory. Would it be problem, if I submitted patch shuffling these around? Of course the best location would be the source root directory. That way, the file list would be usable without too much magic. Second and third options are placing all the .gemspec files either directly into the "lib" directory or have the subdirectories for each gem. Both are possible and both should be easily doable.

Source root directory sounds like the best place indeed and would allow much easier gemspec syncronization with upstream.

Copy link
Contributor

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

Looking good!

@deivid-rodriguez
Copy link
Contributor

@voxik Fixes in #2930 were merged, so you need to rebase here.

@deivid-rodriguez
Copy link
Contributor

@voxik Ping, I'd really like this PR to go in!

@voxik
Copy link
Contributor Author

voxik commented Mar 30, 2020

Sorry, it is still on my todo list, but I am buried under other stuff ATM :/

@deivid-rodriguez
Copy link
Contributor

@voxik I plan to work on this at some point too, so if I end up beating you to it, I'll let you know so we don't duplicate work 👍.

@voxik
Copy link
Contributor Author

voxik commented Apr 19, 2020

@deivid-rodriguez sure thing 👍

@junaruga
Copy link
Member

@voxik This is just a friendly reminder for you to rebase. Thank you.

@nobu nobu force-pushed the unpacked-installer-for-default-gems branch from ac4fb4d to ae791e6 Compare February 14, 2021 02:15
@nobu nobu closed this Feb 14, 2021
@nobu nobu force-pushed the unpacked-installer-for-default-gems branch from ae791e6 to fc56b96 Compare February 14, 2021 05:05
@nobu
Copy link
Member

nobu commented Feb 14, 2021

Rebase had removed the commits, and closed unintentionally.

@voxik
Copy link
Contributor Author

voxik commented Feb 15, 2021

Thx for merging 🔝

I think there was omitted one bit. I was using this hunk for some purpose:

@@ -788,6 +794,11 @@ class Gem::Installer
     end
   end
 
+  default_spec_file = instance_method(:default_spec_file)
+  define_method(:default_spec_file) do
+    with_destdir(default_spec_file.bind(self).call)
+  end
+
   generate_bin_script = instance_method(:generate_bin_script)
   define_method(:generate_bin_script) do |filename, bindir|
     generate_bin_script.bind(self).call(filename, bindir)

Of course I don't remember anymore without more investigation 🤷‍♂️

@nobu
Copy link
Member

nobu commented Feb 15, 2021

Tests failed with overriding default_spec_file.

def default_spec_file
  with_destdir(super)
end

@voxik
Copy link
Contributor Author

voxik commented Feb 15, 2021

Ah, ok. Thx. I'll try to get back to this once the situation in Fedora stabilized and I have some free cycles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants