Commit graph

260 commits

Author SHA1 Message Date
Nobuyoshi Nakada
c8fb4f308b [rubygems/rubygems] Skip nil-value keys to make metadata reproducible
Nil-value keys in a mapping end with a space or not depending on
libyaml versions, and result metadata are different per platforms.
This commit makes to skip such keys to make metadata reproducible
accross platforms.

74b4db8d30
2024-02-21 06:39:36 +00:00
Hiroshi SHIBATA
08753f2037 [rubygems/rubygems] Use https instead of http
bcbe6f7b7a
2024-02-21 03:30:22 +00:00
Mike Dalessio
31e4300ea7 [rubygems/rubygems] feat: Gem::Specification#initialize_copy deep-copies requirements
to avoid accidentally mutating the original's state when doing:

```ruby
spec2 = spec.dup
spec2.required_rubygems_version.concat([">= 3.3.22"])
```

see https://github.com/rake-compiler/rake-compiler/pull/236 for a
real-world use case that would be made simpler with this behavior.

c1d52389f0
2024-02-02 21:38:04 +00:00
Olle Jonsson
08edad31a6 [rubygems/rubygems] Drop two TODOs from specification.rb
These were introduced 13 years ago, in a documentation update. Perhaps we can let the TODOs go, without taking any action?

fb23fa84f9
2024-01-18 22:49:32 +00:00
Brave Hager
d5e83a0601 [rubygems/rubygems] Update documentation to use squiggly heredoc
4691b959ad
2024-01-11 00:51:48 +00:00
David Rodríguez
a06bf001b2
[rubygems/rubygems] Remove non-transparent requirement added to prerelease gems
I think we can safely assume these days that all RubyGems and Bundler
versions that will ever bundle a new gem created in 2023 support
prereleases.

So this non transparent requirement is not necessary.

In my opinion, it should be the gem author to explicitly add this
constraint, not RubyGems.

