Hundreds of repeated instances of "Gem::SourceIndex#add_spec is deprecated" #70

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@tadman

tadman commented Jun 2, 2011

This small patch tracks what callers triggered what deprecation warnings and will warn once only per instance.

One of the problems here is that add_spec is inside a loop in the add_specs implementation. You will get hit with a heap of warnings that appear to originate from rubygems, but actually come from outside, such as bundler-1.0.14.

Sample output from before:

Gem::SourceIndex#add_specs called from /opt/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:176.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.

This actually continues.

Sample output after:

NOTE: Gem::SourceIndex#add_specs is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_specs called from /opt/local/rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:176.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:197.
@zenspider

This comment has been minimized.

Show comment
Hide comment
@zenspider

zenspider Jun 7, 2011

Contributor

I'd rather just wrap add_specs' call to add_spec. I'll do that now.

Contributor

zenspider commented Jun 7, 2011

I'd rather just wrap add_specs' call to add_spec. I'll do that now.

@zenspider zenspider closed this Jun 7, 2011

@zenspider

This comment has been minimized.

Show comment
Hide comment
@zenspider

zenspider Jun 7, 2011

Contributor

Done and attributed to you for the suggestion. thanks.

Contributor

zenspider commented Jun 7, 2011

Done and attributed to you for the suggestion. thanks.

@alexch

This comment has been minimized.

Show comment
Hide comment
@alexch

alexch Jun 8, 2011

Contributor

I'd just like to note -- in as gracious and non-whiny a tone as is possible in an Internet comment -- that this patch is redundant with pull request 59, which gives a more concise and usable report on all deprecated calls, including duplicated ones, so you could take that incongruous "Gem::Deprecate.skip_during" wrapper code out of add_specs, and deal with deprecations inside the well-encapsulated Deprecated class.
c89524b
#84 (old "scary warnings" bug, ported to github)

Contributor

alexch commented Jun 8, 2011

I'd just like to note -- in as gracious and non-whiny a tone as is possible in an Internet comment -- that this patch is redundant with pull request 59, which gives a more concise and usable report on all deprecated calls, including duplicated ones, so you could take that incongruous "Gem::Deprecate.skip_during" wrapper code out of add_specs, and deal with deprecations inside the well-encapsulated Deprecated class.
c89524b
#84 (old "scary warnings" bug, ported to github)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment