Bug #4163

RubyGems uses deprecated API: YAML.quick_emit.

Added by Yui NARUSE over 4 years ago. Updated over 2 years ago.

[ruby-core:33735]
Status:Closed
Priority:Normal
Assignee:Eric Hodel
ruby -v:ruby 1.9.3dev (2010-12-15 trunk 30218) [x86_64-freebsd8.1] Backport:

Description

=begin
RubyGems::Specification#to_yaml uses depcrecated API: YAML.quick_emit,
and it show many warnings on make test-all.
/usr/home/chkbuild/build/ruby-trunk//ruby/lib/rubygems/specification.rb:706:in `to_yaml': YAML.quick_emit is deprecated
=end

History

#1 Updated by Aaron Patterson over 4 years ago

=begin
On Thu, Dec 16, 2010 at 04:46:33AM +0900, Yui NARUSE wrote:

Bug #4163: RubyGems uses deprecated API: YAML.quick_emit.
http://redmine.ruby-lang.org/issues/show/4163

Author: Yui NARUSE
Status: Assigned, Priority: Normal
Assigned to: Eric Hodel, Category: lib, Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2010-12-15 trunk 30218) [x86_64-freebsd8.1]

RubyGems::Specification#to_yaml uses depcrecated API: YAML.quick_emit,
and it show many warnings on make test-all.
/usr/home/chkbuild/build/ruby-trunk//ruby/lib/rubygems/specification.rb:706:in `to_yaml': YAML.quick_emit is deprecated

Hi Naruse,

How are you running the tests? make test-all TESTS=rubygems doesn't
add the -w flag for me. I'm unsure how to run the tests with warnings
turned on. :-(

--
Aaron Patterson
http://tenderlovemaking.com/

Attachment: (unnamed)
=end

#2 Updated by Yui NARUSE over 4 years ago

=begin
Hi Aaron,

2010/12/16 Aaron Patterson aaron@tenderlovemaking.com:

How are you running the tests?  make test-all TESTS=rubygems doesn't
add the -w flag for me.  I'm unsure how to run the tests with warnings
turned on. :-(

To give -w flag to ruby, you can use RUBYOPT environment variable.
So for make test-all, it will be
make RUBYOPT=-w TESTS=rubygems test-all

FYI, I run test as following:
make RUBYOPT=-w TESTS='-v' TMPDIR=/tmp/test-all test-all|&tee t.log

To show each test name, I specify -v.
To make easy to clean tempfiles when ruby crashs and remain tempfiles,
I specify TMPDIR.
To keep the log, I use |& of zsh.

You may know following options for TESTS are also useful:
-n, --name PATTERN Filter test names on pattern.
-x, --exclude PATTERN Exclude test files on pattern.

--
NARUSE, Yui
naruse@airemix.jp

=end

#3 Updated by Aaron Patterson over 4 years ago

=begin
On Thu, Dec 16, 2010 at 10:06:08AM +0900, NARUSE, Yui wrote:

Hi Aaron,

2010/12/16 Aaron Patterson aaron@tenderlovemaking.com:

How are you running the tests?  make test-all TESTS=rubygems doesn't
add the -w flag for me.  I'm unsure how to run the tests with warnings
turned on. :-(

To give -w flag to ruby, you can use RUBYOPT environment variable.
So for make test-all, it will be
make RUBYOPT=-w TESTS=rubygems test-all

FYI, I run test as following:
make RUBYOPT=-w TESTS='-v' TMPDIR=/tmp/test-all test-all|&tee t.log

Excellent. I didn't know RUBYOPT would be honored while running
everything through make. Thank you.

--
Aaron Patterson
http://tenderlovemaking.com/

Attachment: (unnamed)
=end

#4 Updated by Aaron Patterson over 4 years ago

=begin
On Thu, Dec 16, 2010 at 04:46:33AM +0900, Yui NARUSE wrote:

Bug #4163: RubyGems uses deprecated API: YAML.quick_emit.
http://redmine.ruby-lang.org/issues/show/4163

Author: Yui NARUSE
Status: Assigned, Priority: Normal
Assigned to: Eric Hodel, Category: lib, Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2010-12-15 trunk 30218) [x86_64-freebsd8.1]

RubyGems::Specification#to_yaml uses depcrecated API: YAML.quick_emit,
and it show many warnings on make test-all.
/usr/home/chkbuild/build/ruby-trunk//ruby/lib/rubygems/specification.rb:706:in `to_yaml': YAML.quick_emit is deprecated

The following patch eliminates the deprecated calls and is backwards compatible
with Ruby 1.8. I will submit a patch against the Rubygems repository
and bug tracker.

diff --git a/lib/rubygems/builder.rb b/lib/rubygems/builder.rb
index 2bcd4b0..ff6d922 100644
--- a/lib/rubygems/builder.rb
+++ b/lib/rubygems/builder.rb
@@ -20,6 +20,11 @@ class Gem::Builder
# spec:: [Gem::Specification] The specification instance

def initialize(spec)
  • begin
  • require 'psych'
  • rescue LoadError
  • end + require "yaml" require "rubygems/package" require "rubygems/security" @@ -72,7 +77,8 @@ EOM def write_package open @spec.file_name, 'wb' do |gem_io| Gem::Package.open gem_io, 'w', @signer do |pkg|
  • pkg.metadata = @spec.to_yaml
  • yaml = defined?(Psych) ? Psych.dump(@spec) : YAML.dump(@spec)
  •    pkg.metadata = yaml
    
      @spec.files.each do |file|
        next if File.directory? file
    

--
Aaron Patterson
http://tenderlovemaking.com/

Attachment: (unnamed)
=end

#5 Updated by Eric Hodel about 4 years ago

  • Status changed from Assigned to Closed

=begin
Fixed by import of RubyGems 1.5
=end

#6 Updated by Yui NARUSE almost 3 years ago

  • Description updated (diff)
  • Status changed from Closed to Assigned
  • Target version changed from 1.9.3 to 2.0.0

drbrain (Eric Hodel) wrote:

Fixed by import of RubyGems 1.5

lib/rubygems/specification.rb still uses YAML.quick_emit.

#7 Updated by Eric Hodel over 2 years ago

  • Status changed from Assigned to Closed

Only if psych is not available, so it is OK.

Also available in: Atom PDF