Commit graph

146 commits

Author SHA1 Message Date
David Rodríguez
2e04336b67
[rubygems/rubygems] Fix git source conservativeness
9a0e0dfd5b
2023-08-16 15:03:38 +09:00
David Rodríguez
4a3777bf6b
[rubygems/rubygems] Extract s.name to a variable
689c39b42f
2023-08-16 15:03:38 +09:00
David Rodríguez
e92ace6be7
[rubygems/rubygems] Remove unneeded stuff
This should be only for path sources, and unrelated to git.

0d8f31eeed
2023-08-16 15:03:38 +09:00
David Rodríguez
7bb3e637ff
[rubygems/rubygems] Don't update locked sources when not necessary
cfc82b592a
2023-08-16 15:03:38 +09:00
David Rodríguez
c57ab646cb
[rubygems/rubygems] Extract a default_source method
784e08348e
2023-08-16 15:03:38 +09:00
David Rodríguez
002165f8fe
[rubygems/rubygems] Move lockfile_source variable out of condition branch
efebc64250
2023-08-16 15:03:38 +09:00
David Rodríguez
6bc63ab9bb
[rubygems/rubygems] Refactor locked dep filtering more
We only need to check whether the spec if for a direct dependency once.

65b455a5cb
2023-08-16 15:03:38 +09:00
David Rodríguez
86492fca65
[rubygems/rubygems] Avoid unnecessary loop through dependencies
2ab63bb94d
2023-08-16 15:03:38 +09:00
David Rodríguez
8c82b35791
[rubygems/rubygems] Exclude Bundler from missing locked dependencies check
Bundler is special since it's not actually locked in the lockfile as a
regular gem (only via `BUNDLED WITH`). So exclude it from that check.

9f1756ec47
2023-07-24 15:03:15 +09:00
David Rodríguez
0ae2709dd7 [rubygems/rubygems] When printing frozen errors, print only Gemfile information
93f74abc5f
2023-07-04 14:54:25 +09:00
David Rodríguez
0fcb4c6af7 [rubygems/rubygems] Fix another incorrect removal of "ruby" platform from lockfile
When dependencies in path sources have changed, we'll be re-resolving,
and we can't really know whether the resolution will be valid or invalid
for the Ruby platform, so skip the removal in that case.

afc3b0956f
2023-07-04 14:54:25 +09:00
Hiroshi SHIBATA
1edbaa850f Merge rubygems/rubygems HEAD
Pick from 880dd95996
2023-06-20 13:35:13 +09:00
David Rodríguez
3e7f5b02ae [rubygems/rubygems] Improve error message in frozen mode edge case
When a top level dependency is missing from the lockfile, and we're in
frozen mode, we should also print a "frozen error".

3e82b835e3
2023-06-15 07:01:25 +09:00
David Rodríguez
e86f4c581b [rubygems/rubygems] Improve frozen mode error message
This error message is also printed when using `bundler/setup` in frozen
model, so we're not necessarily installing any gems when it happens.

This new message play nicer with all situations.

6874bbacce
2023-06-15 07:01:25 +09:00
David Rodríguez
23ecaab8dd [rubygems/rubygems] Use "frozen" rather than "deployment" in error message
I think it communicates better what's going on.

07a25767a4
2023-06-15 07:01:24 +09:00
David Rodríguez
2ff9b7b93d [rubygems/rubygems] Show missing spec in lockfile incomplete error message
b86caaa3d5
2023-06-15 07:01:24 +09:00
David Rodríguez
21238f38a8 [rubygems/rubygems] Extract Definition#no_resolved_needed?
1ff8626571
2023-06-15 07:01:23 +09:00
David Rodríguez
4f1b1817a8 [rubygems/rubygems] There should always be a reason
4180008c2d
2023-06-15 07:01:23 +09:00
David Rodríguez
c12168185e [rubygems/rubygems] Show relative path to Gemfile in error message
For conciseness and consistency with printing the relative path to the
lockfile just before.

74cf6aea7c
2023-06-15 07:01:22 +09:00
David Rodríguez
e7749c4dea [rubygems/rubygems] Remove weird line breaks in the middle of error message
22b8caf42f
2023-06-15 07:01:21 +09:00
David Rodríguez
90c60e8138 [rubygems/rubygems] Simplify checking Gemfile vs lockfile sources
251e80aec6
2023-06-15 07:01:21 +09:00
David Rodríguez
96e3f31c1e [rubygems/rubygems] Make frozen mode spec also pass on Bundler 3
ad52f840f2
2023-06-15 07:01:20 +09:00
David Rodríguez
1f9e66836b [rubygems/rubygems] Fix inline mode with multiple sources
If we're in inline mode, Bundler first resolves using only local gems,
and if some gems are missing, then it re-resolves using remote gems.
However, "source resolution" from the initial "local" try was being
memoized, resulting in Bundler not looking for some gems remotely in the
second resolution.

This commit forces a proper re-resolve in this case.

fdc631075e
2023-06-06 10:52:53 +09:00
Hiroshi SHIBATA
4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
David Rodríguez
f3d69bed62
[rubygems/rubygems] Fix resolver hangs when dealing with an incomplete lockfile
While working on locking multiple platforms by default, I got an
infinite resolution loop in one of our resolver specs.

