Граф коммитов

2244 Коммитов

Автор SHA1 Сообщение Дата
Eric Mueller c424d15cb9 [rubygems/rubygems] Add --json bundle-outdated flag to produce json-parseable output
https://github.com/rubygems/rubygems/commit/65efa44bc0
2023-11-23 18:03:17 +00:00
David Rodriguez c05495530e [rubygems/rubygems] Fix universal lockfiles regression
If a platform specific variant would not match the current Ruby, we would still be
considering it compatible with the initial resolution and adding its
platform to the lockfile, but we would later fail to materialize it for
installation due to not really being compatible.

Fix is to only add platforms for variants that are also compatible with
current Ruby and RubyGems versions.

https://github.com/rubygems/rubygems/commit/75d1290843
2023-11-22 13:17:12 +00:00
Bo Anderson 57fa69f26f [rubygems/rubygems] Fix invalid platform removal missing adjacent platforms
https://github.com/rubygems/rubygems/commit/4ce66c41a2
2023-11-21 19:11:15 +00:00
Samuel Giddins b69bbf588a [rubygems/rubygems] User bundler UA when downloading gems
Gem::RemoteFetcher uses Gem::Request, which adds the RubyGems UA.
Gem::RemoteFetcher is used to download gems, as well as the full index.
We would like the bundler UA to be used whenever bundler is making
requests.

This PR also avoids unsafely mutating the headers hash on the shared
`Gem::RemoteFetcher.fetcher` instance, which could cause corruption or
incorrect headers when making parallel requests. Instead, we create one
remote fetcher per rubygems remote, which is similar to the connection
segregation bundler is already doing

https://github.com/rubygems/rubygems/commit/f0e8dacdec
2023-11-15 08:33:14 +00:00
Nobuyoshi Nakada 8e64c87f64 [rubygems/rubygems] Make sure to `require "rubygems"` explicitly
This is also done in bundler/lib/bundler/rubygems_integration.rb, but
bundler/lib/bundler.rb loads this file before it.

https://github.com/rubygems/rubygems/commit/8840d8507b
2023-11-13 11:33:00 +00:00
David Rodríguez 5bdbe242b3 [rubygems/rubygems] Add a warning in an edge case of using `gemspec` DSL
If a Gemfile duplicates a development dependency also defined in a local
gemspec with a different requirement, the requirement in the local
gemspec will be silently ignored.

This surprised me.

I think we should either:

* Make sure both requirements are considered, like it happens for
  runtime dependencies (I added a spec to illustrate the current behavior
  here).

* Add a warning that the requirement in the gemspec will be ignored.

I think the former is slightly preferable, but it may cause some
bundle's that previously resolve to no longer resolver.

I went with the latter but the more I think about it, the more this
seems like it should behave like the former.

https://github.com/rubygems/rubygems/commit/ad6843972f
2023-11-13 11:06:10 +09:00
David Rodríguez a4d80eee17 [rubygems/rubygems] Let RuboCop target Ruby 3.0
https://github.com/rubygems/rubygems/commit/70243b1d72
2023-11-13 11:06:10 +09:00
David Rodríguez 50482cd1e5 [rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in Bundler
https://github.com/rubygems/rubygems/commit/93619c97ff
2023-11-13 11:06:10 +09: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.

https://github.com/rubygems/rubygems/commit/5f24f06bc5
2023-11-13 11:06:10 +09:00
David Rodriguez 59b361aaca [rubygems/rubygems] Refactor platform test helpers
https://github.com/rubygems/rubygems/commit/7ab4c203f9
2023-11-13 11:06:10 +09:00
David Rodríguez bd6aaa78c3 [rubygems/rubygems] Remove unused `SpecSet#merge`
https://github.com/rubygems/rubygems/commit/53e0490b55
2023-11-13 11:06:10 +09:00
Jean Boussier b013aae0c6 IO#read always check the provided buffer is mutable
Otherwise you can have work in some circumstance but not in others.
2023-11-09 11:45:02 +01:00
David Rodríguez a1d0c048df
[rubygems/rubygems] Fix daily Bundler CI
Daily Bundler CI against ruby-head is failing because ruby-head now
uses bigdecimal 3.1.5, so that gets locked by this spec.

This change should make the test stable until bigdecimal 99.1.5 is
bundled with Ruby :)

https://github.com/rubygems/rubygems/commit/830326041f
2023-11-09 10:34:48 +09:00
David Rodríguez 28356c2870
[rubygems/rubygems] Explicitly pass install-dir when installing system gems in Bundler specs
We want to avoid any "user home" fallbacks, since that won't work with
Bundler.

So if there's a permissions issue during specs, it's best to raise
immediately.

https://github.com/rubygems/rubygems/commit/767a3e7533
2023-11-09 10:34:48 +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.

https://github.com/rubygems/rubygems/commit/2511a5b093
2023-11-09 10:34:48 +09:00
David Rodríguez d9ac2d91e0
[rubygems/rubygems] Remove unused logic
https://github.com/rubygems/rubygems/commit/2eb2860e9e
2023-11-09 10:34:48 +09:00
Peter Zhu 8d0eb872e8 Add foo.gemspec for failing test
foo.gemspec was added in
rubygems/rubygems@8d699ed096 but was not
sync'd in commit b4bf8c9ee2. This causes
the spec to fail.
2023-11-08 13:29:10 -05:00
Han Young b4bf8c9ee2 [rubygems/rubygems] Ensure we are using the same extension dir
Since #6945 the extension dir changed to Gem::BasicSpecification's implementation, we didn't hook that in rubygems_ext.rb. So for universal rubies, we ended up using the universal platform name when installing, but arch replaced platform name when checking. This lead to native extensions can never be correctly installed on universal rubies.

Hook Gem::BasicSpecifications so the behavior is consistent on installing and checking.

https://github.com/rubygems/rubygems/commit/8d699ed096
2023-11-08 12:40:22 +00:00
Nobuyoshi Nakada d8e0337d02
Escape the target string to be checked
Comparing file paths as strings may not work well for some reasons,
symlink, relative `__FILE__`, etc.

Some alternatives are possible: comparing with `File.realpath`, or
with `File.identical?`, it should be most robust to escape the target
string contained within this file itself.
2023-11-08 09:04:28 +09:00
David Rodríguez 9afd2957ed
[rubygems/rubygems] Simplify spec wording and implementation
https://github.com/rubygems/rubygems/commit/3e7f1379fb
2023-11-08 09:04:28 +09:00
David Rodríguez a131ea39b7
[rubygems/rubygems] Better error when having an insecure install folder
https://github.com/rubygems/rubygems/commit/e41156e272
2023-11-08 09:04:28 +09:00
David Rodríguez 7f7a7f13ed
[rubygems/rubygems] Don't show bug report template when GEM_HOME has no writable bit
Instead, don't check that at all and proceed. If something fails to be
written inside GEM_HOME, we'll eventually fail with a proper permissions
error.

In addition to that, the writable bit in GEM_HOME is not even reliable,
because only the immediate parent is actually checked when writing. For
example,

```
$ mkdir -p foo/bar
$ chmod -w foo
$ touch foo/bar/baz # writes without issue
```

https://github.com/rubygems/rubygems/commit/4bced7ac73
2023-11-08 09:04:28 +09:00
Hiroshi SHIBATA 31c36a444a
Skip example for 07df8a5d5e 2023-11-07 09:56:54 +09:00
Yusuke Endoh 0cd6eb607a Fix the CI failure in OpenBSD
LibreSSL seems not to support `scrypt`.

