Commit graph

57 commits

Author SHA1 Message Date
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
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 Rodriguez
cbf2e133c1
Re-resolve when lockfile is invalid
Move the check for unmet dependencies in lockfile just in time to be
able to re-resolve if unmet dependencies are found.
2023-10-16 13:49:49 +09:00
David Rodríguez
5a43b0ddd5 [rubygems/rubygems] Remove unused module inclusion
0f58ef6a32
2023-07-24 14:59:34 +09:00
David Rodríguez
2e0159c5f2 [rubygems/rubygems] Fix resolver edge case
Let it deal with legacy gems with equivalent version and different
dependencies.

b430babe97
2023-01-10 12:58:28 +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
ef2d673052 [rubygems/rubygems] Show a proper error if extension dir is not writable
Instead of showing the bug report template.

0c8b6f7dd5
2022-07-17 17:47:23 +09:00
David Rodríguez
ea31c5bcd1 [rubygems/rubygems] Fix crash when installing gems with symlinks
If BUNDLE_PATH is configured to a symlinked path, installing gems with
symlinks would crash with an error like this:

```
Gem::Package::SymlinkError: installing symlink 'man/man0/README.markdown' pointing to parent path /usr/home/stevewi/srv/mail/lib/tools/.vendor/ruby/3.1.0/gems/binman-5.1.0/README.markdown of /srv/mail/lib/tools/.vendor/ruby/3.1.0/gems/binman-5.1.0 is not allowed
```

This commit fixes the problem by changing the bundle path to be the
realpath of the configured value, right after we're sure the path has
been created.

3cd3dd142a
2022-05-30 17:42:39 +09:00
David Rodríguez
6778d321a7 [rubygems/rubygems] Show better error when previous installation fails to be removed
Instead of guessing on the culprit.

We actually have a helper, `Bundler.rm_rf`, with exactly the behavior
that we want:

* Allow the passed folder to not exist.
* No exception swallowing other than that.

5fa3e6f04a
2022-05-27 17:26:22 +09:00
Hiroshi SHIBATA
678d58c850 Merge rubygems master 1e4eda741d732ca1bd7031aef0a16c7348adf7a5 2022-04-28 19:08:49 +09:00
Alex Gittemeier
943efa8ca6 [rubygems/rubygems] Add newline to validate_platforms! message when platform is missing
When I run bundle install with BUNDLE_DEPLOYMENT=true in the environment
on a different platform than I usually do development, I get the
following output to the console (wrapped exactly as shown):

Your bundle only supports platforms ["x86_64-darwin-19"] but your local platform
is x86_64-linux. Add the current platform to the lockfile with `bundle lock
--add-platform x86_64-linux` and try again.

Because the way the message wraps, its not as simple as copying the
suggested command to the clipboard because it contains a newline:

    $ bundle lock
    Writing lockfile to [...]/Gemfile.lock
    $ --add-platform x86_64-linux

Adding a newline right before the command forces the command in the
error message to be on the same line, which facilitates copy-pasting the
command in the message.

4cf6989b11
2022-03-08 03:40:30 +09:00
Hiroshi SHIBATA
d6311cb1ca Track RubyGems 3.4.0dev and Bundler 2.4.0dev 2021-12-27 10:45:36 +09:00
David Rodríguez
ca3a2e46e8 [rubygems/rubygems] Update some specs to pass ruby-head CI
These specs were monkeypatching `RUBY_VERSION`, but that obviously
doesn't change the running ruby to behave any different.

The removal of some features, in particular, `String#untaint`, made
these specs fail, because untaint is no longer available under ruby-core
and bundler calls `untaint` when `RUBY_VERSION` is less than "2.7",
which these specs were overwriting it to be.

Rewrite these specs to not overwrite `RUBY_VERSION`, but still test the
same things.

