Commit graph

93 commits

Author SHA1 Message Date
David Rodríguez
9e566141cd [rubygems/rubygems] Remove "double CI" for testing Bundler 4 mode
Since now every functionality that changes in Bundler 4 is under a
setting, we can enable that setting to test the new functionality,
without having to run our full CI twice.

This can actually be seen as increasing coverage, because Bundler 4
functionality will now be tested on Windows, MacOS, or any other
environment where previously "Bundler 4 mode" was not running.

1cb3e009fc
2025-06-30 12:56:50 +09:00
David Rodríguez
54e51f1fc3 [rubygems/rubygems] Make yet one more update spec independent of running version
07762f6c1f
2025-06-26 08:06:46 +09:00
David Rodríguez
7e0358e04f [rubygems/rubygems] Make one more update spec independent of running version
dcd8e8210f
2025-06-26 08:06:45 +09:00
David Rodríguez
32a9f29cc8
[rubygems/rubygems] Remove no longer necessary workarounds for restarts
Since we no longer pass ruby CLI flags in our spec commands, we no
longer need the previous workaround and can get the realworld code
tested.

fd92c855fb
2025-06-24 12:10:50 +09:00
David Rodríguez
441f18df52
Skip to Bundler 4 directly 2025-06-19 10:23:36 +09:00
David Rodríguez
f3ea6c35cc
[rubygems/rubygems] Normalize Bundler version spec filters
28b6a7cf5e
2025-06-19 10:23:36 +09:00
David Rodríguez
4245d522b2
[rubygems/rubygems] Allow enabling "Bundler 3 mode" more easily
Currently to test Bundler 3 mode we have to actually edit the version
file to simulate we're running a future version. This is inconvenient.

Instead, allow passing an environment variable, `BUNDLER_3_MODE`, to set
the "working mode" Bundler should use.

This can now be set easily by end users to enable them to try out the
changes in the future version and give us feedback.

It's unclear how version auto-switching should work when this
environment variable is set, so the auto-switching feature will be
disabled in that case.

4e92e9b209
2025-06-19 10:23:36 +09:00
David Rodríguez
d95f7a3c43
[rubygems/rubygems] Extract stdboth spec helper
bb13f4e702
2025-06-06 10:09:14 +09:00
David Rodríguez
e4933e1d93 [rubygems/rubygems] Fix bundle update --bundler when restarts disabled
There's no reason why we should not update bundler as requested, even if
restarts are disabled.

e59acd2a0d
2025-06-05 19:12:45 +09:00
David Rodríguez
5cf07c1e8f [rubygems/rubygems] Look in configured path when checking if self-update version is installed
1ce0882e6f
2025-06-05 19:12:44 +09:00
David Rodríguez
1befc5d102 [rubygems/rubygems] Make update specs independent from version of Bundler
609b21a5fe
2025-06-05 19:12:44 +09:00
David Rodríguez
38024772ca [rubygems/rubygems] Refine bundle update --verbose logs
Don't mention "Found changes from the lockfile" because that's not
really true in general.

0181c278e8
2025-04-14 16:17:50 +09:00
David Rodríguez
b2bcd36044
[rubygems/rubygems] Remove edge cases for not removing invalid platforms
Instead, remove them anytime we find dependencies don't match the
lockfile for a platform, and then add them back after resolution if
they ended up being valid.

220bd77887
2025-03-31 09:39:22 +09:00
David Rodríguez
bb1b5877a7 [rubygems/rubygems] Consistently use "lockfile" over "lock file"
e891be9197
2025-03-24 13:25:07 +09:00
David Rodríguez
51958bae66 [rubygems/rubygems] Prefer FileUtils.rm_r to FileUtils.rm_rf for specs
Because it does not swallow errors if it fails to remove the given
folders, making issues easier to debug.

0db12d7afc
2025-03-12 18:02:09 +09:00
David Rodríguez
507de2226b [rubygems/rubygems] Fix Bundler incorrectly downgrading direct dependencies
There's no reason to call `converge_specs` when adding additional
lower bound requirements to prevent downgrades, and it actually causes
the extra requirements to be missed sometimes.

Loop over the originally locked specs directly, adding the additional
precaution of not adding the requirement if the Gemfile dependency has
changed and it no longer matches the locked spec.

5154506912
2025-02-18 12:12:54 +09:00
David Rodríguez
151b436c9d
[rubygems/rubygems] Fix incorrect error message in frozen mode
When Bundler refuses to install in frozen mode, sometimes it would
incorrectly claim that some dependencies have been added to the Gemfile
when that's not really the case. Fix that by making sure
`locked_dependencies` always has all locked dependencies, even when
unlocking,

