guillermo / rake-hooks

Rake hooks let you add callbacks to rake tasks.
MIT License
70 stars 21 forks source link

Bad gemspec format on Heroku #2

Closed Aupajo closed 12 years ago

Aupajo commented 13 years ago

I've isolated a Gemspec issue with Heroku.

Given an empty repository with a Gemfile with:

source :rubygems

gem 'rake-hooks'

A Heroku deploy runs into this Bundler error:

-----> Heroku receiving push
-----> Ruby app detected
-----> Installing dependencies using Bundler version 1.1.pre.8
       Running: bundle install --without development:test --path vendor/bundle --deployment
       Fetching dependency information from the API at http://rubygems.org/Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
       /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:72:in `parse': Illformed requirement ["#<YAML::Syck::DefaultKey:0xc04b918> 0.9.2"] (ArgumentError)
       from /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:97:in `block in initialize'
       from /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:97:in `map!'
       from /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:97:in `initialize'
       from /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:35:in `new'
       from /usr/local/lib/ruby/1.9.1/rubygems/requirement.rb:35:in `create'
       from /usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:61:in `initialize'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:151:in `new'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:151:in `block (2 levels) in fetch_dependency_remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:149:in `map'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:149:in `block in fetch_dependency_remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:148:in `map'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:148:in `fetch_dependency_remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:98:in `fetch_remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/fetcher.rb:64:in `specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/source.rb:225:in `block in remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/source.rb:223:in `each'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/source.rb:223:in `remote_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/source.rb:156:in `fetch_specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/source.rb:70:in `specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/lazy_specification.rb:48:in `__materialize__'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/spec_set.rb:86:in `block in materialize'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/spec_set.rb:83:in `map!'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/spec_set.rb:83:in `materialize'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/definition.rb:90:in `specs'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/definition.rb:85:in `resolve_remotely!'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/installer.rb:48:in `run'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/installer.rb:12:in `install'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/cli.rb:213:in `install'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/vendor/thor/task.rb:22:in `run'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/vendor/thor.rb:263:in `dispatch'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/lib/bundler/vendor/thor/base.rb:386:in `start'
       from /tmp/build_221ob0xm939ux/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.pre.8/bin/bundle:13:in `<top (required)>'
       from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `load'
       from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `<main>'
 !
 !     Failed to install gems via Bundler.

The Gemspec needs to be fixed somehow. I tried a few different things but I've had no luck.

There are some notes from tenderlove on the RubyGems blog on the subject, and some notes on this issue.

Aupajo commented 13 years ago

The built gemspec can be read with:

rake build
tar xvf pkg/rake-hooks-*.gem
gzcat pkg/metadata.gz

If that helps. Still trying to debug.

guillermo commented 13 years ago

I will look into it in about 12 hours

joelmoss commented 12 years ago

This is still an issue with Bundler 1.1.rc...

"Unfortunately, the gem rake-hooks (1) has an invalid gemspec. As a result, Bundler cannot install this Gemfile. Please ask the gem author to yank the bad version to fix this issue. For more information, see http://bit.ly/illformed-requirement."

Unfortunately, it doesn't tell me which version of Rake-hooks is the culprit. Or maybe it does: the 1 within the parenthesis. Looks like it maybe v1.

guillermo commented 12 years ago

I just create a new app:

heroku apps:create
Creating floating-moon-2459.... done, stack is bamboo-mri-1.9.2
http://floating-moon-2459.heroku.com/ | git@heroku.com:floating-moon-2459.git

Create a hello world config.ru Create a Gemfile with only rake-hooks bundle install

Commit all and push, and everything works as spected.

$ git push
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 610 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)

-----> Heroku receiving push
-----> Ruby/Rack app detected
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test

 !     Gemfile.lock will soon be required
 !     Check Gemfile.lock into git with `git add Gemfile.lock`
 !     See http://devcenter.heroku.com/articles/bundler

       Fetching source index for http://rubygems.org/
       Installing rake (0.9.2.2) 
       Installing rake-hooks (1.2) 
       Using bundler (1.0.7) 
       Your bundle is complete! It was installed into ./.bundle/gems/
-----> Compiled slug size is 112K
-----> Launching... done, v3
       http://floating-moon-2459.heroku.com deployed to Heroku

To git@heroku.com:floating-moon-2459.git
 * [new branch]      master -> master

All works.

Then I try with cedar heroku stack (the beta one), and found that it fails. Use that version of bundler to test 1.1rc And was be able to reproduce the error.

The rubygem was created with bundler, and is managed by bundler. I will recreate the gem with the new version of bundler. If it continues failing, if a bundler bug.

guillermo commented 12 years ago

I try to build a new version of the gem with bundler 1.1rc, and then compare the metadata:

$ diff rake-hooks-1.2.1/metadata rake-hooks-1.2.2/metadata 
4c4
<   version: 1.2.1
---
>   version: 1.2.2
17c17
<   requirement: &2153129740 !ruby/object:Gem::Requirement
---
>   requirement: &2165298680 !ruby/object:Gem::Requirement
25c25
<   version_requirements: *2153129740
---
>   version_requirements: *2165298680
28c28
<   requirement: &2153129320 !ruby/object:Gem::Requirement
---
>   requirement: &2165298260 !ruby/object:Gem::Requirement
36c36
<   version_requirements: *2153129320
---
>   version_requirements: *2165298260
guillermo commented 12 years ago

It seems like that is a bug in bundler rc. As long as you are using cedar stack, that ships with a release candidate of bundler, you will have to wait bundler to fixit, or heroku to fixit.

I check the gemspec and the metadata and both were generated correctly.

You can see a lot of bugs on bundler issues.

For example: https://github.com/carlhuda/bundler/issues/1378

The only work around I see, is to move to an stable stack, until the beta is fixed with a version of bundler that is fixed.

guillermo commented 12 years ago

Of course, if you have the time to work around this, any kind of help could be good.