Commit graph

84 commits

Author SHA1 Message Date
Nathan Ladd
3ac239f790 [rubygems/rubygems] Copy prerelease attribute to dependency resolver sets
5956e7f8e5
2025-05-21 11:33:32 +09:00
David Rodríguez
79f3167e0b [rubygems/rubygems] Let compact index response parser consistently return a mutable dependencies array
That restores support for compact index dummy implementations that only lists
versions, without checksums or dependencies.

This format is undocumented, so we may want to get rid of it in the
future. However, some of our tests rely on it, and some implementations
did use it (gems.mutant.dev at least). And the way the code was written
suggest that support was intentional.

So for now, we should restore it.

0427d8c983
2025-04-01 09:57:40 +09:00
Samuel Giddins
7daf85bdf2 [rubygems/rubygems] Stop storing executable names in ivars
Removes usage of these classes as ACE gadgets

See https://nastystereo.com/security/ruby-3.4-deserialization.html

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

89ad04db86
2024-12-05 19:00:44 +00:00
David Rodríguez
4addaaf4df [rubygems/rubygems] More aggressive Performance/FlatMap cop configuration
d8d68cc00e
2024-11-26 15:11:05 +09:00
David Rodríguez
acbdb30941 [rubygems/rubygems] Fix error in one source when fetching dependency APIs clearing results from all sources
0549ddbcc5
2024-10-02 10:37:26 +00:00
David Rodríguez
e52d4d462f [rubygems/rubygems] Fix bundle exec rake install failing when local gem has extensions and gemspec DSL is being used
In a `bundle exec` context, the local specification will actually be
part of the known specifications, so RubyGems will assume it has already
been installed, which is not actually true.

This will cause `RequestSet` to rebuild extensions for a gem that's not
actually installed, causing errors.

The fix is to make sure detection of installed activation requests
considers not only that there's a known spec with the same full name as
the one being installed, but also that this spec is installed in the
same gem_home were pretend to install the new gem.

a8ef1286a6
2024-09-11 11:28:35 +00:00
David Rodríguez
fe1bace43c [rubygems/rubygems] Fix gem install does-not-exist being super slow
Every time a gem is not found in the Compact Index API, RubyGems will
fallback to the full index, which is very slow. This is unnecessary
because both indexes should be providing the same gems, so if a gem
can't be found in the Compact Index API, it won't be found in the full
index.

We _do_ want a fallback to the full index, whenever the Compact Index
API is not implemented. To detect that, we check that the API responds
to the "/versions" endpoint, just like Bundler does.

Before:

```
$ time gem install fooasdsfafs
ERROR:  Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem  20,77s user 0,59s system 96% cpu 22,017 total
```

After:

```
$ time gem install fooasdsfafs
ERROR:  Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem  5,02s user 0,09s system 91% cpu 5,568 total
```

c0d6b9eea7
2024-09-06 18:44:37 +00:00
David Rodriguez
06d5d4f1d0 [rubygems/rubygems] Fix resolver bug where ActivationRequest objects were not properly compared
They were delegating their `#hash` value to a class not overriding that
method, and so were returning inconsistent results.

723e4ee0fc
2024-03-25 19:45:51 +00:00
Hiroshi SHIBATA
b31995d882 [rubygems/rubygems] Rename molinillo wrapper file to vendored_molinillo.rb
d7c15f6fd7
2024-01-30 09:26:54 +00:00
Hiroshi SHIBATA
03246171cc
Move molinillo under the vendor directory 2024-01-30 14:07:51 +09:00
David Rodríguez
d64d0b5423
Vendor uri gem in RubyGems 2024-01-29 12:14:21 +09:00
Samuel Giddins
ca7f7c0f51 [rubygems/rubygems] Refactor vendoring to allow validating vendoring is reproducible
Helps ensure that unsuspecting diffs to the vendored code arent accidentally introduced

7c425d49dd
2023-12-15 14:48:25 +00:00
Samuel Giddins
2b6228be48 [rubygems/rubygems] Reduce allocations when parsing compact index
This still allocates a ton (a string for each line, plus a bunch of
splits into arrays), but it helps a bit when Bundler has to go through
dependency resolution.

```
==> memprof.after.txt <==
Total allocated: 194.14 MB (2317172 objects)
Total retained:  60.81 MB (593164 objects)

==> memprof.before.txt <==
Total allocated: 211.97 MB (2404890 objects)
Total retained:  62.85 MB (640342 objects)
```

c68b41b0e5
2023-10-08 04:17:15 +00:00
Josef Šimánek
25b536cc2f
[rubygems/rubygems] Fix invalid links in documentation. - wrap ENV variables in <code> - fix rubygems.org link - fix zenspider.com link
9eaac94a63
2023-10-03 16:13:18 +09:00
David Rodríguez
34f541ae36
[rubygems/rubygems] Avoid unnecessary network requests for local gem
ec5f04f7b1
2023-07-24 15:03:15 +09:00
Hiroshi SHIBATA
827d66266b [rubygems/rubygems] auto-correct Style/YodaCondition
6d9e8025dc
2023-06-15 07:01:28 +09:00
Hiroshi SHIBATA
250e97c0fb [rubygems/rubygems] util/rubocop -A --only Style/FormatString
132a56569d
2023-04-07 05:13:05 +00:00
Hiroshi SHIBATA
fb822076d7 [rubygems/rubygems] util/rubocop -A --only Style/LineEndConcatenation
67ece7b8b6
2023-04-06 23:33:20 +00:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
4dd418f877 util/rubocop -A --only Style/FrozenStringLiteralComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
0eef33e113 [rubygems/rubygems] util/rubocop -A --only Style/Next
e5868e92f7
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
5211900d37 util/rubocop -A --only Style/SymbolProc 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
72d09a568f [rubygems/rubygems] util/rubocop -A --only Style/RedundantBegin
b595d3cf0f
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
3fe5909ef1 [rubygems/rubygems] util/rubocop -A --only Style/SelfAssignment
7c1168c623
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
712d6e675b [rubygems/rubygems] util/rubocop -A --only Style/RedundantInterpolation
add44e56eb
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
0b632b9cdd [rubygems/rubygems] util/rubocop -A --only Style/ClassCheck
1c3356a872
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
3d4c3f9e4f [rubygems/rubygems] util/rubocop -A --only Style/ParallelAssignment
5c88c77873
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
26d6604343 [rubygems/rubygems] util/rubocop -A --only Layout/MultilineMethodCallBraceLayout
acb0548bf6
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
a43f1d90c2 Merge RubyGems and Bundler master
from 0635c1423d
2023-01-10 15:53:07 +09:00
David Rodríguez
d82328ffc8 [rubygems/rubygems] Bump Molinillo and tsort
And configure tsort to be vendored as a dependency of Molinillo.

8ec749f891
2022-12-11 13:35:00 +00:00
Benoit Daloze
a57a3154d3 [rubygems/rubygems] Avoid deprecated Gem::Platform.match in Gem::Resolver::InstallerSet
05cb5410cb
2022-12-08 07:17:09 +00:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
Ilya Dyakonov
4f00ee8d47 [rubygems/rubygems] fix platform matching for index specs
f087f1b590
2022-08-03 06:56:36 +09:00
Takuya Noguchi
d7ffd3fea4
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-07-22 12:07:23 +09:00
David Rodríguez
ee5e684bc1 [rubygems/rubygems] Fix gem install <non-existent-gem> --force crash
Before:

```
$ gem install sfdsfdsfsdide --force
ERROR:  While executing gem ... (NoMethodError)
    undefined method `spec' for nil:NilClass

    @always_install << newest.spec
                             ^^^^^
```

After:

```
$ gem install sfdsfdsfsdide --force
ERROR:  Could not find a valid gem 'sfdsfdsfsdide' (>= 0) in any repository
```

4e2bfd1101
2022-01-06 23:52:48 +09:00
Frederik Dudzik
17fb785d15
[rubygems/rubygems] Vendor tsort into rubygems
So that it loads a consistent version of the library and `rubygems` is
never affected by gem activation conflicts related to `tsort`.

Getting CI green required updating one `bundler` spec, because `tsort`
is no longer loaded by `bundle clean` until after `BUNDLE_PATH` has been
changed, so to ensure it is found, it needs to be installed under
`BUNDLE_PATH` as well (which will be different from the global system
path on Bundler 3, meaning installing `tsort` to the global system path
is not enough there). This spec workaround can be removed once we also
vendor `tsort` inside `bundler`.

d326880999
2021-10-29 18:00:46 +09:00
David Rodríguez
eaeb5bf0bc [rubygems/rubygems] Avoid loading URI unnecessarily when activating gems
ef5f30cba7
2021-09-22 10:13:34 +09:00
Daniel Niknam
f212b9d4f2 [rubygems/rubygems] Refactor Ruby platform priority condition to its own method
The `Gem::Platform::RUBY ? -1 : 1` has been used multiple times in different places and could be refactored to a method (DRY).

9d43ca8f0c
2021-08-31 19:06:14 +09:00
Daniel Niknam
c71d1a26ef [rubygems/rubygems] Pick the last founded gems when fetching metadata
e3d150d822

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2021-08-31 19:06:14 +09:00
David Rodríguez
54ae3f587e [rubygems/rubygems] Prefer require_relative to require for internal requires
c74fc58695
2021-08-31 19:06:14 +09:00
David Rodríguez
5b0abba931 Sync bundler & rubygems 2021-05-11 11:29:41 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Gannon McGibbon
1def8a6004 [rubygems/rubygems] Replace "iff" with "whether" and "if and only if"
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
or "whether" should suffice.

88318ebc6d
2021-01-23 09:50:47 +09:00
Hiroshi SHIBATA
5537adf719 Track RubyGems master(3.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20 2021-01-04 13:14:43 +09:00
Hiroshi SHIBATA
339227363c Merge RubyGems 3.2.3 and Bundler 2.2.3 2020-12-23 10:17:41 +09:00
Hiroshi SHIBATA
2fa9f3c032 Prepare to release rubygems-3.2.1 and bundler-2.2.1 2020-12-15 10:54:09 +09:00
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Yusuke Endoh
c55b5f1062 [rubygems/rubygems] Avoid duplicated generation of APISpecification objects
As far as I could see, `Gem::Resolver::APISpecification` objects are
supposed to be immutable.  If my guessing is correct, then we can cache
and reuse its instances for performance.
At least, `rake` passes on my machine.

Before this change:

```
$ time ruby -I lib bin/gem install --no-doc aws-sdk
Successfully installed aws-sdk-3.0.1
1 gem installed
real    0m37.104s
user    0m36.952s
sys     0m0.333s
```

After this change:

```
$ time ruby -I lib bin/gem install --no-doc aws-sdk
Successfully installed aws-sdk-3.0.1
1 gem installed
real    0m23.905s
user    0m23.740s
sys     0m0.365s
```

7e8fbba85c
2020-09-28 14:54:22 +09:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc1 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00