Additionally, the suggestion to run `bundle install` is also confusing
when unlocking, since `bundle update` is what has been run. So skip that
part as well when unlocking.

64d84ad7d8
2025-02-13 09:37:51 +09:00
David Rodríguez
09b04fefb7 [rubygems/rubygems] Remove unnecessary platform helpers
I think they add unnecessary indirection and inconsistency to the specs.

609924d985
2025-01-28 15:31:49 +09:00
David Rodríguez
11e522b913 [rubygems/rubygems] Fix installs of subdependencies of unlocked dependencies to be conservative
When converging specification to pass the set of versions that should be
preserved from the lockfile during resolution, we should make sure all
top level gems are considered, and only exclude those gems themselves
(and not their dependencies) if their locked versions happen to not be
satisfied by an edited Gemfile.

ed2f1b7b88
2024-11-26 15:11:05 +09:00
Samuel Giddins
e472d1a6d6 [rubygems/rubygems] Remove extra space in BUNDLED WITH section
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

d8b5d05e46
2024-10-04 20:01:56 +00:00
Samuel Giddins
db6e6155d6 [rubygems/rubygems] Remove outdated conditionals from tests
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

06eec6d855
2024-10-04 20:01:51 +00:00
David Rodríguez
c262861e5c [rubygems/rubygems] Fix RubyGems warnings about pre-release dependencies
Nothing here relies on the dependency being on a pre-release, and
Bundler does not use prereleases in the realworld.

96f5742ff1
2024-09-20 15:57:40 +00:00
David Rodríguez
8e2d971b9a [rubygems/rubygems] Remove redundant arguments passed to bundle helper
They are used by default.

0b7f7d879f
2024-09-13 12:42:26 +00:00
David Rodríguez
36b2fea691 [rubygems/rubygems] Remove BUNDLER_IGNORE_DEFAULT_GEM
As long as we use a high enough test version, the default version of
Bundler should never get in the middle.

d63f0818aa
2024-09-13 12:42:26 +00:00
David Rodríguez
642528511e [rubygems/rubygems] Make sure test does not load system version of Bundler
d850ea1d95
2024-09-13 12:42:25 +00:00
David Rodríguez
dc804bd83c [rubygems/rubygems] Extract a build_repo3 helper
d8cf4aa0cd
2024-08-05 17:27:11 +00:00
David Rodríguez
bfaccd6433 [rubygems/rubygems] Make all tests still pass when switching from truffleruby to cruby
4f3d9fa3bf
2024-07-26 08:05:53 +00:00
David Rodríguez
481c83453b [rubygems/rubygems] Enable checksums on Bundler 3 for fresh lockfiles
And get specs passing.

c23b5f5b84
2024-07-23 19:40:09 +00:00
David Rodríguez
1758d436e7 [rubygems/rubygems] Enforce passing a block to simulate_platform
0658903e25
2024-07-23 19:40:07 +00:00
David Rodríguez
98c923ff4b
Synchronize Bundler & RubyGems (#11071) 2024-06-28 10:12:29 -04:00
David Rodríguez
082472451d [rubygems/rubygems] Raise a friendly error whenever commands run in subshell take more than a minute
I expect to make occasional CI hangs easier to investigate.

Implementation was adapted from tty-command.

39c92955bf
2024-05-31 16:49:44 +00:00
David Rodríguez
68a1867f53 [rubygems/rubygems] Fix issue with bundle update with an out of sync lockfile
An old platform related bug fix made some existing lockfiles no longer
work because they included invalid platforms. So to make it backwards
compatible, code was added to remove invalid platforms from the lockfile
before resolution. This is skipped though when Gemfile has changed
dependencies because in that case we will be re-resolving anyways.
However, in the `bundle update` case, the detection of "dependencies
have changed" was not actually working making Bundler remove all
platforms and not be able to resolve.

6452adfd62
2024-04-29 08:56:55 +00:00
Alex Robbin
d7d59ea172 [rubygems/rubygems] add test case to ensure updating with multiple sources + caching maintains the right lockfile
65839757e6
2024-03-29 19:27:28 +00:00
David Rodriguez
7b3ef370f8 [rubygems/rubygems] Fix incorrect bundle update --bundler message
146de56353
2024-03-22 13:14:42 +00:00
David Rodríguez
f4a347b90f [rubygems/rubygems] Fix Bundler daily CI
There is another place artifice usage was making the copy of vendored
http in ruby-core be loaded instead of the one under test.

Remove unnecessary usage of artifice.

d2488199b0
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
82496f2b38 Merge RubyGems-3.5.2 and Bundler-2.5.2 2023-12-22 07:24:04 +09:00
David Rodríguez
2755cb1b2f [rubygems/rubygems] Use modern hashes consistently
bb66253f2c
2023-12-07 22:29:33 +00:00
Martin Emde
5f0ea3f590 [rubygems/rubygems] Converts Bundler lockfile checksum validation to opt-in only
Looks for the CHECKSUMS section in the lockfile, activating the feature
only if the section exists. Without a CHECKSUMS section, Bundler will
continue as normal, validating checksums when gems are installed while
checksums from the compact index are present.

2353cc93a4
2023-12-05 21:09:53 +00:00
David Rodríguez
435eb56f61 [rubygems/rubygems] Automatically lock extra ruby platforms
Since we started locking the specific platform in the lockfile, that has
created an annoying situation for users that don't develop on Linux.
They will create a lockfile on their machines, locking their local
platform, for example, darwin. But then that lockfile won't work
automatically when deploying to Heroku for example, because the lockfile
is frozen and the Linux platform is not included.

There's the chance though that resolving against two platforms (Linux +
the local platform) won't succeed while resolving for just the current
platform will. So, instead, we check other platform specific variants
available for the resolution we initially found, and lock those
platforms and specs too if they satisfy the resolution.

