summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-01-19 13:28:23 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-01-19 15:01:44 +0900
commitd22511fd7595ef1819baa42851d598d95b8f4d00 (patch)
tree83e823c033f5c39c314cf4379f0bac5c43adf3d4 /lib/rubygems
parent5646f4b67b75e7e558c994ff8cbd374e4b4bd3b5 (diff)
Merge rubygems/rubygems HEAD.
Picked at 12aeef6ba9a3be0022be9934c1a3e4c46a03ed3a
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5462
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/package.rb2
-rw-r--r--lib/rubygems/package/old.rb2
-rw-r--r--lib/rubygems/psych_additions.rb2
-rw-r--r--lib/rubygems/safe_yaml.rb16
-rw-r--r--lib/rubygems/security.rb2
-rw-r--r--lib/rubygems/specification.rb4
6 files changed, 14 insertions, 14 deletions
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 58d021d99a..a81c5f307c 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -230,7 +230,7 @@ class Gem::Package
tar.add_file_signed 'checksums.yaml.gz', 0444, @signer do |io|
gzip_to io do |gz_io|
- YAML.dump checksums_by_algorithm, gz_io
+ Psych.dump checksums_by_algorithm, gz_io
end
end
end
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
index 25317ef23f..301d403411 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -145,7 +145,7 @@ class Gem::Package::Old < Gem::Package
begin
@spec = Gem::Specification.from_yaml yaml
- rescue YAML::SyntaxError
+ rescue Psych::SyntaxError
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end
rescue ArgumentError
diff --git a/lib/rubygems/psych_additions.rb b/lib/rubygems/psych_additions.rb
index 1ddd74421c..a13c1ec676 100644
--- a/lib/rubygems/psych_additions.rb
+++ b/lib/rubygems/psych_additions.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
# This exists just to satisfy bugs in marshal'd gemspecs that
-# contain a reference to YAML::PrivateType. We prune these out
+# contain a reference to Psych::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
index e905052e1c..81f99ee26e 100644
--- a/lib/rubygems/safe_yaml.rb
+++ b/lib/rubygems/safe_yaml.rb
@@ -24,33 +24,33 @@ module Gem
runtime
].freeze
- if ::YAML.respond_to? :safe_load
+ if ::Psych.respond_to? :safe_load
def self.safe_load(input)
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
- ::YAML.safe_load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, aliases: true)
+ ::Psych.safe_load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, aliases: true)
else
- ::YAML.safe_load(input, PERMITTED_CLASSES, PERMITTED_SYMBOLS, true)
+ ::Psych.safe_load(input, PERMITTED_CLASSES, PERMITTED_SYMBOLS, true)
end
end
def self.load(input)
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
- ::YAML.safe_load(input, permitted_classes: [::Symbol])
+ ::Psych.safe_load(input, permitted_classes: [::Symbol])
else
- ::YAML.safe_load(input, [::Symbol])
+ ::Psych.safe_load(input, [::Symbol])
end
end
else
unless Gem::Deprecate.skip
- warn "YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)."
+ warn "Psych safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)."
end
def self.safe_load(input, *args)
- ::YAML.load input
+ ::Psych.load input
end
def self.load(input)
- ::YAML.load input
+ ::Psych.load input
end
end
end
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
index f21c175642..fc23c1c481 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -261,7 +261,7 @@ require_relative 'openssl'
# 2. Grab the public key from the gemspec
#
# gem spec some_signed_gem-1.0.gem cert_chain | \
-# ruby -ryaml -e 'puts YAML.load($stdin)' > public_key.crt
+# ruby -rpsych -e 'puts Psych.load($stdin)' > public_key.crt
#
# 3. Generate a SHA1 hash of the data.tar.gz
#
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index f572257525..06e50244a7 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1279,10 +1279,10 @@ class Gem::Specification < Gem::BasicSpecification
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
end
- # Cleanup any YAML::PrivateType. They only show up for an old bug
+ # Cleanup any Psych::PrivateType. They only show up for an old bug
# where nil => null, so just convert them to nil based on the type.
- array.map! {|e| e.kind_of?(YAML::PrivateType) ? nil : e }
+ array.map! {|e| e.kind_of?(Psych::PrivateType) ? nil : e }
spec.instance_variable_set :@rubygems_version, array[0]
# spec version