https://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20231105T233005Z.fail.html.gz
```
1)
OpenSSL::KDF.scrypt creates the same value with the same input ERROR
NoMethodError: undefined method `scrypt' for module OpenSSL::KDF
```
2023-11-06 17:12:14 +09:00
Cody Cutrer b5d54fc159 [rubygems/rubygems] Only remove bundler plugin gem when it's inside the cache
https://github.com/rubygems/rubygems/commit/8d51390ca4
2023-10-31 13:53:05 +00:00
Nobuyoshi Nakada 02ecc3c855
Disable wrong test 2023-10-31 10:44:53 +09:00
Nobuyoshi Nakada 2ab247d217
Missing format string
Do not use a variable as a format string.  Also we usually don't
expect non-ascii data in C string literals.
2023-10-31 00:56:42 +09:00
Benoit Daloze 7d8cfa0a40 Update to ruby/spec@d56bd0f 2023-10-30 16:44:54 +01:00
Benoit Daloze b09618e566 Update to ruby/mspec@d03ad9c 2023-10-30 16:44:52 +01:00
Benoit Daloze 58d1fbcf3f Revert "OpenSSL::KDF.scrypt needs EVP_PBE_scrypt()"
This reverts commit d434765fae.
2023-10-30 16:44:47 +01:00
Nobuyoshi Nakada d434765fae
OpenSSL::KDF.scrypt needs EVP_PBE_scrypt() 2023-10-31 00:31:51 +09:00
Benoit Daloze ab4781b64d Update to ruby/spec@bd7017f 2023-10-30 13:49:46 +01:00
Hiroshi SHIBATA 5c1b7633fc [rubygems/rubygems] Relax matching pattern for rake version
https://github.com/rubygems/rubygems/commit/a89f74c27e
2023-10-30 04:46:09 +00:00
Lars Kanis 73d7fd8614
Windows: Prefer USERPROFILE over HOMEPATH
Enable the test commented out in ruby/ruby@d0f5dc9eac.
Extracted from GH-7033, that is for initialization at start up time
and this test is unrelated to it.
2023-10-26 19:00:54 +09:00
Hiroshi SHIBATA c5861903ac [rubygems/rubygems] Handle CI configuration on ignore list for Gem::Specification#files
https://github.com/rubygems/rubygems/commit/4bb0ef3e55
2023-10-25 00:46:09 +00:00
Hiroshi SHIBATA 5c4978c11c [rubygems/rubygems] Handle empty array
https://github.com/rubygems/rubygems/commit/7c0afdd9af
2023-10-24 16:31:43 +00:00
Martin Emde 6dcd4e90d8
[rubygems/rubygems] Handle base64 encoded checksums in lockfile for future compatibility.
Save checksums using = as separator.

https://github.com/rubygems/rubygems/commit/a36ad7d160
2023-10-23 13:59:01 +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

https://github.com/rubygems/rubygems/commit/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)

https://github.com/rubygems/rubygems/commit/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

https://github.com/rubygems/rubygems/commit/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.

https://github.com/rubygems/rubygems/commit/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.

https://github.com/rubygems/rubygems/commit/bde37ca6bf
2023-10-23 13:59:01 +09:00
Martin Emde 1146826948 [rubygems/rubygems] Fix spelling of extraneous
https://github.com/rubygems/rubygems/commit/af61829432
2023-10-22 20:17:44 +00:00
David Rodríguez 908f8fffa2
[rubygems/rubygems] Don't hide original error in `after(:suite)` hook
For some reason, Windows builds are failing quite consistently now.
However, it seems that errors are happening before this directory is
even created, so removal fails, hiding the original error.

Instead, don't let this removal fail due to files not existing.

https://github.com/rubygems/rubygems/commit/7669d6c96e
2023-10-17 13:10:14 +09:00
David Rodríguez 77ffa1a7c3 [rubygems/rubygems] Raise an error when top level dependency does not resolve under all locked platforms
https://github.com/rubygems/rubygems/commit/25304f3e8d
2023-10-16 13:52:57 +09:00
David Rodríguez 73ba4b76c2 [rubygems/rubygems] Automatically remove invalid platforms before re-resolving
https://github.com/rubygems/rubygems/commit/40989271dd
2023-10-16 13:52:56 +09:00
David Rodríguez b7ad9eda3c [rubygems/rubygems] Tweak platform mismatch resolution errors
https://github.com/rubygems/rubygems/commit/20460bc1ee
2023-10-16 13:52:56 +09:00
David Rodríguez a05904c8ce [rubygems/rubygems] The `lock` command should not be affected by frozen setting
The `lock` command is specifically designed to manage the lockfile, so
running it should take precedence over any "frozen" setting.

Besides that, "frozen" is not specifically designed as "lockfile cannot
be updated" but as "installation of gems should be prevented if gemfile
is not in sync with the lockfile".

The lock command does not install any gems and preserves the property of
the lockfile being in sycn with its gemfile, so I think frozen should
not influence it.

The current behavior is quite confusing when frozen is set. On an app
where rubocop can get lockfile updates

```
$ bundle lock --update rubocop
Writing lockfile to /path/to/Gemfile.lock
```

Completely silent, it makes you think that it has written the lockfile,
but still no updates.

In verbose mode, it gives a bit more information, but still confusing
and unexpected, and does not change the lockfile:

```
$ bundle lock --update rubocop --verbose
Running `bundle lock --update "rubocop" --verbose` with bundler 2.4.20
Frozen, using resolution from the lockfile
Writing lockfile to /path/to/Gemfile.lock
```

With this commit, it updates the lockfile as expected.

https://github.com/rubygems/rubygems/commit/1d501ae8ea
2023-10-16 13:52:12 +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
Samuel Giddins 83f929316e [rubygems/rubygems] Fix force_ruby_platform: when the lockfile only locks the ruby platform
https://github.com/rubygems/rubygems/commit/7c50064c3c
2023-10-15 04:46:32 +00:00