This is only done when generating new lockfiles from scratch, existing
lockfiles should keep working as before, and it's only done for "ruby
platforms", i.e., not Java or Windows which have their own complexities,
and so are excluded.

With this change, we expect that MacOS users can bundle locally and
deploy to Heroku without needing to do anything special.

5f24f06bc5
2023-11-13 11:06:10 +09:00
David Rodríguez
f67a80cdc0
[rubygems/rubygems] No need to let this command fail
This command is not expected to fail. If it fails, we can stop the test.

2511a5b093
2023-11-09 10:34:48 +09:00
Martin Emde
c667de72ff
[rubygems/rubygems] Improve errors and register checksums reliably
Improve error reporting for checksums, raises a new error class.

Solve for multi-source checksum errors.

Add CHECKSUMS to tool/bundler/(dev|standard|rubocop)26_gems.rb

26ceee0e76

Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
2023-10-23 13:59:01 +09:00
Martin Emde
92f23a48e3
[rubygems/rubygems] Refactor Checksum classes and methods to reduce
code.
(https://github.com/rubygems/rubygems/pull/6917)

2238bdaadc
2023-10-23 13:59:01 +09:00
Samuel Giddins
c5fd94073f
[rubygems/rubygems] Refactor to checksums stored via source
This gets the specs passing, and handles the fact that we expect
checkums to be pinned only to a particular source

This also avoids reading in .gem files during lockfile generation,
instead allowing us to query the source for each resolved gem to grab
the checksum

Finally, this opens up a route to having user-stored checksum databases,
similar to how other package managers do this!

Add checksums to dev lockfiles

Handle full name conflicts from different original_platforms when adding checksums to store from compact index

Specs passing on Bundler 3

86c7084e1c
2023-10-23 13:59:01 +09:00
Mercedes Bernard
69d7e9a12e
[rubygems/rubygems] Use the server checksum, then calculate from gem on disk if possible
1. Use the checksum provided by the server if provided: provides security
knowing if the gem you downloaded matches the gem on the server

2. Calculate the checksum from the gem on disk: provides security knowing
if the gem has changed between installs

3. In some cases, neither is possible in which case we don't put anything
in the checksum and we maintain functionality as it is today

Add the checksums to specs in the index if we already have them

Prior to checksums, we didn't lose any information when overwriting specs
in the index with stubs. But now when we overwrite EndpointSpecifications
or RemoteSpecifications with more generic specs, we could lose checksum
info. This manually sets checksum info so we keep it in the index.

de00a4f153
2023-10-23 13:59:01 +09:00
Thong Kuah
ad08674d8d
[rubygems/rubygems] Add CHECKSUMS for each gem in lockfile
We lock the checksum for each resolved spec under a new CHECKSUMS
section in the lockfile.

If the locked spec does not resolve for the local platform, we preserve
the locked checksum, similar to how we preserve specs.

Checksum locking only makes sense on install. The compact index
information is only available then.

bde37ca6bf
2023-10-23 13:59:01 +09:00
David Rodríguez
0b0df03b0d
[rubygems/rubygems] Avoid printing using messages when version has not changed
9635a2fd74
2023-07-24 15:03:15 +09:00
Hiroshi SHIBATA
1edbaa850f Merge rubygems/rubygems HEAD
Pick from 880dd95996
2023-06-20 13:35:13 +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
e7749c4dea [rubygems/rubygems] Remove weird line breaks in the middle of error message
22b8caf42f
2023-06-15 07:01:21 +09:00