b165e6d725
2023-12-12 10:04:57 +09:00
David Rodríguez
2755cb1b2f [rubygems/rubygems] Use modern hashes consistently
bb66253f2c
2023-12-07 22:29:33 +00:00
David Rodríguez
3757d9027c [rubygems/rubygems] Remove now unnecessary dups
56ce2a6445
2023-11-13 11:06:10 +09:00
David Rodríguez
a4d80eee17 [rubygems/rubygems] Let RuboCop target Ruby 3.0
70243b1d72
2023-11-13 11:06:10 +09:00
David Rodríguez
54511303a4 [rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in RubyGems
10c26a483d
2023-11-13 11:06:10 +09:00
David Rodríguez
e6e4b4884d
[rubygems/rubygems] Hack to get Gem::Specification#extensions_dir documented
625b8293f7
2023-11-08 09:04:28 +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
Hiroshi SHIBATA
3b47fb2cb6 [rubygems/rubygems] Update suggested variable for bindir
f9cc6fed25
2023-10-03 00:08:34 +00:00
Samuel Giddins
02fa2acbde [rubygems/rubygems] Freeze more strings in generated gemspecs
Specifically, this will have frozen string literals for:
- Gem platform tuple entries
- Gem::Version strings
- Gem::Specification#installed_by_version
- Dependency requirement strings

6195da5bdb
2023-09-21 18:25:04 +00:00
Samuel Giddins
d182d83ce9 [rubygems/rubygems] Add a Marshal.load replacement that walks an AST to safely load permitted classes/symbols
7e4478fe73
2023-09-20 02:02:58 +00:00
Samuel Giddins
7e5c3ec5b1 Update specification.rb
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2023-08-20 09:05:29 +00:00
Samuel Giddins
1935433f5f [rubygems/rubygems] Ensure that loading multiple gemspecs with legacy YAML class references does not warn
Before this, you would get constant redefinition warnings on Psych::DefaultKey

Additionally, ensure the retries wont continue infinitely in the case of the ArgumentError not being caused by Marshal trying to load the undefined classes

919e8c2de4
2023-08-20 09:05:17 +00:00
Nobuyoshi Nakada
419fbc77e0 [rubygems/rubygems] Clear YAML constant if it was undefined previously
31d0311258
2023-07-19 23:20:54 +00:00
Takumasa Ochi
5831f7c831 [rubygems/rubygems] Simplify code by Gem::Specification#runtime_dependencies
324139af8f
2023-05-08 08:56:22 +00:00
Josef Šimánek
1cbb501127
Onboard Rubocop Naming/MemoizedInstanceVariableName rule to RubyGems. 2023-03-28 15:27:35 +09:00
Hiroshi SHIBATA
acf12b6dfd util/rubocop -A --only Style/AsciiComments 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
2e3cd1dc3e [rubygems/rubygems] Enabled Style/RedundantReturn cop
05cc97bdf8
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
a3670249fa [rubygems/rubygems] util/rubocop -A --only Lint/Void
9d25906e44
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
0eef33e113 [rubygems/rubygems] util/rubocop -A --only Style/Next
e5868e92f7
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
bec069b0ca [rubygems/rubygems] util/rubocop -A --only Style/MultilineMemoization
c1f6e4a97b
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
01be518eba [rubygems/rubygems] util/rubocop -A --only Lint/UnderscorePrefixedVariableName
6dc4bc3a5b
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
ec131071b9 [rubygems/rubygems] util/rubocop -A --only Lint/ReturnInVoidContext
021823a331
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
1a60012612 [rubygems/rubygems] util/rubocop -A --only Lint/RescueException
e8a5db50af
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
7e3612585d [rubygems/rubygems] util/rubocop -A --only Lint/DuplicateCaseCondition
df2b192e47
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
31c572f4fa util/rubocop -A --only Style/SymbolArray 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
1ca67f13cd util/rubocop -A --only Style/RedundantSelf 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
5211900d37 util/rubocop -A --only Style/SymbolProc 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
be4cc74e26 [rubygems/rubygems] util/rubocop -A --only Style/IfUnlessModifierOfIfUnless
97e0af2518
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
6ad269dc39 [rubygems/rubygems] util/rubocop -A --only Style/RescueStandardError
80b57da926
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
fef0313ec7 [rubygems/rubygems] util/rubocop -A --only Style/PreferredHashMethods
ae3bdc0e85
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
66bd2c1a1c [rubygems/rubygems] util/rubocop -A --only Style/CommentAnnotation
4e77a1d1d5
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
52ea7afa5f [rubygems/rubygems] util/rubocop -A --only Style/NegatedIf
aa95ee27a2
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
4bb5ce8188 [rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation
cb554f6eb7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
9a1269eaaa [rubygems/rubygems] util/rubocop -A --only Layout/MultilineArrayBraceLayout
f4f45ab27e
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
05208c3875 [rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument
d8efd919db
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
760b8b7d24 [rubygems/rubygems] Change enforce style with Layout/CaseIndentation on rubygems
d4938259c4
2023-03-16 01:59:11 +00:00
Hiroshi SHIBATA
55a0fbfaf8 [rubygems/rubygems] Move build artifact detection logic for root gemspec to bundler from Gem::Specification.
Gem::Specification#missing_extension? is heavily called from RubyGems.
  We should reduce extra method call from this place.

e24e59d44d
2023-03-15 03:35:54 +00:00
Hiroshi SHIBATA
ea8b5e7359 [rubygems/rubygems] rubocop -a lib/rubygems/specification.rb
85d60e9886
2023-03-08 23:23:45 +00:00
Hiroshi SHIBATA
cb3f1f6de8 [rubygems/rubygems] Detect extension files under full_required_paths
When we use this methods with local gemspec, we don't handle
  build status of extension correctly. So We need to find extension
  files in require_paths.

  Example with ruby/erb repository:

  ```
  $ bundle exec irb
  Ignoring erb-4.0.2 because its extensions are not built. Try: gem pristine erb --version 4.0.2
  >>
  ```

f90e43cf3f
2023-03-08 23:23:45 +00:00
Hiroshi SHIBATA
75829f4d37
Added debug message for 20230306T023004Z.fail.html.gz#dist 2023-03-06 12:45:05 +09:00
Hiroshi SHIBATA
0c9a2ce6e0 [rubygems/rubygems] Build default gems same as fresh installtion.
Current implementation tried to build installation artifact. But default gems
  didn't provide normal gem files. So, It's always build failure.

  7432842788

    ERROR:  Error installing pkg/bigdecimal-3.1.4.gem:
    ERROR: Failed to build gem native extension.

    No such file or directory @ dir_s_mkdir - /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/gems/bigdecimal-3.1.4/ext/bigdecimal/.gem.20230225-2301-2mul99

    Gem files will remain installed in /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/gems/bigdecimal-3.1.4 for inspection.
    Results logged to /Users/runner/.rubies/ruby-head/lib/ruby/gems/3.3.0+0/extensions/x86_64-darwin-19/3.3.0+0/bigdecimal-3.1.4/gem_make.out

2157aa8ec8
2023-03-05 23:52:28 +00:00
Hiroshi SHIBATA
bab809d98f [rubygems/rubygems] Introduce Gem::Specification.find_by_full_name for finding conbination of name and version for gemspec
0430551215
2023-03-05 23:52:28 +00:00