e8c7b92901
2021-12-27 10:45:36 +09:00
Hiroshi SHIBATA
fff9b45fa9
Reverts the accidental commits for rubygems/bundler.
We stay to the stable version for releasing Ruby 3.1.0.

  Revert commits:
    b86a7ba492
    ef973aa7aa
2021-12-22 07:52:59 +09:00
David Rodríguez
b86a7ba492 [rubygems/rubygems] Fix error when gem specified twice in gemfile under different platforms
83bc87ca98
2021-12-22 03:12:57 +09:00
David Rodríguez
ef973aa7aa [rubygems/rubygems] These commands shouldn't be failing, just warning
04b1ac72b9
2021-12-22 03:12:56 +09:00
David Rodríguez
d0f266460f [rubygems/rubygems] Remove lockfile_should_be helper
It doesn't add anything.

ece3c864df
2021-11-12 06:05:07 +09:00
David Rodriguez
b4a43e4f57
[rubygems/rubygems] Show proper error when previous installation of gem can't be deleted
Instead of showing the bug report template with an error at a random
place.

882ad3ab57
2021-10-25 20:48:51 +09:00
David Rodriguez
00412be204
[rubygems/rubygems] Show a proper error if gem path is not writable
Instead of showing the bug report place with an error at a randome
place.

241854ce73
2021-10-25 20:48:51 +09:00
David Rodríguez
853004e04d [rubygems/rubygems] Fix bundle install crash due to an incorrectly incomplete resolve
In case we have a corrupted lockfile that claims to support a platform, but
it's missing platform specific gems for it, bundler has a check that
detects the situation and forces a re-resolve. The result of this check
is kept under the `@locked_specs_incomplete_for_platformn` instance
variable in `Definition`.

The installer, however, calls `Definition#nothing_changed?` before this
instance variable has been filled, so the result of it is actually
incorrect here since it will claim that nothing has changed, but
something has changed (locked specs are incomplete for the current
platform).

The consequence of this incorrect result is that the installer thinks it
can go on without re-resolving, resulting in the incomplete resolution
from the lockfile being used, and in a crash being triggered due to
that.

The solution is to make sure the `@locked_specs_incomplete_for_platform`
instance variable is filled before `nothing_changed?` gets called.
Moving it to `initialize` makes the most sense, not because it's the
best place for it (we can refactor this later), but because all of the
other "outdated definition" checks are already set there.

708afdd789
2021-10-13 21:16:40 +09:00
David Rodriguez
0f1f95a3e3 [rubygems/rubygems] Fix bundle install to force reinstallation of deleted gems
8950631f02
2021-10-13 16:21:42 +09:00
Tim Sutton
d7c734a27e [rubygems/rubygems] typos in UI messages: fix a couple missing spaces between sentence breaks
5cdda53382
2021-08-31 19:06:14 +09:00
David Rodríguez
0e01ad881a [rubygems/rubygems] The --local flag to bundle install shouldn't hit the network
If the cache was missing, `bundler` would try to re-fetch it. With the
`--local` flag, it should just look at installed gems.

630d29c69e
2021-08-31 19:06:14 +09:00
Daniel Niknam
bd8daa8523
[rubygems/rubygems] Remove the warning for not defining a gem server source
Bundler has deprecated gemfiles without a global source and this feature
is now obsolete. `Bundler::Definition#has_rubygems_remotes?` is removed
because it's not used anymore.

d29dd2cb7b
2021-07-27 09:25:57 +09:00
Daniel Niknam
2f9e0cf181
[rubygems/rubygems] Explicitly define a global source for tests
This is in preparation for deprecating source-less gemfiles.

d6493fa3e2
2021-07-27 09:25:57 +09:00
David Rodríguez
9ac89fe35e
[rubygems/rubygems] The --quiet should still display warnings
The is the previous intentional behaviour until
ca0676cb1c.

