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
Behaviour changes with default gems installer #2166
Conversation
Related with #677 |
@@ -112,6 +112,31 @@ class Gem::Specification < Gem::BasicSpecification | |||
|
|||
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc: | |||
|
|||
DEFAULT_GEMS_LIST = %w[ |
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.
shouldn't this pull from Gem::Specification.select(&:default_gem?).map(&:name)
?
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's not working. default gems were determined without ruby version.
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.
default gems were determined without ruby version
I'm not sure I understand what you mean by this?
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.
Default gems do not depend on Ruby version.
Ex. We can install default gems from listed by https://stdgems.org/ with old ruby. But is not activated in the current specification. I hope to activate them with old ruby.
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.
ah, good point
Which real-world problem? Does this only manifest on |
☔ The latest upstream changes (presumably #2177) made this pull request unmergeable. Please resolve the merge conflicts. |
ping @hsbt |
If you want to use the latest version of csv with Ruby 2.4.0 via |
lib/rubygems/installer.rb
Outdated
def verify_default_gems | ||
return unless options[:install_as_default] | ||
return if Gem::Specification::DEFAULT_GEMS_LIST.include?(spec.name) | ||
raise Gem::InstallError, "#{spec} is not a default gems" |
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.
not a default gem
?
lib/rubygems/specification.rb
Outdated
strscan | ||
webrick | ||
zlib | ||
] #:nodoc: |
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.
do we want to freeze this list, or otherwise append to it when we see more gems in the default directory?
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.
Good point. I will reconsider to handle its list.
@hsbt I'm running into the following issue with $ gem list json
*** LOCAL GEMS ***
json (default: 2.1.0)
jsonapi-renderer (0.2.0)
multi_json (1.13.1)
$ echo -e "source 'https://rubygems.org'\ngem 'json'" > Gemfile
$ bundle
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into `./.bundle`
$ bundle pristine
Failed to pristine json (2.1.0). Cached gem /home/deivid/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/cache/json-2.1.0.gem does not exist.
$ gem install json
Fetching: json-2.1.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-2.1.0
1 gem installed
$ bundle pristine
Installing json 2.1.0 with native extensions
$ gem uninstall json
Successfully uninstalled json-2.1.0
$ gem list json
*** LOCAL GEMS ***
json (default: 2.1.0)
jsonapi-renderer (0.2.0)
multi_json (1.13.1)
$ bundle pristine
Failed to pristine json (2.1.0). Cached gem /home/deivid/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/cache/json-2.1.0.gem does not exist. Do you think the root problem might be what this PR is trying to address? |
@deivid-rodriguez Yes, The current default-gems was inconsistency behavior. |
Great! For starters I'm going to try and confirm whether this PR fixes the problem! |
I tried it with this PR and I still get the same behavior. Can you confirm the issue? Maybe I didn't try it correctly. |
@deivid-rodriguez Sorry, I didn't understand that your expected behavior. Did you hope to finish |
Yeah, I hope But I just tried $ gem pristine json
Restoring gems to pristine condition...
Skipped json-2.1.0, it is a default gem So, this seems like a bug in |
@deivid-rodriguez Ah, I see. I missed |
@hsbt I'd like to move forward the work in this PR if that's ok with you? |
7216: Revert "Migrate requires from exe/ to also be relative" r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that in #7193, I included [a commit](d9d2bf6) to migrate requires included in bundler's executable to use `require_relative`. That broke stuff. ### What was your diagnosis of the problem? My diagnosis was the assumption that if `<install_folder>/exe/bundle` lives on a folder, the corresponding bundler lib lives on `<install_folder>/lib` doesn't hold for default gems. Default gems for gems with executables live in `site_lib` but install their executables in the standard gem location. That means that the reference commit breaks bundler when it is installed as a default gem. ### What is your fix for the problem, implemented in this PR? My fix is to revert the commit. ### Why did you choose this fix out of the possible options? I chose this fix because it's the easiest way. The proper long term fix is probably to make default gems behave in a more standard way. There's some ongoing work on that here: rubygems/rubygems#2166. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
7216: Revert "Migrate requires from exe/ to also be relative" r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that in rubygems/bundler#7193, I included [a commit](rubygems/bundler@d9d2bf6) to migrate requires included in bundler's executable to use `require_relative`. That broke stuff. ### What was your diagnosis of the problem? My diagnosis was the assumption that if `<install_folder>/exe/bundle` lives on a folder, the corresponding bundler lib lives on `<install_folder>/lib` doesn't hold for default gems. Default gems for gems with executables live in `site_lib` but install their executables in the standard gem location. That means that the reference commit breaks bundler when it is installed as a default gem. ### What is your fix for the problem, implemented in this PR? My fix is to revert the commit. ### Why did you choose this fix out of the possible options? I chose this fix because it's the easiest way. The proper long term fix is probably to make default gems behave in a more standard way. There's some ongoing work on that here: #2166. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
3773e15
to
b61a7ce
Compare
b61a7ce
to
165b475
Compare
I reboot this proposal for altanative approach of https://bugs.ruby-lang.org/issues/19351 |
f566bd8
to
a8347d7
Compare
a8347d7
to
40c925f
Compare
I changed my proposal. see #7588 |
Description:
A current installer of default gems only installs executable file and
gemspec
. It didn't resolve the real world problem.Default gems provide to upgrade standard libraries like
gem update openssl
. But current installer used bygem install openssl --default
is inconsistency behavior withgem update
.I change its behavior to install gem files and build native extensions. It can upgrade instructions for the old version of Ruby like 2.3 or 2.4.
Tasks:
I will abide by the code of conduct.