The culprit ended up being that when dealing with lockfile specs with
incomplete dependencies (spec appears in lockfile, but its dependencies
don't), those specs were not being properly expired and that tripped up
resolution.

The issue for some reason only manifests when dealing with multiple
lockfile platforms, that's why it only manifested when working on
locking multiple platforms by default.

4ca72913bb
2023-04-06 13:07:16 +09:00
David Rodríguez
674c960513 [rubygems/rubygems] Fix incorrect removal of "ruby" platform from lockfile
When dependencies have changed, we'll be re-resolving, and we can't
really know whether the resolution will be valid or invalid for the Ruby
platform, so skip the removal in that case.

The fix worked, but made some other specs fail, and surfaced that the
`@dependencies_changed` attribute was actually being incorrect set when
explicitly unlocking. Fixed that with an early return.

20d8f5e5d9
2023-03-28 15:25:42 +09:00
David Rodríguez
eaddd386ec [rubygems/rubygems] Also set min locked requirements when not unlocking
3561ac23d6
2023-03-28 15:25:40 +09:00
Hiroshi SHIBATA
d3822c9a8a Merge RubyGems/Bundler master.
Pick from 5ace20dbec
2023-01-31 10:49:08 +09:00
Hiroshi SHIBATA
a43f1d90c2 Merge RubyGems and Bundler master
from 0635c1423d
2023-01-10 15:53:07 +09:00
Hiroshi SHIBATA
b7ad60a794 Merge RubyGems/Bundler master
from 72fd3dd209
2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA
f6620037ba Merge RubyGems-3.4.0 and Bundler-2.4.0 2022-12-24 16:57:07 +09:00
David Rodríguez
3fd33590f6 [rubygems/rubygems] Fix crash when lockfile is missing dependencies
We have a check for a corrupt lockfile right before installing. However,
the check accounted for locked specs not satisfying locked dependencies,
but not for locked specs missing for some locked dependencies.

Instead of fixing this check, I decided to remove it in favor of
automatically detecting the situation and re-resolve to automatically
fix the lockfile rather than printing a warning but leave the problem
there.

4a7a584252
2022-12-20 13:15:02 +09:00
David Rodríguez
16b36a5b0c [rubygems/rubygems] Remove unused code
b88c43a28c
2022-12-20 13:15:02 +09:00
Hiroshi SHIBATA
bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
Hiroshi SHIBATA
a4e14b9d9d Merge RubyGems/Bundler master
Pick from 823c776d95
2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA
0a9d51ee9d Migrate our resolver engine to PubGrub
https://github.com/rubygems/rubygems/pull/5960

  Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2022-11-12 07:40:31 +09:00
Hiroshi SHIBATA
28611be6ee Merge RubyGems/Bundler master from ee2f8398324af4bc1b95f7565ce2fda98126e026 2022-11-11 17:24:08 +09:00
Hiroshi SHIBATA
f5df47d1f3 Merge RubyGems/Bundler master
6214d00b23
2022-10-18 16:33:15 +09:00
David Rodríguez
67de00053a [rubygems/rubygems] Inline helper method
e60459d6b6
2022-10-18 16:33:15 +09:00
David Rodríguez
b99010f9f2 [rubygems/rubygems] Use flat_map
b31308fb4c
2022-10-18 16:33:15 +09:00
David Rodríguez
71dede387e [rubygems/rubygems] Remove one more expand_dependencies call
996fd81871
2022-10-18 16:33:15 +09:00
David Rodríguez
cef7f6b224 [rubygems/rubygems] Remove now unnecessary parameter to expand_dependencies
We just call it once for resolution, so we can simplify things.

99c144fbe3
2022-10-18 16:33:15 +09:00
David Rodríguez
8c4bd1e58d [rubygems/rubygems] Remove another expand_dependencies instance
33769ddb07
2022-10-18 16:33:15 +09:00
David Rodríguez
60670b163f [rubygems/rubygems] Remove another unnecessary dependency expansion
b4a0fcd2d2
2022-10-18 16:33:15 +09:00
David Rodríguez
0b6f2af3ba [rubygems/rubygems] Avoid unnecessary dependency expansion
426748ed06
2022-10-18 16:33:15 +09:00
David Rodríguez
da1981fca4 [rubygems/rubygems] Remove unused parameter to SharedHelpers.pretty_dependency
665051d085
2022-10-18 16:33:15 +09:00
David Rodríguez
358fe26b31 [rubygems/rubygems] Fix little UI issue when bundler shows duplicated gems in a list
3f71d882e9
2022-10-06 05:13:39 +09:00
David Rodríguez
dce73c8616 [rubygems/rubygems] Simplify instantiating the gem version promoter
c4e2737f2c
2022-09-12 22:13:30 +09:00
Hiroshi SHIBATA
3eca1e438d Merge 16c3535413 2022-09-05 14:37:12 +09:00
David Rodríguez
ad8774f8e5 [rubygems/rubygems] Fix another regression for sorbet
Recently a changed was introduced to update the resolver platforms after
it has been created, in order to remove the "ruby" platform from it if
it's to be removed from the lockfile. However, it did not update the
`@resolving_only_for_ruby` instance variable in that case, so the
resolver was not properly doing the right thing anymore.

To fix this, I tweaked the code to restore not changing resolver
platforms after the resolver has been instantiated.

8fbc30a1d0
2022-08-25 23:39:02 +09:00