In my opinion, that previous behaviour was better and should be
restored, because we want our users to always see warnings and fix them.
And the original issue that motivated the change is fixable by other
means, namely through `BUNDLE_SILENCE_ROOT_WARNING`, or through
`BUNDLE_SILENCE_DEPRECATIONS` in general. Finally, the --quiet option is
still documented as "only print errors and warnings".

So this PR essentially reverts
ca0676cb1c
for the above reasons.

35f2254dfc
2021-07-27 09:25:56 +09:00
David Rodríguez
24aca87def
[rubygems/rubygems] Make --quiet spec independent on the specific warning
We'll be removing the warning about no gem sources, so this spec will no
longer test that warnings are hidden by `--quiet`.

Test that in another way so that we don't lose the coverage when we
drop the specific warning about no gem server sources.

cce4f86d28
2021-07-27 09:25:56 +09:00
David Rodríguez
6bcedabfdd
[rubygems/rubygems] Remove gem install hint when installing a gem fails
A fresh `gem install` might not reproduce the exact `bundle install`
environment that originally caused the error. It also makes it harder
for the user to troubleshoot the error since she needs to run a separate
command.

Instead, show the original error and backtrace directly.

49c2abfec6
2021-07-27 09:25:55 +09:00
David Rodríguez
227c2deff4
[rubygems/rubygems] Fix development gem unintentionally removed on an edge case
When a development dependency was duplicated inside the gemspec and
Gemfile with the same requirements, we went from printing a warning to
removing the gem altogether.

This change makes it not print a warning, but don't remove the gem
either.

8bb2488131
2021-07-16 15:40:07 +09:00
Hiroshi SHIBATA
896bbb9fad Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 2021-07-14 10:48:07 +09:00
Hiroshi SHIBATA
69ed64949b Track Bundler master(2.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
473f9d2df0 Merge prepare version of Bundler 2.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
David Rodríguez
2fafc08aa3 [rubygems/rubygems] Remove unneeded trailing conditions on exitstatus
27e0e4ecb6
2020-07-15 16:05:12 +09:00
David Rodríguez
16823d4a05 [rubygems/rubygems] Remove unnecessary assertions on exitstatus
Since our helpers now raise by default if the subcommand fails, these
will never actually fail and are not necessary.

6153b9321e
2020-07-15 16:05:12 +09:00
David Rodríguez
696a50751b [rubygems/rubygems] s/install_gemfile!/install_gemfile
4d1a0c465a
2020-06-18 19:14:15 +09:00
David Rodríguez
1436b5026c [rubygems/rubygems] s/bundle!/bundle
746a4b3d74
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
66b327af56 [rubygems/rubygems] Fix redundant commands
They are preceded by `install_gemfile` calls, which mean `bundle
install` is being run twice for no reason.

d2b2d10862
2020-06-18 19:14:15 +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
99dc55987d [rubygems/rubygems] Improve specs testing option remembering behavior
By making them more explicit.

9979c5a811
2020-06-05 07:32:42 +09:00
Hiroshi SHIBATA
0e60b59d58 Update the bundler version with master branch 2020-05-13 07:54:37 +09:00
Hiroshi SHIBATA
38002a8adb Prepare to release bundler-2.1.0 2019-12-15 16:41:10 +09:00
David Stosik
a02dbcecb1 [bundler/bundler] Bundler displays a duplicate gem entries warning even if gems only appear once per group
d18a83109e
2019-08-18 13:43:59 +09:00
David Rodríguez
d7487d6c08
[bundler/bundler] Try make some specs platform independent
b5900e57a4
2019-08-03 09:29:59 +09:00
David Rodríguez
c3ddd47ce7
[bundler/bundler] Normalize file:// handling in specs
5946d62ad0
2019-08-03 09:29:55 +09:00
Hiroshi SHIBATA
8f37629519 Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
2019-06-09 12:44:10 +09:00
hsbt
68ddd4d300 Merge Bundler 2.1.0.pre.1 as developed version from upstream.
a53709556b

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14 06:01:35 +00:00