Giter Club home page Giter Club logo

Comments (5)

luislavena avatar luislavena commented on July 17, 2024

Hello @rtacconi, thank you for your report and your pull request (#10).

However, there are things that are not clear on this.

gem-compiler relies on the gemspec that exist inside the gem, which is not the gemspec that mysql2 (or any other gem using gemspec files) uses.

If the gem uses git ls-files to determine the files included in the gem, that do not affect gem-compiler, since the gemspec is serialized as YAML inside the gem (and that is the gemspec we use).

To give you an example:

luis@Nostromo:~/code/_sandbox$ ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
luis@Nostromo:~/code/_sandbox$ gem -v
2.2.3

luis@Nostromo:~/code/_sandbox$ gem fetch mysql2
Fetching: mysql2-0.3.17.gem (100%)
Downloaded mysql2-0.3.17

luis@Nostromo:~/code/_sandbox$ gem spec mysql2-0.3.17.gem > original.gemspec

luis@Nostromo:~/code/_sandbox$ gem compile mysql2-0.3.17.gem
Unpacking gem: 'mysql2-0.3.17' in temporary directory...
Building native extensions.  This could take a while...
WARNING:  no description specified
WARNING:  open-ended dependency on eventmachine (>= 0, development) is not recommended
  if eventmachine is semantically versioned, use:
    add_development_dependency 'eventmachine', '~> 0'
WARNING:  pessimistic dependency on rake-compiler (~> 0.8.1, development) may be overly strict
  if rake-compiler is semantically versioned, use:
    add_development_dependency 'rake-compiler', '~> 0.8', '>= 0.8.1'
WARNING:  pessimistic dependency on rake (~> 0.9.3, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 0.9', '>= 0.9.3'
WARNING:  pessimistic dependency on rspec (~> 2.8.0, development) may be overly strict
  if rspec is semantically versioned, use:
    add_development_dependency 'rspec', '~> 2.8', '>= 2.8.0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: mysql2
  Version: 0.3.17
  File: mysql2-0.3.17-x86_64-darwin-14.gem

luis@Nostromo:~/code/_sandbox$ gem spec mysql2-0.3.17-x86_64-darwin-14.gem > compiled.gemspec

luis@Nostromo:~/code/_sandbox$ diff -u original.gemspec compiled.gemspec

Which produces the following diff:

--- original.gemspec    2015-01-12 19:36:51.000000000 -0300
+++ compiled.gemspec    2015-01-12 19:37:59.000000000 -0300
@@ -2,7 +2,7 @@
 name: mysql2
 version: !ruby/object:Gem::Version
   version: 0.3.17
-platform: ruby
+platform: x86_64-darwin-14
 authors:
 - Brian Lopez
 autorequire:
@@ -69,12 +69,13 @@
 description:
 email: [email protected]
 executables: []
-extensions:
-- ext/mysql2/extconf.rb
+extensions: []
 extra_rdoc_files: []
 files:
 - MIT-LICENSE
 - README.md
+- examples/eventmachine.rb
+- examples/threaded.rb
 - ext/mysql2/client.c
 - ext/mysql2/client.h
 - ext/mysql2/extconf.rb
@@ -92,12 +93,9 @@
 - lib/mysql2/console.rb
 - lib/mysql2/em.rb
 - lib/mysql2/error.rb
+- lib/mysql2/mysql2.bundle
 - lib/mysql2/result.rb
 - lib/mysql2/version.rb
-- support/mysql_enc_to_ruby.rb
-- support/ruby_enc_to_mysql.rb
-- examples/eventmachine.rb
-- examples/threaded.rb
 - spec/configuration.yml.example
 - spec/em/em_spec.rb
 - spec/my.cnf.example
@@ -107,6 +105,8 @@
 - spec/rcov.opts
 - spec/spec_helper.rb
 - spec/test_data
+- support/mysql_enc_to_ruby.rb
+- support/ruby_enc_to_mysql.rb
 homepage: http://github.com/brianmario/mysql2
 licenses:
 - MIT

Ignoring for a second the order of files (support, examples), you will notice the removal of extensions and the addition of it into files section.

This is working as expected since gem-compiler does not use the gem's original gemspec but instead the one bundled inside the .gem file.

You will notice that all generated artifacts are properly collected and added to the clone of the gemspec:

https://github.com/luislavena/gem-compiler/blob/master/lib/rubygems/compiler.rb#L36-L48

Which again, is not the original gemspec of the gem (from the gem repository) but the gemspec of the gem.

If you can perform the exact same steps I've shown above and show me the diff of the gemspec we might investigate what is going on.

from gem-compiler.

rtacconi avatar rtacconi commented on July 17, 2024

@luislavena thanks for your reply. I tried to build mysql2 in my mac and you are right, it includes lib/mysql2/mysql2.bundle. Il will to the same test on CentOS just to make sure I am wrong. I will let you know about the result of the test.

from gem-compiler.

luislavena avatar luislavena commented on July 17, 2024

@rtacconi have you tested this further?

I believe the issue is caused by RubyGems version 2.4 and not gem-compiler.

I just tested with RubyGems 2.4.3 and the generated gemspec do not include the extensions.

Your pull request do not solve that since the binary extensions are no longer installed relative to the gem but instead on a shared directory.

This might require some investigation, but I don't have the time for adding guards around RubyGems changes right now 😢

Feel free to investigate and will gladly merge your changes.

Thank you.

from gem-compiler.

luislavena avatar luislavena commented on July 17, 2024

@rtacconi any update?

I just tested against RubyGems 2.4.5 and it indeed packaged the binary extension inside of it:

vagrant@precise64:/vagrant$ gem spec mysql2-0.3.17-x86_64-linux.gem files
...

- lib/mysql2/em.rb
- lib/mysql2/error.rb
- lib/mysql2/mysql2.so
- lib/mysql2/result.rb
- lib/mysql2/version.rb

I remember that a trick for this was already part of gem-compiler:

https://github.com/luislavena/gem-compiler/blob/master/lib/rubygems/compiler.rb#L96-L100

Not sure what happened on my preliminary test that failed, but tried again and it worked without issue.

Please respond with details that you can consistently reproduce this problem for me to look into.

Thank you.

from gem-compiler.

luislavena avatar luislavena commented on July 17, 2024

Closing this due lack of responses.

Please provide detailed information (previously requested) for this to be reopen.

Thank you.

from gem-compiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.