Commit graph

76 commits

Author SHA1 Message Date
David Rodríguez
c31a9cf829 [rubygems/rubygems] Refactor spec helpers for reading lockfiles
ea2a30ba08
2023-07-24 14:59:33 +09:00
Hiroshi SHIBATA
4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
David Rodríguez
b5eb9ebd5d [rubygems/rubygems] Fix crash in pub grub involving empty ranges
0f168516f7
2023-02-21 19:28:12 +09:00
Daniel Colson
8edd350bda [rubygems/rubygems] Avoid crashing with a corrupted lockfile
I did a bad thing (script that edits the Gemfile.lock directly) and
ended up with a Gemfile.lock that was completely missing some indirect
dependencies. While this is my fault and an error is reasonable, I
noticed that the error got progressively less friendly in recent
versions of bundler.

Something similar came up in https://github.com/rubygems/rubygems/issues/6210,
and this commit would have helped with that case as well
(although we've already handled this a different way with #6219).

Details:
---

Back on Bundler 2.2.23, a corrupt lockfile like this would cause a helpful error:

```
Unable to find a spec satisfying minitest (>= 5.1) in the set. Perhaps the lockfile is corrupted?
```

Bundler 2.3.26 gave a helpful warning:

```
Warning:
Your lockfile was created by an old Bundler that left some things out.
Because of the missing DEPENDENCIES, we can only install gems one at a time,
instead of installing 16 at a time.
You can fix this by adding the missing gems to your Gemfile, running bundle
install, and then removing the gems from your Gemfile.
The missing gems are:
* minitest depended upon by activesupport
```

But then continued on and crashed while trying to report the unmet
dependency:

```
--- ERROR REPORT TEMPLATE -------------------------------------------------------

NoMethodError: undefined method `full_name' for nil:NilClass
lib/bundler/installer/parallel_installer.rb:127:in `block (2 levels) in check_for_unmet_dependencies'

...
```

Bundler 2.4.0 and up crash as above when jobs=1, but crash
even harder when run in parallel:

```
--- ERROR REPORT TEMPLATE -------------------------------------------------------

fatal: No live threads left. Deadlock?
3 threads, 3 sleeps current:0x00007fa6b6704660 main thread:0x00007fa6b6704660
* #<Thread:0x000000010833b130 sleep_forever>
   rb_thread_t:0x00007fa6b6704660 native:0x0000000108985600 int:0

* #<Thread:0x0000000108dea630@Parallel Installer Worker #0 tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:90 sleep_forever>
   rb_thread_t:0x00007fa6b67f67c0 native:0x0000700009a62000 int:0

* #<Thread:0x0000000108dea4a0@Parallel Installer Worker #1 tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:90 sleep_forever>
   rb_thread_t:0x00007fa6b67f63c0 native:0x0000700009c65000 int:0

<internal:thread_sync>:18:in `pop'
tmp/1/gems/system/gems/bundler-2.5.0.dev/lib/bundler/worker.rb:42:in `deq'

...
```

Changes
---

This commit fixes the confusing thread deadlock crash by detecting if
dependencies are missing such that we'll never be able to enqueue. When
that happens we treat it as a failure so the install can finish.

That gets us back to the `NoMethodError`, which this commit fixes by
using a different warning in the case where no spec is found.

d73001a21d
2023-02-09 10:29:50 +00:00
Hiroshi SHIBATA
bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
Bo Anderson
0df47fdaf9 [rubygems/rubygems] Add tests for universal Ruby with arch-specific prebuilt gems
11229b16c3
2022-11-08 17:05:19 +00:00
Hiroshi SHIBATA
3eca1e438d Merge 16c3535413 2022-09-05 14:37:12 +09:00
shields
8799c91205 [rubygems/rubygems] Add platform :windows as a shortcut for all Windows platforms
f3c49ad3f7
2022-08-29 00:33:15 +09:00
Hiroshi SHIBATA
bfd09b1116 Merge rubygems master from 446cc57a7c 2022-07-29 15:46:15 +09:00
David Rodríguez
7dd0a22588 [rubygems/rubygems] Fix simulate_windows helper
It should also set the proper class variable so that `Gem.win_platform?`
returns true.

0fbf6904d1
2022-07-08 02:22:35 +09:00
David Rodríguez
8f1a8e68ba [rubygems/rubygems] Fix error message on metadata mismatches
Previously we were removing not installable specs. However, if those are
the only ones, that would result in a bad error message. If we still
choose them as a last resort, Bundler will later check metadata right
before installing a give a proper error.

This is a regression of 565549260b and the
fix is to revert that commit.

bc18912257
2022-05-11 16:55:49 +09:00
David Rodríguez
54b1548760 [rubygems/rubygems] Extract a next_ruby_minor helper method for specs
66eae0ef1d
2022-05-11 16:55:47 +09:00
Hiroshi SHIBATA
ff3d7b720e Merge RubyGems and Bundler master 2022-02-28 11:39:20 +09:00
David Rodríguez
b7e5ce08ff [rubygems/rubygems] Don't add verbose flag so opaquely for realworld specs
fa8455ef7c
2021-12-27 10:45:36 +09:00
David Rodríguez
03903f23c2 [rubygems/rubygems] Remove the rest of the RUBY_VERSION monkeypatching
Since we're at it. This generates a bunch of warnings and seems like a
brittle way to test things, so let's get rid of it.

f5d45520e0
2021-12-27 10:45:36 +09:00
Hiroshi SHIBATA
fb1ab27f53 Merge RubyGems-3.3.1 and Bundler-2.3.1 2021-12-23 09:44:45 +09:00
Hiroshi SHIBATA
69dc2ea465 Merge RubyGems-3.3.0 and Bundler-2.3.0 2021-12-21 15:27:05 +09:00
David Rodríguez
d49ee9e2c3 [rubygems/rubygems] These method should be returning a string
dc391f4d87
2021-11-25 04:02:20 +09:00
Hiroshi SHIBATA
c082c6eb7c Sync RubyGems and Bundler with upstream 2021-07-07 15:31:52 +09:00
David Rodríguez
6e2240a2f9 Sync latest bundler & rubygems development version 2021-07-07 13:30:20 +09:00
David Rodríguez
5b0abba931 Sync bundler & rubygems 2021-05-11 11:29:41 +09:00
Hiroshi SHIBATA
ed149dbf46 Merge the master branch of Bundler 2021-04-15 15:36:15 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Hiroshi SHIBATA
d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
David Rodríguez
5783d0dbfc Import remaining changes
The "sync with commits" scripts failed to properly import these for some
reason.
2020-07-15 16:05:12 +09:00
David Rodríguez
414b1485d6 [rubygems/rubygems] More portable PATH edition
a6d50afad0
2020-06-18 19:14:15 +09:00
David Rodríguez
77df7ccc10 [rubygems/rubygems] Remove now unused "bang helpers"
84e4c58e83
2020-06-18 19:14:15 +09:00
David Rodríguez
a572e78201 [rubygems/rubygems] s/gem_command!/gem_command
f52733f6a4
2020-06-18 19:14:15 +09:00
David Rodríguez
61b6f53337 [rubygems/rubygems] Make helpers raise by default
ade0c441d5
2020-06-18 19:14:15 +09:00
David Rodríguez
117b504b98 Fix most exec specs
The `gem_command` helper was failing to require `support/hax.rb`, which
takes care of making sure rubygems actually picks up the right `ruby`
executable under ruby-core setup (`ENV["RUBY"]`). This caused binstubs
to be generated with a wrong shebang, and that caused `bundle exec` to
not work. The error message was pretty confusing though due to
https://bugs.ruby-lang.org/issues/16952.
2020-06-15 12:38:39 +09:00
David Rodríguez
e413e746af [rubygems/rubygems] Remove forgotten_command_line_usages from specs
Instead, use the non-deprecated option except when specifically testing
deprecated CLI flags. In that case, pass the flag directly and limit
the specs to `bundler < 3`.

3d5e186241
2020-06-05 07:32:42 +09:00
David Rodríguez
5c924f597f [rubygems/rubygems] Make forgotten_command_line_options always "forget" options
4d39338670
2020-06-05 07:32:42 +09:00
David Rodríguez
592762069d [rubygems/rubygems] Support running specs against a tarball
When bundler specs are run from a ruby tarball (ruby-core does this),
there's no git folder, so `git ls-files` fails.

Support this case by making specs rely on the list of files from the
bundler gemspec instead, and invert the spec that makes sure we ship the
right set of files.

As per the other quality specs, skip them in this case.

b28d5ec931
2020-06-05 07:32:42 +09:00
Hiroshi SHIBATA
1ab410caf8 Revert "Fix a failure in bundle version with version outputs the version with build metadata"
This reverts commit fcc8be0198.
2020-06-05 07:32:42 +09:00
Kazuhiro NISHIYAMA
fcc8be0198
Fix a failure in bundle version with version outputs the version with build metadata
```
  1) bundle version with version outputs the version with build metadata
     Failure/Error: expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/)

       expected "Bundler version 2.2.0.dev (2020-05-25 commit )" to match /\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
       Diff:
       @@ -1,2 +1,2 @@
       -/\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
       +"Bundler version 2.2.0.dev (2020-05-25 commit )"

       Commands:
       $ /home/user/snapshot-master/ruby -I/home/user/snapshot-master/spec/bundler -r/home/user/snapshot-master/spec/bundler/support/artifice/fail.rb -r/home/user/snapshot-master/spec/bundler/support/hax.rb /home/user/snapshot-master/tmp/1/gems/system/bin/bundle version
       Bundler version 2.2.0.dev (2020-05-25 commit )
       # $? => 0
```
2020-05-25 20:08:30 +09:00
Hiroshi SHIBATA
c7ebeb7eda Sync Bundler PR #3624 2020-05-22 20:32:30 +09:00
Kazuhiro NISHIYAMA
6c1a51dae8
Skip some tests if extracted from tarball (again)
Fix up previous commit

ref
9aa75795f9,
38002a8adb, and
0e60b59d58
2020-05-19 00:58:33 +09:00
Hiroshi SHIBATA
d4acf254e3 Use the gemspec in build_dir directly 2020-05-14 09:11:28 +09:00
Hiroshi SHIBATA
fcb5a9ee46 Resolved the file path of gemspec for ruby core repository 2020-05-13 07:54:37 +09:00
Hiroshi SHIBATA
0e60b59d58 Update the bundler version with master branch 2020-05-13 07:54:37 +09:00
Hiroshi SHIBATA
13f4f07f21 Merge bundler-2.1.4 2020-01-08 18:00:32 +09:00
Hiroshi SHIBATA
38002a8adb Prepare to release bundler-2.1.0 2019-12-15 16:41:10 +09:00
Hiroshi SHIBATA
bb9ecd026a Merge Bundler 2.1.0.pre3 released version 2019-11-13 10:19:51 +09:00
Hiroshi SHIBATA
7585bc3187 Merge Bundler 2.1.0.pre.3
Features:
    - Add caller information to some deprecation messages to make them easier to fix [#7361](https://github.com/bundler/bundler/pull/7361)
    - Reconcile `bundle cache` vs `bundle package` everywhere. Now in docs, CLI help and everywhere else `bundle cache` is the preferred version and `bundle package` remains as an alias [#7389](https://github.com/bundler/bundler/pull/7389)
    - Display some basic `bundler` documentation together with ruby's RDoc based documentation [#7394](https://github.com/bundler/bundler/pull/7394)

  Bugfixes:
    - Fix typos deprecation message and upgrading docs [#7374](https://github.com/bundler/bundler/pull/7374)
    - Deprecation warnings about `taint` usage on ruby 2.7 [#7385](https://github.com/bundler/bundler/pull/7385)
    - Fix `--help` flag not correctly delegating to `man` when used with command aliases [#7388](https://github.com/bundler/bundler/pull/7388)
    - `bundle add` should cache newly added gems if an application cache exists [#7393](https://github.com/bundler/bundler/pull/7393)
    - Stop using an insecure folder as a "fallback home" when user home is not defined [#7416](https://github.com/bundler/bundler/pull/7416)
    - Fix `bundler/inline` warning about `Bundler.root` redefinition [#7417](https://github.com/bundler/bundler/pull/7417)
2019-11-11 18:56:25 +09:00
David Rodríguez
683f9e1dbf [bundler/bundler] No need to activate the fileutils default gem
The version we're vendoring actually relaxed this restriction back to
2.3.0+, so we can always use the vendored version.

d366cbfe5d
2019-08-18 13:45:45 +09:00
David Rodríguez
4756c5f7e7 [bundler/bundler] Remove unnecessary rubygems monkeypatch
Instead, make sure we always load the local copy of bundler during
specs, and never end up using the default copy.

ac655ffeda
2019-08-18 13:45:35 +09:00
David Rodríguez
a2d7c97a91
[bundler/bundler] Extract yet another helper method
948a863bd8
2019-08-17 17:08:51 +09:00
David Rodríguez
09455301ef
[bundler/bundler] Extract a with_root_gemspec helper
f20c2bdf6a
2019-08-17 17:08:51 +09:00
David Rodríguez
9925e1a10f
[bundler/bundler] Remove unneeded to_s calls
They are implicit inside `gem_command!`.

6bdb13c899
2019-08-17 17:08:51 +09:00
David Rodríguez
aef5509139
[bundler/bundler] Extract single gem installation logic
7888d621c8
2019-08-17 17:08:51 +09:00