Project

General

Profile

Actions

Bug #4163

closed

RubyGems uses deprecated API: YAML.quick_emit.

Added by naruse (Yui NARUSE) about 14 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2010-12-15 trunk 30218) [x86_64-freebsd8.1]
Backport:
[ruby-core:33735]

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

Actions #1

Updated by tenderlovemaking (Aaron Patterson) about 14 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

Actions #2

Updated by naruse (Yui NARUSE) about 14 years ago

=begin
Hi Aaron,

2010/12/16 Aaron Patterson :

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

=end

Actions #3

Updated by tenderlovemaking (Aaron Patterson) about 14 years ago

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

Hi Aaron,

2010/12/16 Aaron Patterson :

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

Actions #4

Updated by tenderlovemaking (Aaron Patterson) about 14 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

Actions #5

Updated by drbrain (Eric Hodel) almost 14 years ago

  • Status changed from Assigned to Closed

=begin
Fixed by import of RubyGems 1.5
=end

Updated by naruse (Yui NARUSE) over 12 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.

Updated by drbrain (Eric Hodel) over 12 years ago

  • Status changed from Assigned to Closed

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0